aspose file tools*
The moose likes Applets and the fly likes Copy dlls and lic files from server path to local system 32 dir in Applet init() Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Applets
Bookmark "Copy dlls and lic files from server path to local system 32 dir in Applet init()" Watch "Copy dlls and lic files from server path to local system 32 dir in Applet init()" New topic
Author

Copy dlls and lic files from server path to local system 32 dir in Applet init()

Ramakrishna Gangadas
Greenhorn

Joined: Feb 15, 2011
Posts: 8
I have a signed applet loads when user logged in application.

The init() method copy the dll and lic files from server path to the local system 32 dir .This is working file as of now with Windows XP.But with windows 7 ,got error 'Access Denied' while try to copy file to system 32. Please advise.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42935
    
  68
You probably need admin-level access for that, whereas most users only have get user-level access (in both Vista and Windows 7).

Why do you want to copy DLLs to the client machine? Isn't DLL hell bad enough as it is? You can distribute DLLs in signed jar files along with the applet without having to copy/install anything.
Ramakrishna Gangadas
Greenhorn

Joined: Feb 15, 2011
Posts: 8
accessing windows registry and for that using jniwrap.dll and jniwrap.lic.
I have the admin rights in windows 7 machine. If i do manually it asks me whether to continue as Administrator , if i say continue then files copying without issues to System 32 folder.

I embedded the dlls and lic file in the signed applet jar. But the applet is not recognizing the dll while use jniwrap
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42935
    
  68
That doesn't address why the DLLs need to be installed locally. Is the applet some kind of installer that doesn't do any work by itself, and whose whole purpose is to install those DLLs locally?
Ramakrishna Gangadas
Greenhorn

Joined: Feb 15, 2011
Posts: 8
For applet purpose as the applet uses the jniwrap classes to access the registry. The applet using to add or copy or check in or chek out files.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42935
    
  68
OK, that means there is no need to copy any DLL files anywhere. Just distribute them in signed jar files along with the applet, and the JVM will find them just fine.
Ramakrishna Gangadas
Greenhorn

Joined: Feb 15, 2011
Posts: 8
If i copied the dll to the signed jar, still got the exceptions while applet loading.
I copied the dlls first to jar then signed and also signed first and then copied dlls. Both ways same exception

Exception in thread "thread applet-com.applet.MyApplet-1" java.lang.UnsatisfiedLinkError: no jniwrap in java.library.path
at java.lang.ClassLoader.loadLibrary(Unknown Source)
at java.lang.Runtime.loadLibrary0(Unknown Source)
at java.lang.System.loadLibrary(Unknown Source)
at com.jniwrapper.r.run(SourceFile:127)
at java.security.AccessController.doPrivileged(Native Method)
at com.jniwrapper.DefaultLibraryLoader.loadLibrary(SourceFile:131)
at com.jniwrapper.Library.loadNativeCode(SourceFile:41)
at com.jniwrapper.Library.loadNativeCode(SourceFile:66)
at com.jniwrapper.Library.ensureNativeCode(SourceFile:76)
at com.jniwrapper.PlatformContext.a(SourceFile:241)
at com.jniwrapper.PlatformContext.getDefaultStructureAlignment(SourceFile:182)
at com.jniwrapper.Structure.init(SourceFile:101)
at com.jniwrapper.win32.system.VersionInfo.<init>(SourceFile:43)
at com.jniwrapper.win32.system.Kernel32.isUnicode(SourceFile:44)
at com.jniwrapper.win32.FunctionName.<clinit>(SourceFile:18)
at com.jniwrapper.win32.registry.WinRegistry.<clinit>(SourceFile:17)
at com.jniwrapper.win32.registry.RegistryKey.getHandle(SourceFile:374)
at com.jniwrapper.win32.registry.RegistryKey.openSubKey(SourceFile:308)
at com.jniwrapper.win32.registry.RegistryKey.openSubKey(SourceFile:295)
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42935
    
  68
Post the APPLET tag and the location (and included files) of all jar files.
Ramakrishna Gangadas
Greenhorn

Joined: Feb 15, 2011
Posts: 8
i have jar files specific to my application to use for check in or copy files.

Do you think those jars will be matter here? The problem is dlls getting copied to System 32 in XP but not in windows 7 though having the administrator rights. I was able to copy these to Desktop and applet loading properly.
Ramakrishna Gangadas
Greenhorn

Joined: Feb 15, 2011
Posts: 8
the code base is
<object NAME='FileViewer' " +
"classid='clsid:8AD9C840-044E-11D1-B3E9-00805F499D93' " +
"codebase='http://java.sun.com/update/1.5.0/jinstall-1_5_0_18-windows-i586.cab#Version=1,5,0,18' " +
"height='5' width='5' > <param name="java_code" value="mypackage.MyApplet"><param name"java_codebase" value="/APPCONTESTNAME/MyAPPletFolder">
<param name"java_archive" value"myapplet.jar"></object>;

This is in jsp. The MyAPPletFolder folder contains myapplet.jar. The jar contains signed applet class,JNIWrapper classes and other class files required by my file operations.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42935
    
  68
Which signed jar file contains the native library?
Ramakrishna Gangadas
Greenhorn

Joined: Feb 15, 2011
Posts: 8
myapplet.jar contains JNIWrapper classes which has signed applet.

jniwrp.dll will be downloaded to loacal system32 folder while applet loading.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42935
    
  68
OK, my previous posts were based on the assumption that you would be using the approach I mentioned - shipping native libraries in signed jar files, and thus neatly avoiding the need to copy/install files locally. But if you insist on doing it that way, then I can't help any further.
Ramakrishna Gangadas
Greenhorn

Joined: Feb 15, 2011
Posts: 8
Its ok..Thanks for the help so far. Will poast if i find an approach or solution for my problem.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42935
    
  68
I'm curious why you choose to ignore the solution I provided, and instead insist to look for something else that is both more complicated and less likely to work.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Copy dlls and lic files from server path to local system 32 dir in Applet init()