Anyone have an idea why this command works fine in Windows but in Linux I get a ClassNotFoundException game.ui.Main
java -cp ".;lib/*" game.ui.Main -Xms64m -Xmx128m
my folder structure looks like this: lib/ - Jars game/ - Class files
This is the latest Java 6.
Setting Java Classpath in UNIX or Linux Now to check the value of Java CLASSPATH in Linux type "echo ${CLASSPATH}" this will print the value of Classpath in the command prompt.
The classpath syntax is OS-dependent. From Wikipedia :
Being closely associated with the file system, the command-line Classpath syntax depends on the operating system. For example:
on all Unix-like operating systems (such as Linux and Mac OS X), the directory structure has a Unix syntax, with separate file paths separated by a colon (":").
on Windows, the directory structure has a Windows syntax, and each file path must be separated by a semicolon (";").
This does not apply when the Classpath is defined in manifest files, where each file path must be separated by a space (" "), regardless of the operating system.
Try changing the semi-colon to a colon.
The CLASSPATH separator is platform dependent, and is the same as the character returned by java.io.File.pathSeparatorChar.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With