简体   繁体   中英

How to setup NetBeans to run java application with specific command (or use other JRE)?

The problem occurs when launching an application which loads a DLL. I'm doing it with System.load("C:\\fullpath\\test.dll") . The project compiles with no errors, creates a jarfile Test.jar but when I run it with NetBeans it throws an exception

Exception in thread "main"

java.lang.UnsatisfiedLinkError: C:\\fullpath\\test.dll: Can't find dependent libraries

However if I run exactly the same code on Eclipse it runs fine. What I've found out that it's most probably a java bug because when running from command line gives such results:

"C:\\Program Files (x86)\\Java\\jre7\\bin\\java.exe" -jar test.jar | Runs fine

"C:\\Program Files (x86)\\Java\\jdk1.7.0_01\\jre\\bin\\java.exe" -jar test.jar | Runs fine

"C:\\Program Files (x86)\\Java\\jdk1.7.0_01\\bin\\java.exe" -jar test.jar | Throws an exception

And as I understand NetBeans runs the last command and therefore throws an exception. I tried searching on how to add a custom command or how to bind jre instead of jdk but with no success.

I don't know if it helps but... in menu Tools -> Java Platforms You can manage Java Platforms. Here You can specify other JDKs that You might use in future.

Then, in project's Properties window, You choose Libraries section and there You can choose Java Platform to use in project. I think it's the thing You are looking for, but if not - sorry for misunderstanding.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM