Applet class loader cannot find a class in the applet's jar

后端 未结 1 1826
长情又很酷
长情又很酷 2021-01-14 01:12

I started to ask this question and then figured out the answer before submitting it. I\'ve decided to post the question anyway so that other people who run into the same

相关标签:
1条回答
  • 2021-01-14 01:27

    Found the answer from looking at a suggestion posted for a related question. Eddie's answer didn't solve that particular problem, but it did give me the solution for mine.

    What isn't particularly obvious from my question is that the JDataStore class inherits from another class which is contained in a different jar. I hadn't had to deal with the implementation details of JDataStore in a couple of months, so I completely forgot that its parent class, org.json.simple.JSONObject, wasn't in CM_Library.jar, but was in json_simple-1.0.2.jar. The fix is fairly simple, just copy the missing jar to the codebase directory and add the missing jar to the comma-separated list of archives in the applet tag's archive attribute:

    <applet id="mediator-applet"
            width="0"
            height="0"
            codebase="./"
            archive="CM_Library.jar, json_simple-1.0.2.jar"
            code="com.company.program.cm.hmi.MediatorApplet">
    </applet>
    

    That fixes the error. The exception message is not particularly helpful. It would lead you to believe that it can't find the class at all, when the actual problem is that it cannot load the super class for the requested class.

    0 讨论(0)
提交回复
热议问题