Search code examples
javajarjnlpexecutable-jarjava-web-start

can I launch one-jar using java web start


I am trying to lunch one-jar using web start and I am getting error -

Java.lang.reflect.InvocationTargetException
    at com.sun.deploy.util.DeployAWTUtil.invokeAndWait(Unknown Source)
    at sun.plugin2.applet.Plugin2Manager.runOnEDT(Unknown Source)
    at sun.plugin2.applet.Plugin2Manager.createApplet(Unknown Source)
    at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.ClassCastException: com.simontuffs.onejar.Boot cannot be cast to java.applet.Applet
    at sun.plugin2.applet.Plugin2Manager$12.run(Unknown Source)
    at java.awt.event.InvocationEvent.dispatch(Unknown Source)
    at java.awt.EventQueue.dispatchEvent(Unknown Source)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.run(Unknown Source)
Exception: java.lang.reflect.InvocationTargetException

JNLP contains --

<?xml version="1.0" encoding="UTF-8"?>
<jnlp spec="1.0+" codebase="" href="">
    <information>
        <title>Applet Takes Params</title>
        <vendor>Protype example</vendor>
    </information>
    <resources>
        <!-- Application Resources -->
        <j2se version="1.5+"
              href="http://java.sun.com/products/autodl/j2se"/>
        <jar href="Application.jar" main="true" />
    </resources>
    <applet-desc 
         name="Application"
         main-class="com.simontuffs.onejar.Boot"
         width="800"
         height="50">
             <param name="userName" value="Ashish"/>
     </applet-desc>
     <update check="background"/>
</jnlp>

I am trying to launch a Application.jar directly and com.simontuffs.onejar.Boot is the main class specify for JAR.


Solution

  • Since you're using the applet-desc tag, your Boot class must extend Applet (or JApplet). Based on the stack trace, it would appear that that class does not extend either of those.

    If it's not an applet, use application-desc instead of applet-desc