Note that there are some explanatory texts on larger screens.

plurals
  1. POA proper way to use native libraries in JNA with Applet deployed by JWS (java web start)
    primarykey
    data
    text
    <p>I am using an applet deployed through JWS (Java Web Start). This applet has some native functionality included: JNA. User32, Kernel32 and Gdi32. When I launch the applet through JWS, I get the following:</p> <pre><code>basic: LD - All JAR files signed: file:/C:/JavaApplication6/dist/launch.jnlp basic: passing security checks; secureArgs:false, allSigned:false basic: continuing launch in this VM network: LDUpdater: started background update check basic: JNLP2ClassLoader.findClass: winToJnaApi.NewApplet: try again .. basic: JNLP2ClassLoader.getPermissions() .. basic: Plugin2ClassLoader.getPermissions CeilingPolicy allPerms security: JAVAWS AppPolicy Permission requested for: file:/C:/JavaApplication6/dist/JavaApplication6.jar basic: JNLP2ClassLoader.getPermissions() X basic: Applet loaded. basic: Applet resized and added to parent container basic: PERF: AppletExecutionRunnable - applet.init() BEGIN ; jvmLaunch dt 194323 us, pluginInit dt 462062 us, TotalTime: 656385 us basic: JNLP2ClassLoader.findClass: winToJnaApi.APIManipulation: try again .. basic: JNLP2ClassLoader.findClass: winToJnaApi.User32Extended: try again .. basic: JNLP2ClassLoader.findClass: com.sun.jna.win32.StdCallLibrary$StdCallCallback: try again .. basic: JNLP2ClassLoader.getPermissions() .. basic: Plugin2ClassLoader.getPermissions CeilingPolicy allPerms security: JAVAWS AppPolicy Permission requested for: file:/C:/JavaApplication6/dist/lib/jna.jar basic: JNLP2ClassLoader.getPermissions() X basic: JNLP2ClassLoader.findClass: com.sun.jna.Callback: try again .. basic: JNLP2ClassLoader.findClass: com.sun.jna.win32.StdCall: try again .. basic: JNLP2ClassLoader.findClass: com.sun.jna.AltCallingConvention: try again .. basic: JNLP2ClassLoader.findClass: com.sun.jna.Library: try again .. basic: JNLP2ClassLoader.findClass: com.sun.jna.Native: try again .. basic: JNLP2ClassLoader.findClass: com.sun.jna.Callback$UncaughtExceptionHandler: try again .. basic: JNLP2ClassLoader.findClass: com.sun.jna.Native$3: try again .. </code></pre> <p>This is strange, correct? If I check my jars with jarsigner, they seem to be all signed (I use automatic signing by Netbeans but it doesn't work even if i sign them manually). As I am pretty new to applet and JWS technology, I wonder if the try again... means JNLP could not find the appropriate class. </p> <p>What is even stranger is that if I define a native method in the applet, for example a method that upon clicking a button on the applet is giving me a Windows message box, it works if i click the button on the applet, but if i try to invoke the same function through javascript it fails. So here is my .jnlp file:</p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8" standalone="no"?&gt; &lt;jnlp codebase="file:/C:/JavaApplication6/dist/" href="launch.jnlp" spec="1.0+"&gt; &lt;information&gt; &lt;title&gt;JavaApplication6&lt;/title&gt; &lt;description&gt;blalbla&lt;/description&gt; &lt;description kind="short"&gt;JavaApplication6&lt;/description&gt; &lt;/information&gt; &lt;update check="background"/&gt; &lt;security&gt; &lt;all-permissions/&gt; &lt;/security&gt; &lt;resources&gt; &lt;j2se java-vm-args="-Djava.security.policy=applet.policy" version="1.5+"/&gt; &lt;jar href="JavaApplication6.jar" main="true"/&gt; &lt;jar href="lib/jna.jar"/&gt; &lt;jar href="lib/platform.jar"/&gt; &lt;/resources&gt; &lt;applet-desc height="300" main-class="winToJnaApi.NewApplet" name="JavaApplication6" width="300"&gt; &lt;/applet-desc&gt; &lt;/jnlp&gt; </code></pre> <p>According to some info I found I should convert user32_x86 directory of the jna.jar into a jar on its own and include it as a nativelib href in my jnlp, but it doesn't work. Also, trying to wrap every call to the native functions in the applet with doPrivileged doesn't work either.</p> <p>Any help would be appreciated</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload