1 message in net.java.dev.jna.users[jna-users] Re: Question of JNA to de...
FromSent OnAttachments
Timothy WallNov 14, 2008 8:09 am 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:[jna-users] Re: Question of JNA to delete temp fileActions...
From:Timothy Wall (twal@dev.java.net)
Date:Nov 14, 2008 8:09:04 am
List:net.java.dev.jna.users

If the JNA shared library is not found on the system, it is extracted from jna.jar. On JVM exit, JNA attempts to delete the temporary file it created. On windows, if you're using a custom class loader (JET?), JNA won't be able to unload the native library and delete it, so it tries to spawn a new VM to delete the file after the current instance exits.

To avoid this error, try putting the JNA shared library (jnidispatch.dll) in the same directory as your EXE. That way it should be found by the system and JNA won't have to extract it.

On Nov 14, 2008, at 10:57 AM, Hongyi Jiang wrote:

Hello JNA fans,

I used JNA in my java application to call DLL file. It works very well. After testing my Java application, I have transformed the Java application to an native EXE file with JET software, so that the customers don't need to install JRE on their computers. If I close my application (MachineConfigurator.exe), I got some exceptions. After my analysing the exeception, I noticed, JNA tried to delete some temp files from some directory using some java command. Could you please tell me how to avoid these exceptions? or it is a bug?

Machine Configurator is finished at 2008-11-14 16:28:13 java.io.IOException: Cannot run program "C:\Program Files\Tecnomatix \MachineConfigurator\rt/bin/java": CreateProcess failed: "C:\Program Files\Tecnomatix\MachineConfigurator\rt\bin\java" -cp mc.jar;lib/ commons-jxpath-1.2.jar;lib/forms-1.2.0.jar;lib/mydoggy- api-1.5.0.jar;lib/mydoggy-plaf-1.5.0.jar;lib/mydoggy- res-1.5.0.jar;lib/swingx.jar;lib/TableLayout.jar;lib/ xpp3_min-1.1.4c.jar;lib/xstream-1.3.jar;lib/mcui.jar;lib/ resource.jar;lib/jide-oss-2.2.9.01.jar;lib/jna.jar;lib/ balloontip.jar com.sun.jna.Native$DeleteNativeLibrary C: \DOCUME~1\x_jiang\LOCALS~1\Temp\jna5671.tmp (error 2) at java.lang.ProcessBuilder.start(ProcessBuilder.class:0) at java.lang.Runtime.exec(Runtime.class:0) at java.lang.Runtime.exec(Runtime.class:0) at com.sun.jna.Native$DeleteNativeLibrary.run(Native$.java:667) Caused by: java.io.IOException: CreateProcess failed: "C:\Program Files\Tecnomatix\MachineConfigurator\rt\bin\java" -cp mc.jar;lib/ commons-jxpath-1.2.jar;lib/forms-1.2.0.jar;lib/mydoggy- api-1.5.0.jar;lib/mydoggy-plaf-1.5.0.jar;lib/mydoggy- res-1.5.0.jar;lib/swingx.jar;lib/TableLayout.jar;lib/ xpp3_min-1.1.4c.jar;lib/xstream-1.3.jar;lib/mcui.jar;lib/ resource.jar;lib/jide-oss-2.2.9.01.jar;lib/jna.jar;lib/ balloontip.jar com.sun.jna.Native$DeleteNativeLibrary C: \DOCUME~1\x_jiang\LOCALS~1\Temp\jna5671.tmp (error 2) at java.lang.ProcessImpl.create(Native Method) at java.lang.ProcessImpl.<init>(ProcessImpl.class:0) at java.lang.ProcessImpl.start(ProcessImpl.class:0) ... 4 more