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

  • Home
  • SEARCH
  • 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 8340643
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T05:14:12+00:00 2026-06-09T05:14:12+00:00

I’m trying to call a Javascript function from inside a Java Signed Applet that

  • 0

I’m trying to call a Javascript function from inside a Java Signed Applet that I developed. This goes pretty well when I use a browser with Sun Java plugin. I tested on Windows 7 and Ubuntu 10.04 with Firefox, Chrome and Internet Explorer (Windows) browsers.

When I try to run the same code on any browser with Iced Tea plugin the following error is informed:


net.sourceforge.jnlp.LaunchException: Fatal: Initialization Error: Could not initialize applet.
at net.sourceforge.jnlp.Launcher.createApplet(Launcher.java:735)
at net.sourceforge.jnlp.Launcher.getApplet(Launcher.java:676)
at net.sourceforge.jnlp.Launcher$TgThread.run(Launcher.java:886)Caused by: java.lang.NullPointerException
at net.sourceforge.jnlp.runtime.JNLPClassLoader.getPermissions(JNLPClassLoader.java:915)
at java.security.SecureClassLoader.getProtectionDomain(SecureClassLoader.java:206)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:447)
at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at net.sourceforge.jnlp.runtime.JNLPClassLoader.findClass(JNLPClassLoader.java:1499)
at net.sourceforge.jnlp.runtime.JNLPClassLoader.loadClassExt(JNLPClassLoader.java:1526)
at net.sourceforge.jnlp.runtime.JNLPClassLoader.loadClass(JNLPClassLoader.java:1341)
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2442)
at java.lang.Class.getDeclaredMethod(Class.java:1952)
at java.awt.Component.isCoalesceEventsOverriden(Component.java:6190)
at java.awt.Component.access$500(Component.java:188)
at java.awt.Component$3.run(Component.java:6144)
at java.awt.Component$3.run(Component.java:6142)
at java.security.AccessController.doPrivileged(Native Method)
at java.awt.Component.checkCoalescing(Component.java:6141)
at java.awt.Component.(Component.java:6110)
at java.awt.Container.(Container.java:276)
at java.awt.Panel.(Panel.java:64)
at java.awt.Panel.(Panel.java:56)
at java.applet.Applet.(Applet.java:65)
at javax.swing.JApplet.(JApplet.java:130)
at br.ufrj.land.tangram.measures.NetworkMeasurerApplet.(NetworkMeasurerApplet.java:11)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:525)
at java.lang.Class.newInstance0(Class.java:372)
at java.lang.Class.newInstance(Class.java:325)
at net.sourceforge.jnlp.Launcher.createApplet(Launcher.java:726)
… 2 more Caused by: java.lang.NullPointerException
at net.sourceforge.jnlp.runtime.JNLPClassLoader.getPermissions(JNLPClassLoader.java:915)
at java.security.SecureClassLoader.getProtectionDomain(SecureClassLoader.java:206)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:447)
at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at net.sourceforge.jnlp.runtime.JNLPClassLoader.findClass(JNLPClassLoader.java:1499)
at net.sourceforge.jnlp.runtime.JNLPClassLoader.loadClassExt(JNLPClassLoader.java:1526)
at net.sourceforge.jnlp.runtime.JNLPClassLoader.loadClass(JNLPClassLoader.java:1341)
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2442)
at java.lang.Class.getDeclaredMethod(Class.java:1952)
at java.awt.Component.isCoalesceEventsOverriden(Component.java:6190)
at java.awt.Component.access$500(Component.java:188)
at java.awt.Component$3.run(Component.java:6144)
at java.awt.Component$3.run(Component.java:6142)
at java.security.AccessController.doPrivileged(Native Method)
at java.awt.Component.checkCoalescing(Component.java:6141)
at java.awt.Component.(Component.java:6110)
at java.awt.Container.(Container.java:276)
at java.awt.Panel.(Panel.java:64)
at java.awt.Panel.(Panel.java:56)
at java.applet.Applet.(Applet.java:65)
at javax.swing.JApplet.(JApplet.java:130)
at br.ufrj.land.tangram.measures.NetworkMeasurerApplet.(NetworkMeasurerApplet.java:11)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:525)
at java.lang.Class.newInstance0(Class.java:372)
at java.lang.Class.newInstance(Class.java:325)
at net.sourceforge.jnlp.Launcher.createApplet(Launcher.java:726)
at net.sourceforge.jnlp.Launcher.getApplet(Launcher.java:676)
at net.sourceforge.jnlp.Launcher$TgThread.run(Launcher.java:886)java.lang.NullPointerException
at net.sourceforge.jnlp.NetxPanel.runLoader(NetxPanel.java:154)
at sun.applet.AppletPanel.run(AppletPanel.java:379)
at java.lang.Thread.run(Thread.java:722) java.lang.NullPointerException at sun.applet.AppletPanel.run(AppletPanel.java:429) at java.lang.Thread.run(Thread.java:722)


