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 8792973
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T23:03:39+00:00 2026-06-13T23:03:39+00:00

I’m writing a status checker, it is a java web-start applet. I can run

  • 0

I’m writing a status checker, it is a java web-start applet. I can run it on my computer and it will run just fine, however; when I run it on a web page I get the runtime error java.lang.reflect.InvocationTargetException. This is the html file I’m using to run the jar file

<html>
    <head>
        <applet code="StatusCheckerMain" width=380 height=172 archive="Launch.jar">
            <param name="servername"
                    value="Evolution-X"/>
            <param name="ip"
                    value="127.0.0.1"/>
            <param name="port"
                    value="43594"/>
            Java is not installed on your machine or your browser does not allow Java Web-Start Applets to run.<br /><br />Get the latest Java technology at <a href="http://www.java.com/">http://www.Java.com/</a>
        </applet>
    </head>
</html>

And this is my source file

import java.awt.*;
import java.io.*;
import java.net.*;
import javax.swing.*;
/**
 *
 * @author Dan
 */
public class GUIChecker extends JApplet {

    public GUIChecker() { }

    public void init() {
        try {
            java.awt.EventQueue.invokeAndWait(new Runnable() {
                public void run() {
                    initComponents();
                }
            });
        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }
    private String getServerName() {
        if (isActive()) {
            return (getParameter("servername"));
        } else {
            return "Default";
        }
    }
    private String getIP() {
        if (isActive()) {
            return (getParameter("ip"));
        } else {
            return "localhost";
        }
    }
    private int getPort() {
        if (isActive()) {
            return (Integer.parseInt(getParameter("port")));
        } else {
            return 43594;
        }
    }   
    private boolean checkOnline(String ip, int port) throws UnknownHostException, IOException {
        try {
            Socket sock = new Socket(ip, port);
            return sock.isConnected();
        } catch (ConnectException e) {
            return false;
        }
    }
    private String getConnection(String ip, int port) throws UnknownHostException, IOException {
        try {
            Socket sock = new Socket(ip, port);
            return (sock.isConnected() ? "ONLINE" : "OFFLINE");
        } catch (ConnectException e) {
            return ("OFFLINE");
        }
   }
    @SuppressWarnings("unchecked")
    private void initComponents() {

        jScrollPane1 = new JScrollPane();
        jTextArea1 = new JTextArea();
        setVisible(true);
        jTextArea1.setEditable(false);
        jTextArea1.setColumns(20);
        jTextArea1.setRows(5);
        try {
            Font font = new Font("Verdana", Font.BOLD, 12);
            if (checkOnline(getIP(), getPort())) {
                jTextArea1.setForeground(Color.GREEN);
            } else {
                jTextArea1.setForeground(Color.RED);
            }
            jTextArea1.setFont(font);
            jTextArea1.setText(getServerName()+" IP: "+getIP()+" on port: "+getPort()+" is currently: "+getConnection(getIP(), getPort()));
        } catch (IOException e) {
            e.printStackTrace();
        }

        GroupLayout layout = new GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jScrollPane1, GroupLayout.DEFAULT_SIZE, 385, Short.MAX_VALUE)
                .addContainerGap())
            .addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING)
                .addGroup(layout.createSequentialGroup()
                    .addGap(0, 11, Short.MAX_VALUE)
                    .addComponent(jTextArea1, GroupLayout.PREFERRED_SIZE, 383, GroupLayout.PREFERRED_SIZE)
                    .addGap(0, 11, Short.MAX_VALUE)))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jScrollPane1, GroupLayout.DEFAULT_SIZE, 121, Short.MAX_VALUE)
                .addContainerGap())
            .addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING)
                .addGroup(layout.createSequentialGroup()
                    .addGap(0, 12, Short.MAX_VALUE)
                    .addComponent(jTextArea1, GroupLayout.PREFERRED_SIZE, 119, GroupLayout.PREFERRED_SIZE)
                    .addGap(0, 12, Short.MAX_VALUE)))
        );
        validate();
    }
    private JScrollPane jScrollPane1;
    private JTextArea jTextArea1;
}

enter image description here
There is no error when running it on my desktop, but when I run it on my webpage this is all I get.

