Archived

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

A primary question

hi, there,
This seems simply a java primary quesion but hope getting some helps from here. This is my first java application.

I can compile and run the demo hello sucefully in the IDE of Eclipse but failed if I open a terminal window to run the command : java Server

Exception in thread "main" java.lang.NoClassDefFoundError: Ice/Object


I have set the classpath = ......../ice.jar .

What should I do further?

TIA-OrNot

Comments

  • bernard
    bernard Jupiter, FL
    It's a problem with your classpath. Make sure CLASSPATH is defined in your shell (or specify it with -cp on the command line); also remember the path separator on Windows is ';'.

    Cheers,
    Bernard
  • Thank you.

    Another question :) :

    Doesn't the slice directives #include < > make any sense in Java? That's, it only works in c++ ? What slice language will translate to "import" in java?
  • benoit
    benoit Rennes, France
    Hi,

    The #include directive in a slice file is a slice construct and it doesn't necessarily have any equivalent in the targeted programing language. Please see the Slice-to-Java mapping chapter in the Ice manual for more information on how Slice definitions are translated in Java.

    Benoit.
  • hi, Benoit,
    Do you mean the section of 4.4.3? I have read it carefully but still feel confused about the "include" so I aske the question above. Could you please give me more helps?
    Thank you very much.

    OrNot
  • benoit
    benoit Rennes, France
    As explained in the section 4.4.3 of the manual, the Slice translators use the C preprocessor to process a Slice file, this allows the use of #include directives (with the restrictions mentioned in the manual) and macro definitions in Slice files. But this has nothing to do with the targeted programing language. Slice files are programming language-independant ;).

    Once the slice definitions are parsed by the translator, they are translated according to the mapping rules of each language. I recommend to take a look at Chapter 10 and 12 for more information on the Slice-to-Java language mapping. You could also simply try to translate a Slice file that contains a #include directive with the slice2java translator and see how the Slice definitions are translated in Java definitions :).

    Benoit.
  • Thank you So much,Benoit.

    In c++, it seems the #include <foo.ice> in slice file is mapped into #include <foo.h>. I have thought that it will be mapped into
    import foo.*
    in java . But It doesn't. Maybe it was for I did not find the right usage of the slice2java command?
  • marc
    marc Florida
    In Java, #include isn't mapped to anything. It is simply a statement for the Slice translator to include other Slice files.
  • Thank you Marc.
    I got it :) .