Configurations and Things that I tried:

  • The Linux flavor that I’m using with Iced Tea plugin is Ubuntu 12.04

  • I tried compiling my code with Sun JDK 6 and 7 and Open JDK 6 and 7 but both fail with Iced Tea plugin on browsers.

  • I tried my code with Iced Tea version 6 and version 7

  • I tried my code with Firefox and Chrome browsers on my Ubuntu

Code snippets:

HTML (inside body tag):

    <!-- JavaScript File That Contains My Javascript Function -->
    <script type="text/javascript" src="./my_javascript_file.js"></script>

    <!-- Applet That Will Call My Javascript Function -->
    <object height="1" width="1" id="MyApplet" name="MyApplet"
    java_version="1.5+" type="application/x-java-applet">
        <param name="code" value="foo.MyApplet" />
        <param name="archive" value="MyApplet.jar" />
        <param name="JVM_PARAM" value="-Djava.security.policy=applet.policy" />
        <param name="mayscript" value="true" />
        <param name="scriptable" value="true" />
        <param name="name" value="MyApplet" />
    </object>

Javascript method that i’m trying to call (inside my_javascript_file.js):

window.performAppletCode = function (parameter_1) {
    //Function code
}

Java applet code (relevant part) inside “MyApplet.jar”:

package foo;

import java.util.Arrays;
import javax.swing.JApplet;
import netscape.javascript.JSException;
import netscape.javascript.JSObject;

public class MyApplet extends JApplet {

    //Parameter that will be sent to Javascript function    
    public String parameter_1;    
    //JSObject that will be responsible for accessing javascript on my page 
    public JSObject window = null;
    private Thread myThread;
    private ImportantClass importantClassInstance;

    @Override
    public void init() {

    }

    @Override
    public void start() {
        if (this.window == null) {
            try {
                this.window = JSObject.getWindow(this);
                if (this.window == null){
                    System.out.println("Window is null");
                }
            }
            catch (JSException jse) {
                jse.printStackTrace();
            }
            fooStart();
        }
    }


    public void fooStart() {

            importantClassInstance = new ImportantClass();

            // MyThread Section
            myThread = new Thread(new Runnable() {
                @Override
                public void run() {

                    // Run latency test.
                    int[] fooArray = importantClassInstance.fooMethod();
                    parameter_1 = Arrays.toString(fooArray);
                    //Javascript function call
                    window.call("performAppletCode", new Object[] {parameter_1});
                }
            });
            myThread.start();
    }
}

My applet is signed using jarsigner and the certificate is included on my HTML directory.

If anyone knows a possible clue to solving this problem, please, let me know.

Thanks,
Guilherme.

  • 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-06-09T05:14:14+00:00Added an answer on June 9, 2026 at 5:14 am

    I think I found the solution, but I sill don’t know why this happens. Here’s the thing:

    When I start my web page (with the applet and everything else) from a directory that it’s located on my OS Ubuntu, that crazy error pops up on my Java console. BUT when I start my page from a directory that it’s located on a remote server (e.g. another computer in my home LAN) everything works perfect. So, for some reason, I need to request my own page from some remote server to everything work OK. This only happens with the above situation described on my question. I will search on the web trying to find why this happens.

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

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
That's pretty much it. I'm using Nokogiri to scrape a web page what has
For some reason, after submitting a string like this Jack’s Spindle from a text
I am trying to render a haml file in a javascript response like so:
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
Does anyone know how can I replace this 2 symbol below from the string
I need a function that will clean a strings' special characters. I do NOT
I'm trying to create an if statement in PHP that prevents a single post
I know there's a lot of other questions out there that deal with this

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.