Integrating a java applet in a page

I am trying to integrate a processing applet in a jsp, with the following code added in the jsp:

<!--<applet code="Test1.class" archive="C:\Users\user\Desktop\MyApplet.jar" width="600" height="600">
</applet> --!>

I am using a tomcat server. The jar contains the Test1.class file. But whenever I run this page, I am getting an error in the webpage. On clicking for details, the message shown is

IllegalArgumentException: name![enter image description here][1]
Answer:1

Minimalist example:

<applet 
  code="Test1" 
  codebase="."
  archive="MyApplet.jar" 
  width=400
  height=400>
</applet>
  • code - The fully qualified class name (e.g. javax.swing.JApplet)
  • codebase - A . indicates 'the current directory' - where the HTML is loaded from. Although the current directory is the default, I like to make it explicit.
  • archive - Relative path(s) from codebase to archive(s). For simplicity, the archive is assumed to be the same place as the HTML.
  • width/height - Must be specified.
Answer:2

You have to use the "codebase" attribute to set the path. Consider to put it in the same folder (or in a child folder of the current one) instead of an absolute path.

<applet code="Test1" name="yourName" archive="MyApplet.jar" codebase="C:\Users\user\Desktop">
</applet>
Answer:3
<applet code="package1.Test1" name="myApplet" archive="MyApplet.jar,core.jar" codebase="." width="600" height="600">

The above code got me the result.

Answer:4

The code works fine. Just looking for information on how to set up my print f and get the desired results. signs more than one print f statement(s): import java.util.Scanner; public class Coupon { ...

This issue is really frustrating me. I am developping a webapp that creates ical files for users. The issue that I am facing, is whenever the ical event repeates weekly or daily or monthly, the start ...

I have an application in which every Sunday, it checks a MySQL database for data from the past week. I am trying to find out how to get the date String for each day of the past week. My obvious ...

I've create sample theme, i.e. custom.css according to liferay tutorial, and don't know why my theme is not deployed, in the log file is the next content: "No theme found for specified theme id . ...