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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T09:54:45+00:00 2026-06-14T09:54:45+00:00

First time posting here. I made a simple calculator program using java and I

  • 0

First time posting here. I made a simple calculator program using java and I am trying to put it onto my website. From what I’ve gathered from previous help posts is that I need to create a JApplet with all my program contents and compress it into a .jar file. Then I need to create a .JNLP file, which describes how to applet should be launched.

So here is where I am having trouble.

package calculator;
import javax.swing.JApplet;
import javax.swing.SwingUtilities;

public class CalculatorApplet extends JApplet {

public void init()
{
    try
    {
        SwingUtilities.invokeAndWait(new Runnable()
        {
        public void run() {
            Calculator calc = new Calculator();
            add(calc);
        }
        });
    }
    catch(Exception e)
    {
        System.err.println("GUI creation failed");
    }
}
}

It seems my applet was not constructed properly. Whenever I run it a “java.lang.reflect.InvocationTargetException” is thrown. Whenever I run my Calculator class independently from the applet it works as expected. Any ideas where the source of my error is?

  • 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-14T09:54:47+00:00Added an answer on June 14, 2026 at 9:54 am

    I think JNLP files are used for Java Web Start. That’s something you won’t need with an average Java applet. Please do correct me if I’m wrong.

    If you have the working .jar file, an HTML file that calls the applet will be sufficient to run the applet. Insert the code <applet width="300" height="300" archive="jar.jar" code="class.class"></applet> into an HTML file, where class.class is the class extending Applet or JApplet and jar.jar the location of the jar file. Loading the HTML file in a browser will display the applet.

    Alternatively, you can use Java’s Applet Viewer to open the HTML page and open the applet locally.

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

Sidebar

Related Questions

This is my first time posting here. I am using GUI in java for
first time posting here. I'm using a loop to create 3 buttons, but my
use this website a lot but first time posting. My program creates a number
First time posting here. I have problem about referencing a typedef struct from separate
First time posting here so take it easy with me, lol. I'm currently trying
First time posting here, so go easy on me. :) I am trying to
first time posting here so be gentle :) On my web pages I have
this is my first time posting here, I have a question which I have
First time posting here so I'm sorry if I mess up. I need to
this is my first time posting here, but I didn't know where else to

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.