Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 463
  • Last Modified:

applet - NoClassDef error

hi !! my applet class is A.class. It uses a class from a library (B.jar). I used the jar command to add both A.class and B.jar in a jar file A.jar. But, when i view it from the browser, i get the error that a class C (which was in B.jar) could not be found.
I'm guessing that the classpath won't help here .. coz the html and the jar files are going to be placed on a webserver (remote machine), while the client is going to view the html page + applet from his machine
how do i solve this problem ?
thanks :)
muskad202
0
muskad202
Asked:
muskad202
  • 5
  • 5
1 Solution
 
girionisCommented:
You need to define the archive in the "archive" attribute of the applet tag. Your applet class should also be *outside* of the jar file. Have a look here for mroe info: http://mindprod.com/jgloss/applet.html
0
 
muskad202Author Commented:
the reason i'm adding the applet.class file to a jar file, is coz i need to sign it, because the applet needs to read files from the user's harddisk ...
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
girionisCommented:
:)
0
 
muskad202Author Commented:
hi !!
i am yet having a problem, and was wondering if u could help me .. it is now able to find the class, and the applet loads fine, it is a signed applet .. but , i am trying to read a file from the harddisk, and i get an access denied error .. i already chose "Accept" when the security dialog came up asking if i wanted to allow the applet to run ..
there is a jfilechooser in the applet, that loads correctly, i am able to navigate thru the folders on the disk, only when i start reading, i get a read error .. any suggestions ??
0
 
girionisCommented:
Can you post the exact error? It might not have to do with permissions.
0
 
muskad202Author Commented:
java.security.AccessControlException: access denied (java.io.FilePermission c:\ 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.checkRead(Unknown Source)
      at java.io.File.exists(Unknown Source)
etc etc
---------------------------------------------
this is the error in the jave console window from IE. i was trying to open the file c:\a.txt

muskad202
0
 
girionisCommented:
I think there is something wrong with signing the applet. Are you sure the signing went on ok? I suggest you sign it again and then try again.
0
 
muskad202Author Commented:
hi !!
i redid the whole process .. same error :(
would it be possible for you to have a look at the code ?? the java file is quite small, just 2.77 kb .. i could send u the java file along with the library via email :/
if not, then no problem ... thanks for your help :)
muskad202
0
 
muskad202Author Commented:
note - there doesn't seem to be anything wrong with the code, coz, if i start the application using a main() function, and create a JPanel and add the applet to it, the thing works fine ..
0

Featured Post

Industry Leaders: 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!

  • 5
  • 5
Tackle projects and never again get stuck behind a technical roadblock.
Join Now