Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / GUI / September 2007

Tip: Looking for answers? Try searching our database.

include another java file

Thread view: 
moongeegee - 20 Sep 2007 20:39 GMT
I use import TableTest1 in my TableDemo.java file. But I got compiling
error as below.

TableDemo.java:5: '.' expected
import TableTest1;
                 ^

Please help.
Laurent D.A.M. MENTEN - 20 Sep 2007 20:45 GMT
moongeegee a écrit :
> I use import TableTest1 in my TableDemo.java file. But I got compiling
> error as below.
[quoted text clipped - 4 lines]
>
> Please help.

If TableTest1 is a class, either it is in the same package so you don't
need to import it, or it is in another package then you have to prefix
it with its package specification.
Roedy Green - 21 Sep 2007 03:29 GMT
>I use import TableTest1 in my TableDemo.java file. But I got compiling
>error as below.
>
>TableDemo.java:5: '.' expected
>import TableTest1;

you need to post more code to make the error clear. See
http://mindprod.com/jgloss/import.html
http://mindprod.com/jgloss/package.html
Signature

Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com

Roedy Green - 21 Sep 2007 03:41 GMT
>TableDemo.java:5: '.' expected
>import TableTest1;
>                  ^
package names are usually all lower case.
You don't import classes that don't live in packages.  
If you have more than one class, they all should live in explicit
packages.
Signature

Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com

Thomas A. Russ - 21 Sep 2007 19:11 GMT
> I use import TableTest1 in my TableDemo.java file. But I got compiling
> error as below.
>
> TableDemo.java:5: '.' expected
> import TableTest1;
>                   ^

Import is only needed for classes defined in other Java Packages.  It
deals with package visibility in your file.  Eliminate the import statement.

Signature

Thomas A. Russ,  USC/Information Sciences Institute

Lew - 21 Sep 2007 20:11 GMT
>> I use import TableTest1 in my TableDemo.java file. But I got compiling
>> error as below.
[quoted text clipped - 5 lines]
> Import is only needed for classes defined in other Java Packages [sic].  It
> deals with package visibility in your file.  Eliminate the import statement.

The source of the compiler error was
<http://java.sun.com/docs/books/jls/third_edition/html/packages.html#7.5>
> It is a compile time error to import a type from the unnamed package.

Arguably the error message should say so in just those words, instead of "'.'
expected".

Signature

Lew

Roedy Green - 22 Sep 2007 00:26 GMT
>TableDemo.java:5: '.' expected
>import TableTest1;

see http://mindprod.com/jgloss/compileerrormessages.html#DOTEXPECTED
Signature

Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.