Solved

Java Applet jar file including external libraries in the jar file

Posted on 2010-11-18
18
2,350 Views
Last Modified: 2012-05-10
Hello,

I built a applet. I want to include the external jar files in to the applet jar file. How can I do that. I'm getting a black screen when I run the applet. How do I debug it and I'm guess I'm not including the external libraries in the jar
0
Comment
Question by:abhi376
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 9
  • 7
  • 2
18 Comments
 
LVL 86

Expert Comment

by:CEHJ
ID: 34169092
You need to include the jars in the applet's archive tag
0
 
LVL 6

Author Comment

by:abhi376
ID: 34169204
how to do that in netbeans ???
0
 
LVL 92

Expert Comment

by:objects
ID: 34169336
see the following

http://netbeans.org/kb/docs/web/applets.html

If you have an extra jar, say a.jar that it needs then the html becomes

<applet code="org.me.hello.MyApplet" archive="HelloApplet.jar, a.jar"/>

and put a.jar in the same location as the applet jar

Let me know if you have any questions
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 6

Author Comment

by:abhi376
ID: 34169374
I need to uplaod a jar file in to a system which allows me to upload only single file for the applet
0
 
LVL 92

Expert Comment

by:objects
ID: 34169416
well an applet requires at least two files, the html file, and a jar (or class file).
if you want to include all the classes in a single jar then have a look here
http://joshuaborn.info/blog/cb49
0
 
LVL 6

Author Comment

by:abhi376
ID: 34170579
Hi,

I got the Fat Jar plugin for the eclipse and made the jar with all the dependencies but I'm not able to make the html page out of the applet. I can run the applet from class right click run. The applet starts up and java animation run and applet never show up how can I debug this ??
0
 
LVL 6

Author Comment

by:abhi376
ID: 34170588
When I make html page out of the applet. The html page runs and shows up the java animation. Is this due to any controls inside the applet ? I
0
 
LVL 92

Accepted Solution

by:
objects earned 500 total points
ID: 34170638
> When I make html page out of the applet. The html page runs and shows up the java animation. Is this due to any controls inside the applet ?

the <applet> tag will include and run the applet
see the 1st link I posted for an example
0
 
LVL 6

Author Comment

by:abhi376
ID: 34170659
yea. I followed the same. I open the html file. I get java logo animation on the applet.nothing else after sometime a black screen
0
 
LVL 92

Expert Comment

by:objects
ID: 34170748
check your java console for any errors
0
 
LVL 6

Author Comment

by:abhi376
ID: 34173539
I don't see any errors in the console. If I run the app it just runs fine
0
 
LVL 6

Author Comment

by:abhi376
ID: 34175597
Exception in thread "thread applet-splaytree.Control-1" java.lang.ExceptionInInitializerError
      at org.objenesis.ObjenesisStd.<init>(ObjenesisStd.java:31)
      at com.rits.cloning.Cloner.<init>(Unknown Source)
      at splaytree.Splay.<init>(Splay.java:11)
      at splaytree.MyCanvas.<init>(MyCanvas.java:16)
      at splaytree.Control.init(Control.java:41)
      at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
      at java.lang.Thread.run(Unknown Source)
Caused by: java.security.AccessControlException: access denied (java.util.PropertyPermission java.runtime.version read)
      at java.security.AccessControlContext.checkPermission(Unknown Source)
      at java.security.AccessController.checkPermission(Unknown Source)
      at java.lang.SecurityManager.checkPermission(Unknown Source)
      at java.lang.SecurityManager.checkPropertyAccess(Unknown Source)
      at java.lang.System.getProperty(Unknown Source)
      at org.objenesis.strategy.BaseInstantiatorStrategy.<clinit>(BaseInstantiatorStrategy.java:38)
      ... 7 more

This is the error I see in the java console
0
 
LVL 92

Expert Comment

by:objects
ID: 34177186
0
 
LVL 6

Author Comment

by:abhi376
ID: 34177422
yea. I self signed my jar but it gives the error message saying its not verified. Can I avoid that ??
0
 
LVL 92

Expert Comment

by:objects
ID: 34177484
you need to purchase a certificate to fix that
0
 
LVL 6

Author Comment

by:abhi376
ID: 34177534
Will applet.policy work ? I know applet.policy is local for the user I was just wondering
0
 
LVL 92

Expert Comment

by:objects
ID: 34177588
yes it would work
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 34177615
Altering the policy file is only a viable option if the applet has only limited distribution - it has to be altered for any and every box it's run on
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
How to get all the API from website? 11 129
fibonacci ten numbers 4 54
configure dependency in POM for new database 3 46
Glassfish admin console not working 1 59
Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question