我试图打开一个充满java .class文件的.exe文件..当我用鼠标点击打开它时它可以工作但是当我用我的Java应用程序打开它时我得到了一个JNI错误
该程序名为PokeMMO.exe 网站:PokeMMo
我试图获取输出流...这里是代码:
public static void main(String[] args) throws Exception {
System.out.println("STARTING");
System.out.println();
Runtime rt = Runtime.getRuntime();
String[] commands = {"C:\\Users\\{MY USER NAME}\\AppData\\Roaming\\PokeMMO\\PokeMMO.exe"};
Process proc = rt.exec(commands);
BufferedReader Input = new BufferedReader(new InputStreamReader(proc.getInputStream()));
BufferedReader Error = new BufferedReader(new InputStreamReader(proc.getErrorStream()));
System.out.println("OUTPUT:\n");
String s = null;
while ((s = Input.readLine()) != null) {
System.out.println(s);
}
System.out.println("ERROR OUTPUT:\n");
while ((s = Error.readLine()) != null) {
System.out.println(s);
}
}
错误日志
> Exception in thread "main" java.lang.NoClassDefFoundError: org/lwjgl/LWJGLException
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Unknown Source)
at java.lang.Class.privateGetMethodRecursive(Unknown Source)
at java.lang.Class.getMethod0(Unknown Source)
at java.lang.Class.getMethod(Unknown Source)
at sun.launcher.LauncherHelper.validateMainClass(Unknown Source)
at sun.launcher.LauncherHelper.checkAndLoadMain(Unknown Source)
Caused by: java.lang.ClassNotFoundException: org.lwjgl.LWJGLException
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)
... 7 more
我读到了一些关于在流程中添加libary路径的内容.. 知道如何修复它吗?
答案 0 :(得分:0)
您的源代码对我来说很好。此处PokeMMO.exe
缺少Java
库。
请使用您已安装PATH
的地方PokeMMO
,即(C:\\Program Files
或C:\\Program Files (x86)
或C:
等),而不是使用{{1} }:
“C:\ Users \ {MY USER NAME} \ AppData \ Roaming \ PokeMMO \ PokeMMO.exe”