Results 1 to 6 of 6

Thread: Load an Applet from a Jar

  1. #1
    Join Date
    Dec 2009
    Posts
    263

    Load an Applet from a Jar

    Hello
    I am trying some applet program in java, I have a small question for you. How to execute an applet contained within an archive that is from the Jar file. I tried different things but I got nothing but was not successful. I think there should be one way to do this. If you have any idea about it then please let me know. Thanks in advance.

  2. #2
    Join Date
    Nov 2009
    Posts
    335

    Re: Load an Applet from a Jar

    Hello,
    You can try the following code for doing the same.
    Code:
    <html> <head> <title> app </ title> </ head> <hr>
    <OBJECT
    classid = "clsid: 8AD9C840-044E-11D1-B3E9-00805F499D93"
    width = "100" height = "50" align = "baseline" codebase = "http://java.sun.com/products/plugin/1.2.2/jinstall-1_2_2-win.cab # version = 1,2, 2.0 ">
    <PARAM NAME="code" VALUE="app.class">
    <PARAM NAME="codebase" VALUE=".">
    <PARAM NAME="type" VALUE="application/x-java-applet;version=1.2.2">
    <PARAM NAME ="archive" VALUE="app.jar">
    <COMMENT>
    <EMBED type = "application / x-java-applet; version = 1.2.2"
      width = "200" height = "200" align = "baseline"
      code = "app.class" codebase = "."
      archive = "app.jar"
    pluginspage = "http://java.sun.com/products/plugin/1.2/plugin-install.html">
    <NOEMBED>
    </ COMMENT>
    No Java 2 support for APPLET!
    </ NOEMBED>
    </ EMBED>
    </ OBJECT>
    <hr> </ body> </ html>

  3. #3
    Join Date
    Nov 2009
    Posts
    359

    Re: Load an Applet from a Jar

    Hello,
    If you are confused by the huge code above , then you can simply try the following line in your code and the rest should
    Here is the line which you have to include in your code.
    Code:
    <applet name ="app" archive ="app.jar" code ="test.app" width ="200" height ="25"> < be done automatically.
    If you need any more information on this then please let us know and we will try to help you out of your problems. Try it and if you get an error then post the error.

  4. #4
    Join Date
    Dec 2009
    Posts
    292

    Re: Load an Applet from a Jar

    Hello,
    Even I had the same problem and I also wanted an applet to run from a jar file. In fact I was already like that but the problem lay elsewhere. My build.xml changed somewhat the structure of my package so I did enjoyed my class Applet. So, first see that the class file is not changed by the other things which you are trying to perform in the code. Just be cool while doing the changes to your code because they effect the class file also.

  5. #5
    Join Date
    Nov 2009
    Posts
    518

    Re: Load an Applet from a Jar

    Hello,
    The simplest solution (in my opinion) is to build a bat file in which we place orders necessary to save the file in the bin directory of java sdk and run the bat file.
    bat file example:
    Code:
    jar cf march.jar mapp.class
    Simply retrieve the archive "march.jar" and place it in the web server directory.
    To view the applet in a web page, you place the tags (at least) the following:
    Code:
    <applet code = "mapp.class" archive = "march.jar" width ="..." height ="..." codebase ="..." name = "mapp"> <param ...> </ applet>
    It is no longer necessary to place the file "mappt.class" in the directory of the web server as it will be present in the jar archive. This allows to verify if it works.

  6. #6
    Join Date
    Apr 2008
    Posts
    264

    Re: applet executable from jar file

    Hello,
    I tried the same, but I have the problem too. I am trying to load the applet from a jar file but it is not working.
    Here is the code
    Code:
    import javax.swing.*;
    import java.applet.Applet;
    
    
    public class test extends Applet {
    	/**
    	 * 
    	 */
    	private static final long serid = 1L;
    
    	public void init() {
    		JOptionPane.showMessageDialog(null, "Hello, World!");
    	}
    }

Similar Threads

  1. Load Applet to Java card
    By Samara in forum Software Development
    Replies: 5
    Last Post: 21-07-2010, 04:21 AM
  2. How to Deploy an Applet?
    By MarceloQuad in forum Software Development
    Replies: 4
    Last Post: 18-02-2010, 03:47 AM
  3. How to run an Applet Program
    By sarafsneh in forum Software Development
    Replies: 1
    Last Post: 04-01-2010, 06:07 PM
  4. applet in jsp?
    By LetsC in forum Software Development
    Replies: 3
    Last Post: 10-08-2009, 05:22 AM
  5. Applet unable to load -shows with the Grey Box
    By Shanbaag in forum Software Development
    Replies: 3
    Last Post: 15-04-2009, 12:25 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,715,494,596.93089 seconds with 17 queries