I'm trying to run an application that has native libraries and stuff using the following code:
ProcessBuilder pb = new ProcessBuilder("javaw",
"-classpath",
binDir + "polyrd.jar;" + binDir + "lwjgl.jar;" + binDir + "lwjgl_util.jar;",
"-Djava.library.path=" + nativesDir,
"monster860.polyrd.Polyrd");
I tried doing the equivalent in the command line, changing it to -cp, just using bindir
instead of binDir + "polyrd.jar;" + binDir + "lwjgl.jar;" + binDir + "lwjgl_util.jar;"
, and switching between java and javaw, but no matter what I did it gave me:
java.lang.NoClassDefFoundError: monster860/polyrd/Polyrd
Caused by: java.lang.ClassNotFoundException: monster860.polyrd.Polyrd
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
Can anyone help?
My operating system is Windows Vista.
Yes, those files actually exist.
Here's how I got binDir
and nativesDir
:
public ProcessRunnable(File nativesDir, File binDir) {
try {
this.nativesDir = nativesDir.getCanonicalPath() + File.separator;
this.binDir = binDir.getCanonicalPath() + File.separator;
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
EDIT:
Well, of course, it's has absolutely nothing to do with this, but the downloader downloading only the first 2 KB of the file.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…