Home arrow static arrow Java Programming [Archive] - Compilation error
Warning: Creating default object from empty value in /www/htdocs/w008deb8/wiki/components/com_staticxt/staticxt.php on line 51
Java Programming [Archive] - Compilation error
This topic has 15 replies on 2 pages.    1 | 2 | Next »

Posts:57
Registered: 4/29/04
Compilation error  
Jun 14, 2004 11:47 AM



 
hello all,

i have an rmi small application, this application constitue of one remote interface and its implementation class, that is the server, and a client to invoke remote methods, i compile the remote interface and then compile the implementation class, when compile implementation class on win98 it do well, but when compile it on win2000 it display an error " cann't resolve symbol RemoteInterface" ,knowing that both the RemoteInterface and the implementation class reside in bin dir.
what is the problem?
 

Posts:24,036
Registered: 2/3/03
Re: Compilation error  
Jun 14, 2004 11:49 AM (reply 1 of 15)



 
what is the problem?

The required files are not in your classpath (classpath != path).

[url=http://wiki.java.net/bin/view/Javapedia/ClassPath]The Gateway to Classpath Nirvana[/url]
[url=http://java.sun.com/j2se/1.4.2/docs/tooldocs/windows/classpath.html]Setting the class path[/url] (Windows)
[url=http://java.sun.com/j2se/1.4.2/docs/tooldocs/findingclasses.html]How Classes are Found[/url]
 

Posts:57
Registered: 4/29/04
Re: Compilation error  
Jun 14, 2004 11:51 AM (reply 2 of 15)



 
hello,

i put the RemoteInterface path in classpath but the problem didn't solve?
 

Posts:24,036
Registered: 2/3/03
Re: Compilation error  
Jun 14, 2004 11:57 AM (reply 3 of 15)



 
javac -classpath .;<any additional jar files or directories> YourClassName.java
You get a "cannot resolve symbol" message because the compiler can't find your class. The way to remedy this is to ensure that your class is included in the classpath. The example assumes that you are in the same directory as the class you're trying to run.
 

Posts:57
Registered: 4/29/04
Re: Compilation error  
Jun 14, 2004 12:05 PM (reply 4 of 15)



 
The way to remedy this is to ensure that your class is included in the classpath. The example assumes >that you are in the same directory as the class you're trying to run.

all classes reside in bin directory and this problem didn't appeare on win98.
 

Posts:37,103
Registered: 3/30/99
Re: Compilation error  
Jun 14, 2004 3:02 PM (reply 5 of 15)



 
What is your classpath (either by CLASSPATH environment variable or by the -classpath arg on the command line)?

The bin dir is usually part of PATH, not CLASSPATH. As yawmark pointed out, PATH has nothing to do with finding Java classes.

 

Posts:57
Registered: 4/29/04
Re: Compilation error  
Jun 15, 2004 11:48 AM (reply 6 of 15)



 
hello,

i add bin to PATH and add the RemoteInterface to CLASSPATH, this didn't solve the problem!!
 

Posts:24,036
Registered: 2/3/03
Re: Compilation error  
Jun 15, 2004 11:55 AM (reply 7 of 15)



 
hello,

i add bin to PATH and add the RemoteInterface to
CLASSPATH, this didn't solve the problem!!

Then you did it incorrectly.
 

Posts:24,036
Registered: 2/3/03
Re: Compilation error  
Jun 15, 2004 11:59 AM (reply 8 of 15)



 
Go to the directory containing RemoteInterface and type:
javac -classpath .;<any additional required jar files or directories> RemoteInterface.java
Make sure you engage your brain while doing so, lest we be forced to smite you with a infirm Mallard. When you inevitably fail, return and post your directory contents along with the EXACT command you typed to compile the source code.
 

Posts:37,103
Registered: 3/30/99
Re: Compilation error  
Jun 15, 2004 12:02 PM (reply 9 of 15)



 
hello,

i add bin to PATH and add the RemoteInterface to
CLASSPATH, this didn't solve the problem!!

PATH has nothing to do with it.

And what do you mean you added "the RemoteInterface" to CLASSPATH? You mean RemoteInterface.clas" That won't help.

Let's say RemoteInterface is in package foo.bar (i.e., the FQCN is foo.bar.RemoteInterface). Then somewhere on your system there is either a path like:
C:\stuff\whatever\foo\bar\RemoteInterface.class 
in which case you need to put C:\stuff\whatever into your classpath

OR it's in a jar file, in which case you add that jar file (not its parent directory) to your classpath.

This is EJB stuff, right? EJBs are not part of the core java distribution, so you need to have something else--maybe j2ee.jar or ejb.jar or something--there's something additional that you have to install and point to.
 

Posts:24,036
Registered: 2/3/03
Re: Compilation error  
Jun 15, 2004 12:10 PM (reply 10 of 15)



 
This is EJB stuff, right?

Nah, you can do RMI with core Java.
 

Posts:21,719
Registered: 98-02-20
Re: Compilation error  
Jun 15, 2004 12:14 PM (reply 11 of 15)



 
Did you run the rmic compiler to generate the stub and skeleton?

I think maybe the RMI tutorial could be in order here:

http://java.sun.com/docs/books/tutorial/rmi/

%
 

Posts:57
Registered: 4/29/04
Re: Compilation error  
Jun 15, 2004 12:16 PM (reply 12 of 15)



 
before run the rmic you should compile the source code by javac then generat the stub and skeleton
 

Posts:37,103
Registered: 3/30/99
Re: Compilation error  
Jun 15, 2004 12:29 PM (reply 13 of 15)



 
This is EJB stuff, right?

Nah, you can do RMI with core Java.

Oh, I thought RemoteInterface was EJB, but now that you mention it, I do remember him mentioning RMI.

Well, then, if the class that it doesn't like is part of core Java, then either a) he has a bad Java install or b) he forgot to import java.rmi.whatever. (Although didn't he say it "worked" on another box?)

The OP hasn't given much in the way of details, and what has come has been piecemeal, so it's hard to get a good picture of what's going on.
 

Posts:37,103
Registered: 3/30/99
Re: Compilation error  
Jun 15, 2004 12:31 PM (reply 14 of 15)



 
Can you provide a small but complete example that we can use to try to duplicate your problem? Post the code and the exact command you use to compile, along with your CLASSPATH variable, and where any other jar files or directories are that you depend on, and also post the complete error message.

When you post code, please use [code] and [/code] tags as described in [url=http://forum.java.sun.com/features.jsp#Formatting]Formatting Help[/url] on the message entry page. It makes it much easier to read.
 
This topic has 15 replies on 2 pages.    1 | 2 | Next »