This discussion is archived
4 Replies Latest reply: Apr 1, 2010 12:25 PM by 843798 RSS

Refelction with JNLP launched app

843798 Newbie
Currently Being Moderated
This code runs fine when running in Eclipse, or double clicking the jar file. However when I launch using jnlp, I get an error.
code:
          String cname = "dbObjects.DBO_"+sel;
          ClassLoader cl = ClassLoader.getSystemClassLoader(); 
          try {
               Class myClass = Class.forName( cname, false, cl ); //cl.loadClass(cname);
               Object obj = myClass.newInstance(); 
error:
java.lang.ClassNotFoundException: dbObjects.DBO_ZipCodes
     at java.net.URLClassLoader$1.run(Unknown Source)
     at java.security.AccessController.doPrivileged(Native Method)
     at java.net.URLClassLoader.findClass(Unknown Source)
     at java.lang.ClassLoader.loadClass(Unknown Source)
     at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
     at java.lang.ClassLoader.loadClass(Unknown Source)
     at java.lang.Class.forName0(Native Method)
     at java.lang.Class.forName(Unknown Source)
     at GUI.PnlAdmin.onSelChange(PnlAdmin.java:114)
jnlp:
<?xml version="1.0" encoding="utf-8"?>
<!-- JNLP File for Tmgr Download -->
<jnlp spec="1.0+" codebase="http://www.earthbest.com" href="tmgr.jnlp">
    <information>
       <title>TMgr</title>
       <vendor>Simple Software</vendor>
       <description>tmgr</description>
       <description kind="short">tmgr Download</description>
       <offline-allowed/>
       <icon href="TMgr.png" />
       <icon kind="splash" href="TMgr.png" />
       <shortcut online="false">
            <desktop />
       </shortcut>
     </information>
        <security>
                <all-permissions/>
        </security>

     <resources>
       <j2se version="1.6.0_10+" href="http://java.sun.com/products/autodl/j2se" />
       <jar href="tmgr.jar"/>
     </resources>
     <application-desc main-class="TMgr">
        <!-- <argument>...</argument> -->
     </application-desc>
</jnlp>
I checked the jar file and the class files are there.
Peter