Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Classpath and environment problem ? 1

Status
Not open for further replies.

zephan

Programmer
Jan 14, 2002
217
0
0
A2
Hi All,
I compiled a java program on a windows PC, it works fine in the IDE. I then copy the entire folder to a Linux server, and it works fine. But when I run the program on my PC from the command line, it does'nt work, even the syntax is the same on linux means java -cp full_path_to/a_jar_file.jar:root relative_path_to_class/classname

The error message is java.lang.NoClassDefFoundError
relative_path_to_class/classname

What could be the error
 
A directory to much or to less in the classname.

Directory: /somewhere/a/b/c/D.class
Package: b.c
Class: D

Code:
cd /somewhere 
java a.b.c.D
Wrong: a is not part of the classname (packagename).
Code:
cd a/b
java c.D
Wrong: b is part of the packagename and might not be omited.
Code:
cd ..
java b.c.D
Should work.



don't visit my homepage:
 
Also think that directories syntax is not the same in Windos and Linux ...

Cheers,
Dian
 
What do you mean Dianceht, of course I used c:\path_to_app instead of /volume/path_to_app
 
What about the relative paths? Keep in mind that / in Windos points to c:

Cheers,
Dian
 
If you're trying to run a jar file, just try:
java -jar path\jarfile.jar
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top