I am trying to use gson library with my applet but JRE(8u25) does not see the library and gives me this error:
MyAppSigned.jar is my signed applet
gson-2.3.1.jar is the library i am trying to use
Test WebPage Content (Test.html):
<html>
<body>
<applet code='test.XApplet' width=400 height=400>
<param name='ARCHIVE' value='MyAppSigned.jar,gson-2.3.1.jar'>
<param name='codebase' value='http://example.com/Commons'>
</applet>
</body>
</html>
Here is the content of the manifest file inside MyAppSigned.jar:
Manifest-Version: 1.0
Trusted-Library: true
Class-Path: gson-2.3.1.jar
Permissions: all-permissions
Created-By: 1.6.0_26 (Sun Microsystems Inc.)
Codebase: *
Name: test/XApplet.class
SHA1-Digest: qLHEgL7Or0Ja7Jn7iRZt2lJ/928=
Here is the content of commons directory on iis:
I tried with/without codebase attribute in my test webpage. it does not changed the error.
But if i copy gson-2.3.1.jar into the directory C:\\Program Files\\Java\\jre1.8.0_25\\lib\\ext it Works without any error
what am i doing wrong?
First of all copy the jar in JRE_HOME/lib/ext
is not a good solution since then you've to copy this jar in all the client machines which will use your applet.
I think that the problem with your code is in your <applet>
definition, you're using <param>
to define archive
, however in documentation archive
and others are defined as attributes of <applet>
tag, take a look at documentation . So try defining the <applet>
as follows:
<html>
<body>
<applet code="test.XApplet" width="400" height="400"
archive="MyAppSigned.jar,gson-2.3.1.jar" codebase="http://example.com/Commons">
</applet>
</body>
</html>
Note that it's better to use <object>
since <applet>
tag will not be supported in HTML5
, also think about use deployJava.js
which can make more easy to deploy an applet in a different browsers.
Hope this helps,
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.