• Post Reply Bookmark Topic Watch Topic
  • New Topic

cannot find Symbol (Interface)  RSS feed

 
Tahir Abbas
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Everyone!

I just started work on RMI(B&S). Just made one interface and one implementation Class in the same package. Compilation of interface class is okay but when implementation file was compiled then received following message:-

RemoteImpl.jave:11: cannot find Symbol
Symbol: class RemMethods

public class RemoteImpl extends UnicastRemoteObject implements RemMethods
^
1 error

Both files, interface and implementation, are in same package and i used the following command at Dos Prompt for compilation.

c:\scjd\Project\src\rmiServer>javac RemoteImpl.java -d c:\scjd\Project\bin\

I'll be very thankful to you for the response.

Tahir
[ April 21, 2008: Message edited by: Tahir Abbas ]
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you're using the "-d" switch, then source and class files are not in the same directory, correct? So you must include the directory containing the classes in the classpath during compilation:
 
Tahir Abbas
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you very much for very early response

It has solved this problem.

Sorry i am bothering you with another question.

After this i give this command
c:\scjd\Project\src\rmiServer>rmic RemoteImpl -classpath c:\scjd\Project\bin\

c:\scjd\Project\src\rmiServer>rmiregistry

it worked fine

but when i typed this command
c:\scjd\Project\src\rmiServer> java RemoteImpl -classpath c:\scjd\Project\bin\

i received error message

Thanks in Advance
[ April 22, 2008: Message edited by: Tahir Abbas ]
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i received error message

What error is that?

But regardless of that, "java" and "rmic"/"rmiregistry" do very different things, so it shouldn't be surprising that you can't use them interchangeably. In particular, "java" expects the class you launch it with to contain a "main" method (which a Remote object probably doesn't have.)
 
Tahir Abbas
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The file RemoteImpl has the main method
So after running c:\scjd\Project\src\rmiServer> rmiregistry i typed

c:\scjd\Project\src\rmiServer>java RemoteImpl -classpath c:\scjd\Project\bin\

then the following error messages appeared
exception in thread "main" java.lang.NoClassDefFoundError: RemoteImpl (wrong Name:rmiServer/RemoteImpl)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:12)

at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
at java.net.URLClassLoader.access$000(URLClassLoader.java:56)
at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
at java.security.SecureClassLoader.doPrivilaged(Native Mathod)
at java.net.URLClassLoader.findClass(URLClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launher.java:276)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
[ April 22, 2008: Message edited by: Tahir Abbas ]
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Where is the file RemoteImpl.class? If class RemoteImpl is in package rmiServer, then it needs to be in directory c:\scjd\Project\bin\rmiServer
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!