Archived

This forum has been archived. Please start a new discussion on GitHub.

err: java Server

My operation system is Windows XP. I installed Ice-1.5.1 in directory E:\Ice-1.5.1, and have set environment variables as follows,
ICEJ_HOME E:\Ice-1.5.1
Path %ICEJ_HOME%\bin
CLASSPATH .;%ICEJ_HOME%\lib\Ice.jar

I copyed your demo "hello", which is in E:\Ice-1.5.1\deomj\Ice\, and pasted it in G:\.

The follows is result.

G:\hello>mkdir G

G:\hello>slice2java --output-dir G Hello.ice

G:\hello>javac -classpath %ICEJ_HOME%/lib/Ice.jar -source 1.4 Server.java HelloI.java G/*.java

G:\hello>javac -classpath %ICEJ_HOME%/lib/Ice.jar -source 1.4 Client.java HelloI.java G/*.java

G:\hello>java Server
Exception in thread "main" java.lang.NoClassDefFoundError: Hello
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:604)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:12
3)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
at java.net.URLClassLoader.access+100(URLClassLoader.java:56)
at java.net.URLClassLoader+1.run(URLClassLoader.java:195)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:279)
at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)
at Server.run(Server.java:16)
at Server.main(Server.java:34)

G:\hello>

The compilation successed, but the execution failed, why?

Comments

  • marc
    marc Florida
    You must include the G subdirectory in your CLASSPATH, so that the compiled Java files are found.
  • Hi, March
    "Hello World" was showed. Thanks for your help.
    But I used a unwise approach. I copied all files in G directory, and pasted them in hello directory. Then I run command "java Server" in a cmd and run command java Client in another cmd, and followed Client's help, the "Hello World" was showed in Server.

    But I don't know how to use classpath in java command.
  • Additionally, last Friday, I introduced ICE to my mentor and schoolmates in a meeting. Of course, they only know CORBA, but ICE. But when I introduced differences between CORBA and ICE, especially, the superiorities of ICE, some of them became interested in the new distributed middleware. But there is few document on ICE we can obtained.
    Because of some of common features between CORBA and ICE, I only read papers on CORBA and the manual of ICE. But I have little knowledge about CORBA, can you give me some suggestions for learning ICE?
    Thanks very much!