willisoften Posted February 11, 2003 Report Share Posted February 11, 2003 I'm having a problem with both netbeans, jedit and using javac through the command line. Importing classes isn't working. It is working under windows with both Kawa and the SDK. uuInOut is a single class file not a package. The program below illustrates problem. Perhaps I'm doing something stupid and its just driving me nuts! import uuInOut; class Test{ public static void main(String [] args){ int x; x= uuInOut.ReadInt(); System.out.println("Number entered was: "+x); } } Test.java:2: '.' expected import uuInOut; ^ Test.java:9: cannot resolve symbol symbol : variable uuInOut location: class Test x= uuInOut.ReadInt(); ^ 2 errors Process javac exited with code 1[/code] Quote Link to comment Share on other sites More sharing options...
Steve Scrimpshire Posted February 11, 2003 Report Share Posted February 11, 2003 I don't understand this stuff, but I did a Google search and you might find this useful: http://www.mail-archive.com/java-linux@jav...g/msg15185.html The replier mentioned that you have to have a fully qualified class path. Quote Link to comment Share on other sites More sharing options...
ramfree17 Posted February 12, 2003 Report Share Posted February 12, 2003 you can only use that kind of importing if the class being imported and the source file being compiled belongs to the same package (either defined or unnamed). otherwise you have to use the fully qualified packagename for importing. ciao! Quote Link to comment Share on other sites More sharing options...
willisoften Posted February 13, 2003 Author Report Share Posted February 13, 2003 thanks ramfree17, I think the problem arose because my lectures and practical classes (and windows compiler) use the jdk 1.3. Using 1.3 importing a class file is ok. Under 1.4 it is no longer permissible to import a class unless the class is in a named package. From http://krypton.mankato.msus.edu/~slack/jav...ook/errors.html A nuisance if you ask me! Steve Scrimpshire Thanks for your input, appreciated. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.