• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

download native code from server to the client

 
bharani rao
Ranch Hand
Posts: 164
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you said this is the best method

https://applet-launcher.dev.java.net/

you have given me three options, i donot know which one is best suited for me. all i know is that i need to download/copy files from server to client.


The best method by far is the one I mentioned in http://www.coderanch.com/t/456033/Applets/java/steps-run-applet, because that doesn't rely on the details of the client-side file system (no file copying and installation is required).

If the file is accessible through HTTP (which it would be if it's in webapps\Samples) then you can use an URLConnection from the applet to the server to read it, and then write it to whichever directory it should go.

If the file is accessible through SMB, then you can use the library I mentioned in my previous post. This is the method of last resort, though; I wouldn't recommend it.


you please choose the best method and tell me how to proceed on that.
i did not understand the tutorials ( i mean how to proceed with my code in their way)

thank you in advance
 
Ulf Dittmer
Rancher
Posts: 42969
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That web page is very detailed; what in particular did you have problems understanding? (Please don't say "all of it".)

Fundamentally, the steps are as follows:
  • alter your applet code to use the loadLibraryInternal method instead of System.loadLibrary; the web page explains how and why
  • Create an encryption key for signing the code; this will involve the "keytool" executable that comes with the JDK
  • grab the latest source code of the JNLPAppletLauncher applet from here
  • create a JNI wrapper for the native library; this involves the "javah" executable
  • create the native library if you don't have it yet; this involves a native compiler (like GCC)
  • compile the applet and the JNLPAppletLauncher
  • create 3 jar files: one for the applet, one for the JNLPAppletLauncher, and one containing the native library
  • sign all 3 jar file using the key you created earlier; this involves the "jarsigner" executable
  • create a JNLP file like this one; yours will be much simpler, though - it only points to the jar file containing the native library
  • deploy it using an applet tag like the web page describes

  •  
    bharani rao
    Ranch Hand
    Posts: 164
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    thank you ulf,

    i will try and follow the steps
     
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic