0

我在 Eclipse 中设置“运行配置”时遇到问题。当我使用 Windows cmd 编译和运行 java.class 时,我使用如下所示的 .bat 文件:

rem Wipe standard Windows Path variable and use this:
set PATH = C: \ Program Files \ .this path.;..and this one..;…;…

rem needed CLASSPATH's
set CLASSPATH = "... some \ path / *; ...

rem Path to native .dll libs
set LIB_PATH = "C: \ ... \ bin"

javac-cp% CLASSPATH% "... \ SomeExample.java"
java-cp% CLASSPATH%-Djava.library.path =% LIB_PATH% SomeExample

一切正常,编译和运行都可以。当我尝试通过 Eclipse 执行相同操作时,通过在运行配置 GUI 中调整类路径,编译是可以的(我在 CMD 中手动测试它),但在执行编译类期间,我得到 java.lang。“UnsatisfiedLinkError ... someImportantDLL.dll:找不到指定的过程,”如果我没有在 .bat 文件中手动设置 PATH 环境变量,这与我在 cmd 中运行时遇到的错误相同!我应该在 Eclipse 中做什么来运行正确编译的类?

4

1 回答 1

0

Add the correct -Djava.library.path to the VM Arguments field. Don't rely on the external environment--you should control everything about your application's environment so you won't have any "gotchas" when you roll it out.

于 2013-05-21T15:06:25.107 回答