This week's book giveaway is in the OCPJP forum. We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line! See this thread for details.
I have a simple java program which needs VM arguments while execution. The name of the argument is -DJava.lib.path. Right now I am doing it in eclipse with Run Configuration option.
Now I need to convert the java program to servlet java program for web aplication. My question is how will i set VM arguments in servlet.
which server it is?
In server's admin console you will be able to configure VM properties. Which you can get anywhere in the code using System.getProperty("key");
If your server is WAS, I can given steps where to configure this.
Joined: Oct 01, 2008
ok, I think I did not clear the question well...
Let me explain a bit more detail
I have a simple java program, which I run through eclipse.Right click on the program Click on Run Configuration. Click on Arguments. Then in VM Arguments I specify
-DJava.lib.path=c:\\DLLfiles then It runs fine.
Now, I want to convert this program to the servlet, then How will I pass this BM argument to my program.
If I do not pass I get this exception java.lang.UnsatisfiedLinkError: no jacob-1.14-M1-x86 in java.library.path
ok Here I got the solution but confused on one thing
I kept dll file in System32 folder of windows.
and just put the one line in program as
System.loadLibrary("jacob-1.14-M1-x86"); and it worked well
Now I think there is another alternatives to this work as
If we do not want to put dll in the System32 folder just give absolute path for DLL and access the dll
System.load("C:\\DLLfiles\\jacob-1.14-M1-x86.dll"); This is not working ....why?Anybody know this?
I think even System.load should work...
My second question....Eventually, We want to move this program to run on linux machine. I think in linux, instead of .dll extension we have to specify the .so extension is that right?
So, if I just renamed the .dll file it should work isn,t it?