This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Error #: 361 : class required, but identifier found(Details) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Error #: 361 : class required, but identifier found(Details)" Watch "Error #: 361 : class required, but identifier found(Details)" New topic
Author

Error #: 361 : class required, but identifier found(Details)

XJie Tu
Greenhorn

Joined: Apr 17, 2003
Posts: 6
Logger.java--->can make to Logger.class
DBHandle.java--->have to use Logger.class
DBHandle.java-->making....
Error at :import Logger;
Error #: 361 : class required,but identifier found

and Logger.class is deleted when DBHandle.java making
What's worry???
[ April 17, 2003: Message edited by: XJie Tu ]
Barry Gaunt
Ranch Hand

Joined: Aug 03, 2002
Posts: 7729
Welcome to Javaranch XJie Tu,
what happens when you remove the line: import Logger; ??
[ April 17, 2003: Message edited by: Barry Gaunt ]

Ask a Meaningful Question and HowToAskQuestionsOnJavaRanch
Getting someone to think and try something out is much more useful than just telling them the answer.
Joel McNary
Bartender

Joined: Aug 20, 2001
Posts: 1817

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.

compiles fine,

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.
XJie Tu
Greenhorn

Joined: Apr 17, 2003
Posts: 6
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 ]
Barry Gaunt
Ranch Hand

Joined: Aug 03, 2002
Posts: 7729
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;" )
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Error #: 361 : class required, but identifier found(Details)
 
Similar Threads
A problem using charAt..........
Abstract Classes - A Problem
Error #: 361 : class required, but identifier found
"Invalid class file format and The major.minor version '48.0' is too recent for this tool
UnavailableException: Cannot load a validator resource from '/WEB-INF/