Clear classloader cache ... completed.
Trace level set to 5: all ... completed.basic: Added progress listener: sun.plugin.util.ProgressMonitorAdapter@844c3d
basic: Plugin2ClassLoader.addURL parent called for file:/C:/Users/Dan/Desktop/Evolution-X/Evolution-X%20639/Evolution-X%20%20639%20Server/Evolution-X%20639%20Server/Evolution-X%20639%20Server/SocketsTest/TestConnection/bin/
network: Cache entry not found [url: file:/C:/Users/Dan/Desktop/Evolution-X/Evolution-X%20639/Evolution-X%20%20639%20Server/Evolution-X%20639%20Server/Evolution-X%20639%20Server/SocketsTest/TestConnection/bin/, version: null]
network: Cache entry not found [url: file:/C:/Users/Dan/Desktop/Evolution-X/Evolution-X%20639/Evolution-X%20%20639%20Server/Evolution-X%20639%20Server/Evolution-X%20639%20Server/SocketsTest/TestConnection/bin/, version: null]
basic: exception: java.lang.reflect.InvocationTargetException.
java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
    at com.sun.deploy.uitoolkit.impl.awt.AWTAppletAdapter.runOnEDTAndWait(Unknown Source)
    at com.sun.deploy.uitoolkit.impl.awt.AWTAppletAdapter.instantiateApplet(Unknown Source)
    at sun.plugin2.applet.Plugin2Manager.initAppletAdapter(Unknown Source)
    at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.reflect.InvocationTargetException
    at com.sun.deploy.uitoolkit.impl.awt.OldPluginAWTUtil.invokeAndWait(Unknown Source)
    ... 5 more
Caused by: java.lang.ClassCastException: StatusCheckerMain cannot be cast to java.applet.Applet
    at com.sun.deploy.uitoolkit.impl.awt.AWTAppletAdapter$1.run(Unknown Source)
    at java.awt.event.InvocationEvent.dispatch(Unknown Source)
    at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
    at java.awt.EventQueue.access$200(Unknown Source)
    at java.awt.EventQueue$3.run(Unknown Source)
    at java.awt.EventQueue$3.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(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)
basic: Removed progress listener: sun.plugin.util.ProgressMonitorAdapter@844c3d
security: Reset deny session certificate store
basic: Dialog type is not candidate for embedding
  • 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-13T23:03:40+00:00Added an answer on June 13, 2026 at 11:03 pm

    The applet element is for loading classes of type JApplet and Applet, whereas the code is a JFrame.

    So start with something like this.

    import javax.swing.*;
    
    /*
    <applet code=DialerApplet width=250 height=70>
    <param name="servername" value="Evolution-X" >
    <param name="ip"  value="127.0.0.1" >
    <param name="port" value="43594" >
    </applet>
    */
    public class DialerApplet extends JApplet {
        public void init() {
            JTextArea ta = new JTextArea(20,5);
            add(new JScrollPane(ta));
    
            String eol = System.getProperty("line.separator");
            StringBuilder sb = new StringBuilder();
            String[] params = {"servername","ip","port"};
            for (String param : params) {
                sb.append( param );
                sb.append( ": " );
                sb.append( getParameter(param) );
                sb.append( eol );
            }
            ta.setText(sb.toString());
    
            validate();
        }
    }
    

    working applet

    Update

    The important line in the stack trace is:

    Caused by: java.lang.ClassCastException: 
        StatusCheckerMain cannot be cast to java.applet.Applet
    

    This is quite strange.

    • The code as per the question extends applet.
    • The console output supports that the cache was flushed (removing old classes that may have been stored).
    • A JApplet extends Applet – so it can be cast.

    Make absolutely sure the new Jar is being copied to whatever place the code is being run from. Also try starting a new project and see if you can get the code I posted to launch as an applet on your machine. If not, it indicates a more fundamental problem.

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

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I have a jquery bug and I've been looking for hours now, I can't
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
Specifically, suppose I start with the string string =hello \'i am \' me And
I would like to run a str_replace or preg_replace which looks for certain words
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
Seemingly simple, but I cannot find anything relevant on the web. What is the
Does anyone know how can I replace this 2 symbol below from the string

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.