Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 801743
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T23:29:23+00:00 2026-05-14T23:29:23+00:00

First of all this is the first time I am asking a java question

  • 0

First of all this is the first time I am asking a java question so I hope I make myself understandable 🙂 Thanks in advance for anyone looking into this.

I have an applet, where I need to load classes depending on the users interaction with the applet. I have signed the applet so security should not be an issue (if I understand this correctly). All my files are located in applet.jar, which contains a package called p6applet and inside the package all the .class files are located.
I use the following code to test the applet:

<APPLET 
     CODE="p6applet.Main.class" 
     ARCHIVE = applet.jar 
         WIDTH=0 
         HEIGHT=0>
</APPLET>

The class that needs to be loaded is located on the users hard drive. It needs to import an interface, that is located within the applet.jar file under the package p6applet. This interface is called AlgorithmExecutable.

When I run my application it executes the follow code, where after an error happens:
The error happens when the program executes the following lines of code:

    className = ...;
try {
    System.out.println("Test1");
    URL[] urlClass = {new URL("file:/C:/.../")};
    System.out.println("Test2");
    ClassLoader cl = new URLClassLoader(urlClass);
    System.out.println("Test3");
    algorithmClass = cl.loadClass(className); //This is where the error occurs
    System.out.println("Test4");
    algorithm = (AlgorithmExecutable) algorithmClass.newInstance();
    System.out.println("The " + className + " has been loaded.");
} catch (MalformedURLException ex) {
    System.out.println("MalformedURLException: " + ex);
} catch (ClassNotFoundException ex) {
    System.out.println("ClassNotFoundException: " + ex);
} catch (InstantiationException ex) {
    System.out.println("InstantiationException: " + ex);
} catch (IllegalAccessException ex) {
    System.out.println("IllegalAccessException: " + ex);
}

I get the following error:

Exception in thread "AWT-EventQueue-7" java.lang.NoClassDefFoundError: p6applet/AlgorithmExecutable
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClassCond(Unknown Source)
    at java.lang.ClassLoader.defineClass(Unknown Source)
    at java.security.SecureClassLoader.defineClass(Unknown Source)
    at java.net.URLClassLoader.defineClass(Unknown Source)
    at java.net.URLClassLoader.access$000(Unknown Source)
    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 java.lang.ClassLoader.loadClass(Unknown Source)
    at p6applet.AlgorithmHandler.getAlgorithm(AlgorithmHandler.java:52)
    at p6applet.AlgorithmInterface.actionPerformed(AlgorithmInterface.java:671)
    at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
    at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
    at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
    at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
    at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
    at java.awt.Component.processMouseEvent(Unknown Source)
    at javax.swing.JComponent.processMouseEvent(Unknown Source)
    at java.awt.Component.processEvent(Unknown Source)
    at java.awt.Container.processEvent(Unknown Source)
    at java.awt.Component.dispatchEventImpl(Unknown Source)
    at java.awt.Container.dispatchEventImpl(Unknown Source)
    at java.awt.Component.dispatchEvent(Unknown Source)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
    at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
    at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
    at java.awt.Container.dispatchEventImpl(Unknown Source)
    at java.awt.Window.dispatchEventImpl(Unknown Source)
    at java.awt.Component.dispatchEvent(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)
Caused by: java.lang.ClassNotFoundException: p6applet.AlgorithmExecutable
    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 java.lang.ClassLoader.loadClass(Unknown Source)
    ... 38 more

My applet runs fine in the netbeans applet viewer if that can help pinpoint the problem. I suspect the problem is that the file that needs to be loaded can’t succesfully import the interface AlgorithmExecutable. Any help would be appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T23:29:24+00:00Added an answer on May 14, 2026 at 11:29 pm

    I think the main problem is that you don’t have security permissions to use file://, possibly even if the applet is signed and security permissions are given. You need to access URLs on the local server, or within jars on the classpath, as far as I know. It’s a complex issue.

    http://www.securingjava.com/chapter-two/chapter-two-7.html

    http://forums.sun.com/thread.jspa?threadID=5427882&tstart=0

    http://mindprod.com/jgloss/applet.html

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

First of all thanks for taking the time to look into this. I store
This is my first time asking a question, please be gentle! I have a
Well this is not the first time im asking these question here but I
This is the first time i'm asking a question here at stack overflow so
This my first time asking a question so please go easy one me :-p
this is my first post on this website, but I'm all the time getting
first of all this is my third question about web services here and i
First of all: This question is not directly programming related. However, the problem only
Well, first of all sorry about this question it must be pretty straight forward
First of all there is probably a question like this already but i couldn't

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.