What version of Java/javac are you using? I do get an error when I try something similar, but it is not the error that you state.
states "'.' expected" The reason for this is that you do not need to import classes that are in the same package. Also, by the nature of the naming, you do not need to import classes in the root package. As such, the import statement expects at least one "." to identify the package from which you are trying to import. If your Logger class is not in the root package, you have to say something like:
I fyour Logger is in the same package as your DBHandle, you do not even need to import it.
Piscis Babelis est parvus, flavus, et hiridicus, et est probabiliter insolitissima raritas in toto mundo.
Joined: Apr 17, 2003
Thank you for Barry and Joel. Thank you very much. I use JBuilder. To Barry: When I remove the line: import Logger; , it say: "DBHandler.java": Error #: 300 : class Logger not found in class DBHandler at line 6, column 12. So I want to add the line: import Logger; . To Joel: It's not at root.I use "Context" to point to F:\JSPSTUDY\,but I use JBuilder to make them.The version of JDK in JBuilder is jdk1.3.1 . The Logger.java and DBHandler.java are at the same project--JSPSTUDY of JBuilder. When I remove the line: import Logger; , the result is what I said to Barry. And the Logger.java can make to Logger.class, but when I make the DBHandler,the Logger.class delete. [ April 17, 2003: Message edited by: XJie Tu ]
Joined: Aug 03, 2002
You should not need to say "import Logger;" if the classes are in the same package. In fact, "import Logger;" means "make the class Logger available from the default package" This is worrying:
And the Logger.java can make to Logger.class, but when I make the DBHandler,the Logger.class delete.
Do you really mean that compiling DBHandler.java causes the previously compiled output Logger.class to be removed from the disk? I think, the best thing to do is to try and compile everything at the command line level without using the JBuilder IDE. (Without the "import Logger;" )
subject: Error #: 361 : class required, but identifier found(Details)