简体   繁体   中英

set class path in java from command line .dll file

I am using netbeans and by setting the VMoptions to:

-Djava.library.path=C:\Users\a\Desktop\temp\sqljdbc_4.0\enu\auth\x64 

my program works perfect. I am trying to run the program from command line. I have tried the following but non seems to be working:

- java -Djava.library.path=C:\Users\a\Desktop\temp\sqljdbc_4.0\enu\auth\x64\sqljdbc_auth.dll  
 // shows the java usage

- System.setProperty("java.library.path","C:\\Users\\a\\Desktop\\temp\\sqljdbc_4.0\\enu\\auth\\x64");
 // wrote it in the code but nothing is happening.

Please let me know if I am doing something wrong or there is an alternative way to do it.

Some suggestions:

Place the DLL in your Windows/<SYSTEM> folder. Make sure to place the right one (32-bit/64-bit). Then try to run it.

Make sure the DLL you are using is the right one. Your Java JRE and NetBeans JRE may be different, eg, 32-bit JVM vs 64-bit JVM.

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