Via JNLP transfer an DLL
Hi Community!
First i磛e got a little question, if i understood it right:
If i write into an JNLP-File this
<resources os="Windows">
<nativelib href="lib/jtwain.dll.jar"/>
</resources>
Then Java should copy the DLL into the Windows System32 Directory! Or is this wrong?
My second Question is:
If i let me show the JNLP File in the Java WS Cache (via -- Start-->run-->javaws) the JNLP-File looks like this
<resources>
<jar href="http://localhost:8080/scan/lib/jtwain.dll.jar" download="eager" main="false"/>
<j2se version="1.4+"/>
the ressource os tag is away! I don磘 know why. I use Tomcat. Can Tomcat manipulate my JNLP File?
I have 2 Resources Blocks. One for the DLL and one for the other jars. Now it磗 only one left
Thx a lot
Flo
Message was edited by:
Deficiency1984
# 1
...
> Then Java should copy the DLL into the Windows
> System32 Directory! Or is this wrong?
No. Instead, it puts DLL's in 'some place' that is
on the application's classpath. A quick check of
my local web start cache shows JOGL .dll's
inside it.
In some ways, this is better than putting DLL's
into system32 - since it saves the danger of
overwriting DLL's of the same name.
> My second Question is:
> If i let me show the JNLP File in the Java WS Cache
> (via -- Start-->run-->javaws) the JNLP-File looks
> like this
(..different)
> I have 2 Resources Blocks. One for the DLL and one
> for the other jars. Now it磗 only one left
I noticed a similar thing happening to some
of my JNLP files - Java 6 specific elements
were being added to them - for caching control.
The elements 'agreed' with the default caching
behaviour (since I had not specified any), so that
was OK for my apps.
I think what is happening is that the local web
start client is only storing the parts of the JNLP
relevant to that Java version on that OS. It
makes sense that a web start client on
Windows would have no interest in the binaries
that are being provided to Linux or Mac - so it
is probably not storing that information.
# 2
thx for your quick reply!How can i find out, where it is saved to!
# 3
Or better Question! How can i bring it to, to save it into the System32 folder
# 4
1) How can i find out, where it is saved to!
On WinXP, using Java 6, you might look here..
Start | Settings | Control Panel | Java
General (tab) | Temporary Internet Files (bordered region)
Settings (button).. | Location (bordered region)
'Select the location where the temporary files are kept:'
2) How can i bring it to, to save it into the System32 folder
This is 'very not recommended' (by me, if nobody else).
What is the advantage to putting them into system32?
(And really, I am interested to hear your answer -
perhaps there is some reason I missed.)
In any case, the deployer might use an installer-desc
element to invoke any 'set-up' that is required for an
application. This set-up might include a little
utility (written by the deployer) that downloads the
DLL and puts it ..wherever it needs to be.
installer-desc code will be called once at application
installation, and once again at uninstallation (with
different args).
# 5
Okay, there is not realy an advantage by putting it into the system32 Folder except of calling System.loadLibrary, i think!
I can not leave it in the JavaWS Cache Folder, because the path is terrible, and i must copy it out. But how can i get the Folder in the Code? When the programm is on another PC there is another Path... I磎 sorry i磛e looked at the path variable but i don磘 see one that match to the cache path!
When i use the installer-desc i think i mustn磘 include the nativelib tag into the JNLP! Because, i was thinking by putting this nativelib Tag in the JNLP i must only move the dll
thx a lot
# 6
> Okay, there is not realy an advantage by putting it
> into the system32 Folder except of calling
> System.loadLibrary, i think!
That is where your understanding is wrong.
The JavaDcos are not entirely clear, but DLL's
only need to be on an application's classpath
in order to be loaded by their short names.
Here is a JWS implementation of the
Performance Pack (PP) of the JMF. The
PP uses natives to bring extra functionality
and formats to this media framework.
http://www.javasaver.com/testjs/jmf/jmstudio-pp.jnlp
The natives are simply put in the 'root' of an
archive and listed as nativelib in the launch
file. They work just fine, and I never need to
know, or worry about, where they are cached!
# 7
okay i think i understood it!
But i have still the problem!
1. The DLL is downloaded in the Java WS Cache!
but when i do System.loadLibrary("mydll.dll");
It comes java.lang.UnstatifiedLinkError!
I think, because it don磘 look into the WS-Cache! But how can i get this in the Programm! I know where my WS Cache is, but where is it on another PC? Is there a funktion or an Variabel like java..library.path?
thx
# 8
The only thing that jumps out at me is that this line..
> but when i do System.loadLibrary("mydll.dll");
..should probably be..System.loadLibrary("mydll");
Note that I specify no '.dll' extension.
If that does not get it working, perhaps you could
post the entire original JNLP file, as well as a dump
of the content listing of the natives jar.. E.G.jar -tf jtwain.dll.jar
# 9
JNLP File
<?xml version="1.0" encoding="ISO-8859-1"?>
<!-- filters: application.name, (ev. client-extensions) -->
<jnlp spec="1.0+" codebase="$$context" href="ScanModul.jnlp">
<information>
<title>ScanModul</title>
<vendor></vendor>
<description></description>
<icon href="AirSea.jpg" width="48" height="48"/>
</information>
<security>
<all-permissions/>
<!-- j2ee-application-client-permissions/ -->
</security>
<resources os="Windows" >
<nativelib href="jtwaindll.jar"/>
</resources>
<resources>
<j2se version="1.4+"/>
<j2se version="1.3+" href="http://java.sun.com/products/autodl/j2se"/>
<jar href="lib/launcher.jar"/>
<jar href="lib/ulc-jnlp-client.jar"/>
<jar href="lib/ulc-base-client.jar"/>
<jar href="lib/ulc-base-trusted.jar"/>
<jar href="lib/ulc-servlet-client.jar"/>
<jar href="lib/datechooser-client.jar"/>
<jar href="lib/JFrwDachUi-client.jar"/>
<jar href="lib/JFrwDachTech-client.jar"/>
<jar href="lib/looks-1.3.2.jar"/>
<jar href="lib/JimiProClasses.jar"/>
<jar href="lib/jai_codec.jar"/>
<jar href="lib/jai_core.jar"/>
<jar href="lib/jai_imageio.jar"/>
</resources>
<application-desc main-class="com.dach.appliweb.CustomJnlpLauncher">
<argument>$$context/application</argument>
<argument>60</argument>
</application-desc>
</jnlp>
D:\dev\Java\projects\OthelloScanModul\defaultroot\lib>jar -tf jtwaindll.jar
META-INF/MANIFEST.MF
META-INF/DACH_.SF
META-INF/DACH_.DSA
META-INF/
jtwain.dll
I have try it without qualify the dll and the same problem
Java says he can not find it in java.library.path
# 10
That JNLP shows that jtwaindll.jar is expected to
be found in the same directory as the JNLP file
itself, whereas the listing further down implies it
might be located in the 'lib' directory with the
rest of the jar's.
Which is it?
(Everything else looks OK, except those two
j2se elements - I think there should only be
one..)
# 11
Yeah that was my fault!
I have think, that it makes problems if it is in the lib directory, so i copy it in the directory, where the JNLP file is.
Exception Message:
detailMessage"no jtwain in java.library.path"
i have looked at this path and sure the Cache of Java WS is not inside!
But i can磘 update this path, if i have no idea what the path is!!!
I haven磘 think that this is such a problem..... :-)
Thx
Message was edited by:
Deficiency1984
# 12
HI!Could the reason for this problem is, that i launch the application from Eclipse?I don磘 know. i realy have no idea left
# 13
No it don磘! I have build a war file and start Tomcat and nothing happens! The same error came up....
# 14
First Andrew i want to thank you again!
I doesn磘 work! And i don磘 know why!
I make now another Solution!
I get the Driver with JTwain.class.getResource("jtwain.dll");
And then copy it into the java_Home directory (in lib/ext)
thx again! But if you have another idea, i磎 open for nearly anything