Applet in a .jar file?

I want to program a program which can be used as application or as applet. Is it possible to create a .jar file and use something inside as applet? What would the <applet> tag look like?

Sorry, I guess I thought you had this working already. In any case, here is an example of some JApplet code that runs either as an applet on a web page or as an application in a JFrame. It is the applet from the html-applet tag example I provided above. It is missing some classes, so it won't compile of course, but it shows all the applet vs. application code. This methodology also works in older non-swing applets ...just follow a technique similar to what you see below:
If you didn't need to see this ...please just ignore it. Good luck.
/** Applet or application example. */
public class RasterGameOfLife extends javax.swing.JApplet {
  RasterLifeCanvas canvas;                // The drawing area
  RasterLifeCanvas.LifeControls controls; // The drawing controls
  /** the applets init method sets up some gui components */
  public void init() {
    canvas = new RasterLifeCanvas();
    controls = canvas.getControls();
    getContentPane().setLayout( new java.awt.BorderLayout() );
    getContentPane().add( "Center", canvas );
    getContentPane().add( "South", controls );
  /** the applets destroy method cleans up after execution */
  public void destroy() {
    remove( controls );
    remove( canvas );
  /** the applets start method enables and begins an animation sequence */
  public void start() {
    controls.setEnabled( true );
    controls.startAnimation();
  /** the applets stop method stops and disables an animation sequence */
  public void stop() {
    controls.stopAnimation();
    controls.setEnabled( false );
   * main is where the alternative application code is placed
   * this code does not execute when the program is run as an applet
  public static void main(String args[]) {
    javax.swing.JFrame f = new javax.swing.JFrame();      // create a JFrame for the application
    final RasterGameOfLife life = new RasterGameOfLife(); // create an instance of the applet
    life.init();     // Manually call the init method
    life.start();    // Manually call the start method
    f.addWindowListener( new java.awt.event.WindowAdapter() {
      public void windowClosing( java.awt.event.WindowEvent e ) {
        life.stop(); // Manually call the stop method
        System.exit(0);
    f.getContentPane().add( "Center", life );
    // or sometimes I use this alternative to get the applets contentPane
    //f.getContentPane().add( "Center", life.getContentPane() );
    f.setSize( 734, 435 );
    f.show();
}

Similar Messages

  • Loading an image into an Applet from a JAR file

    Hello everyone, hopefully a simple question for someone to help me with!
    Im trying to load some images into an applet, currently it uses the JApplet.getImage(url) method just before registering with a media tracker, which works but for the sake of efficiency I would prefer the images all to be contained in the jar file as oppossed to being loaded individually from the server.
    Say I have a class in a package eg, 'com.mydomain.myapplet.class.bin' and an images contained in the file structure 'com.mydomain.myapplet.images.img.gif' how do I load it (and waiting for it to be loaded before preceeding?
    I've seen lots of info of the web for this but much of it is very old (pre 2000) and im sure things have changed a little since then.
    Thanks for any help!

    I don't touch applets, so I can't help you there, but here's some Friday Fun: tracking image loading.
    import java.awt.*;
    import java.awt.image.*;
    import java.beans.*;
    import java.io.*;
    import java.net.*;
    import javax.imageio.*;
    import javax.imageio.event.*;
    import javax.imageio.stream.*;
    import javax.swing.*;
    public class ImageLoader extends SwingWorker<BufferedImage, Void> {
        private URL url;
        private JLabel target;
        private IIOReadProgressAdapter listener = new IIOReadProgressAdapter() {
            @Override public void imageProgress(ImageReader source, float percentageDone) {
                setProgress((int)percentageDone);
            @Override public void imageComplete(ImageReader source) {
                setProgress(100);
        public ImageLoader(URL url, JLabel target) {
            this.url = url;
            this.target = target;
        @Override protected BufferedImage doInBackground() throws IOException {
            ImageInputStream input = ImageIO.createImageInputStream(url.openStream());
            try {
                ImageReader reader = ImageIO.getImageReaders(input).next();
                reader.addIIOReadProgressListener(listener);
                reader.setInput(input);
                return reader.read(0);
            } finally {
                input.close();
        @Override protected void done() {
            try {
                target.setIcon(new ImageIcon(get()));
            } catch(Exception e) {
                JOptionPane.showMessageDialog(null, e, "Error", JOptionPane.ERROR_MESSAGE);
        //demo
        public static void main(String[] args) throws IOException {
            final URL url = new URL("http://blogs.sun.com/jag/resource/JagHeadshot.jpg");
            EventQueue.invokeLater(new Runnable(){
                public void run() {
                    launch(url);
        static void launch(URL url) {
            JLabel imageLabel = new JLabel();
            final JProgressBar progress = new JProgressBar();
            progress.setBorderPainted(true);
            progress.setStringPainted(true);
            JScrollPane scroller = new JScrollPane(imageLabel);
            scroller.setPreferredSize(new Dimension(800,600));
            JPanel content = new JPanel(new BorderLayout());
            content.add(scroller, BorderLayout.CENTER);
            content.add(progress, BorderLayout.SOUTH);
            JFrame f = new JFrame("ImageLoader");
            f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            f.setContentPane(content);
            f.pack();
            f.setLocationRelativeTo(null);
            f.setVisible(true);
            ImageLoader loader = new ImageLoader(url, imageLabel);
            loader.addPropertyChangeListener( new PropertyChangeListener() {
                 public  void propertyChange(PropertyChangeEvent evt) {
                     if ("progress".equals(evt.getPropertyName())) {
                         progress.setValue((Integer)evt.getNewValue());
                         System.out.println(evt.getNewValue());
                     } else if ("state".equals(evt.getPropertyName())) {
                         if (SwingWorker.StateValue.DONE == evt.getNewValue()) {
                             progress.setIndeterminate(true);
            loader.execute();
    abstract class IIOReadProgressAdapter implements IIOReadProgressListener {
        @Override public void imageComplete(ImageReader source) {}
        @Override public void imageProgress(ImageReader source, float percentageDone) {}
        @Override public void imageStarted(ImageReader source, int imageIndex) {}
        @Override public void readAborted(ImageReader source) {}
        @Override public void sequenceComplete(ImageReader source) {}
        @Override public void sequenceStarted(ImageReader source, int minIndex) {}
        @Override public void thumbnailComplete(ImageReader source) {}
        @Override public void thumbnailProgress(ImageReader source, float percentageDone) {}
        @Override public void thumbnailStarted(ImageReader source, int imageIndex, int thumbnailIndex) {}
    }

  • Class not found in applet using 2 jar files

    I have an applet which has been working for years as a stand alone or connecting directly to a derby database on my home server. I have just changed it to connect to MySQL on my ISP server via AJAX and PHP.
    I am now getting a class not found error in my browser, probably because I'm stuffing up the class path.
    The HTML I am using to call the applet is:
    <applet code="AMJApp.class"
    codebase="http://www.interactived.com/JMTalpha"
    archive="AMJ014.jar,plugin.jar"
    width="500"height="500"
    MAYSCRIPT style="border-width:0;"
    name="jsap" id="jsap"></applet>The AMJ014.jar contains the applet and supporting class files.
    The error message is strange to me because it refers to a class I noticed on another web page but which has nothing to do with my applet. Anyway, the message in full is:
    load: class NervousText.class not found.
    java.lang.ClassNotFoundException: NervousText.class
         at sun.plugin2.applet.Applet2ClassLoader.findClass(Unknown Source)
         at sun.plugin2.applet.Plugin2ClassLoader.loadClass0(Unknown Source)
         at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
         at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
         at java.lang.ClassLoader.loadClass(Unknown Source)
         at sun.plugin2.applet.Plugin2ClassLoader.loadCode(Unknown Source)
         at sun.plugin2.applet.Plugin2Manager.createApplet(Unknown Source)
         at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
         at java.lang.Thread.run(Unknown Source)
    Exception: java.lang.ClassNotFoundException: NervousText.class
    java.lang.UnsupportedClassVersionError: AMJApp : Unsupported major.minor version 51.0
         at java.lang.ClassLoader.defineClass1(Native Method)
         at java.lang.ClassLoader.defineClassCond(Unknown Source)
         at java.lang.ClassLoader.defineClass(Unknown Source)
         at java.security.SecureClassLoader.defineClass(Unknown Source)
         at java.net.URLClassLoader.defineClass(Unknown Source)
         at java.net.URLClassLoader.defineClass(Unknown Source)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
         at java.lang.reflect.Method.invoke(Unknown Source)
         at sun.plugin2.applet.Plugin2ClassLoader.defineClassHelper(Unknown Source)
         at sun.plugin2.applet.Plugin2ClassLoader.access$100(Unknown Source)
         at sun.plugin2.applet.Plugin2ClassLoader$2.run(Unknown Source)
         at java.security.AccessController.doPrivileged(Native Method)
         at sun.plugin2.applet.Plugin2ClassLoader.findClassHelper(Unknown Source)
         at sun.plugin2.applet.Applet2ClassLoader.findClass(Unknown Source)
         at sun.plugin2.applet.Plugin2ClassLoader.loadClass0(Unknown Source)
         at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
         at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
         at java.lang.ClassLoader.loadClass(Unknown Source)
         at sun.plugin2.applet.Plugin2ClassLoader.loadCode(Unknown Source)
         at sun.plugin2.applet.Plugin2Manager.createApplet(Unknown Source)
         at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
         at java.lang.Thread.run(Unknown Source)
    Exception: java.lang.UnsupportedClassVersionError: AMJApp : Unsupported major.minor version 51.0

    Thanks again.
    The page code is:
    <html>
    <head>
      <title>Applet to JavaScript to PHP</title>
    </head>
    <body>
    <script type="text/javascript">
    function updateWebPage(myArg)
    document.getElementById("txt1").innerHTML=myArg;
    if (myArg=="")
      document.getElementById("cbxItem").innerHTML="";
      return;
    if (window.XMLHttpRequest)
      {// code for IE7+, Firefox, Chrome, Opera, Safari
      xmlhttp=new XMLHttpRequest();
    else
      {// code for IE6, IE5
      xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
    xmlhttp.onreadystatechange=function()
      if (xmlhttp.readyState==4 && xmlhttp.status==200)
        document.getElementById("cbxItem").innerHTML=xmlhttp.responseText;
    xmlhttp.open("GET","putitem.php?id="+myArg,true);
    xmlhttp.send();
    </script>
    <form>
    <table border=1 align='center' cellpadding=0 cellspacing=0 >
    <tr><td style='text-align:center; background-color:#C0C0C0'>Compiled Java Applet</td></tr>
    <tr><td><applet code="AMJApp.class" codebase="http://www.interactived.com/JMTalpha" archive="AMJ014.jar" width="500"height="500" MAYSCRIPT style="border-width:0;" name="jsap" id="jsap"></applet> </td></tr>
    <tr><td style='text-align:center; background-color:#C0C0C0'>HTML Textbox filled by JavaScript</td></tr>
    <tr><td><textarea style='width:500px; height:50px' name='txt1' id='txt1'>Query goes here</textarea></td></tr>
    <tr><td style='text-align:center; background-color:#C0C0C0'>HTML diagnostic messages rendered by PHP script</td></tr>
    <tr><td><div id="cbxItem">PHP info will populate this space</div></td></tr>
    </table>
    </form>
    </body>
    </html>The URL of the problem page is:
    http://www.interactived.com/JMTalpha/AMJTest.htm
    The code in the page is based on the following test page, which works:
    http://www.interactived.com/test5Applet.htm
    And the Applet, before I made any changes can be seen at this address:
    http://www.interactived.com/jartest0906.htm
    Thanks again for you interest.
    Edited by: 886473 on 21-Sep-2011 00:47

  • Java Applet fails loading JAR files

    I'm using the OC4J setup with my Oracle forms (10g) install, this was working but no longer.
    I get the message below when running the test.fmx from the Oracle Forms Services test page for each of the JAR files attempting to load.
    I comment out the ARCHIVE statement but it still fails with
    'java.lang.ClassNotFoundException:oracle.forms.engine.Main' on the applet window.
    =====================
    java.io.IOException: Connection failure with 504
         at sun.plugin.protocol.jdk12.http.HttpURLConnection.getInputStream(Unknown Source)
         at oracle.jre.protocol.jar.HttpUtils.followRedirects(Unknown Source)
         at oracle.jre.protocol.jar.JarCache$CachedJarLoader.isUpToDate(Unknown Source)
         at oracle.jre.protocol.jar.JarCache$CachedJarLoader.loadFromCache(Unknown Source)
         at oracle.jre.protocol.jar.JarCache$CachedJarLoader.load(Unknown Source)
         at oracle.jre.protocol.jar.JarCache.get(Unknown Source)
         at oracle.jre.protocol.jar.CachedJarURLConnection.connect(Unknown Source)
         at oracle.jre.protocol.jar.CachedJarURLConnection.getJarFile(Unknown Source)
         at sun.misc.URLClassPath$JarLoader.getJarFile(Unknown Source)
         at sun.misc.URLClassPath$JarLoader.<init>(Unknown Source)
         at sun.misc.URLClassPath$2.run(Unknown Source)
         at java.security.AccessController.doPrivileged(Native Method)
         at sun.misc.URLClassPath.getLoader(Unknown Source)
         at sun.misc.URLClassPath.getLoader(Unknown Source)
         at sun.misc.URLClassPath.getResource(Unknown Source)
         at java.net.URLClassLoader$1.run(Unknown Source)
         at java.security.AccessController.doPrivileged(Native Method)
         at java.net.URLClassLoader.findClass(Unknown Source)
         at sun.applet.AppletClassLoader.findClass(Unknown Source)
         at sun.plugin.security.PluginClassLoader.findClass(Unknown Source)
         at java.lang.ClassLoader.loadClass(Unknown Source)
         at sun.applet.AppletClassLoader.loadClass(Unknown Source)
         at java.lang.ClassLoader.loadClass(Unknown Source)
         at sun.applet.AppletClassLoader.loadCode(Unknown Source)
         at sun.applet.AppletPanel.createApplet(Unknown Source)
         at sun.plugin.AppletViewer.createApplet(Unknown Source)
         at sun.applet.AppletPanel.runLoader(Unknown Source)
         at sun.applet.AppletPanel.run(Unknown Source)
         at java.lang.Thread.run(Unknown Source)
    WARNING: error reading http://nzmdgrenfell01.asiapacific.hpqcorp.net:8889/forms/java/frmwebutil.jar from JAR cache.
    Downloading http://nzmdgrenfell01.asiapacific.hpqcorp.net:8889/forms/java/frmwebutil.jar to JAR cache
    java.io.IOException: Connection failure with 504
    Any suggestions?
    Regards......Derek

    I found this Metalink that solved my problem.
    Note:171159.1

  • applet tag regarding JAR file

    Is there something wrong with the following applet declaration?
    <applet code = "Sheep2.class" archive="Sheep2.jar" width = 500 height = 300
    ALT="If you could run this applet, you'd see a sky, a field, and a moon.">
    Your browser is completely ignoring the <APPLET> tag!
    </applet>
    Works fine (it seems) on my Windows 98 computer with IE 6.0280, but does not work on the same computer when I access the page calling the applet using AOL's v.9 browser.
    I used HtmlConverter to convert the above to Extended version (covering all platforms), and still does not work with AOL's browser. HtmlConverter reported no errors, but now IE shows an error icon in its status bar when I access the page even offline.
    Other html files I converted using HtmlConverter work fine with AOL's browser. They don't have "archive" attribute.
    What could be going wrong? My guess is JAR file reference is causing problems.

    I did more Html Conversion today. I ran one file which didn't show any error mark in the status bar of IE through HtmlConverter. I ran the new file generated by HtmlConverter and an error icon appeared in the status bar of IE. My Java Console didn't show any message. So, it must be an error in the applet related info HtmlConverter generated was not 100% html compliant..
    BTW, I started speculating the cause of my applets not working on the computer of oen of my friends is simply that her Java Plug-in cannot handle Swing components' J classes.

  • Applet that archieve jar file fail to load picture

    hello...
    i already can display my applet , but the ploblem is the applet canot display the picture...
    the class that i include in the jar file is can run and will display the picture...
    wat is the ploblem?
    thanks...

    This is my full code
    package dir.yew;
    import java.awt.*;
    import java.awt.event.*;
    import java.io.*;
    import java.util.*;
    import java.applet.*;
    import javax.swing.*;
    import javax.swing.tree.*;
    import javax.swing.event.*;
    public class DirTree
         extends JPanel {
         public static final String APP_NAME = "Directories Tree";
         public static final ImageIcon ICON_COMPUTER =
              new ImageIcon("computer.gif");
         public static final ImageIcon ICON_DISK =
              new ImageIcon("disk.gif");
         public static final ImageIcon ICON_FOLDER =
              new ImageIcon("folder.gif");
         public static final ImageIcon ICON_EXPANDEDFOLDER =
              new ImageIcon("expandedfolder.gif");
         protected JTree  m_tree;
         protected DefaultTreeModel m_model;
         protected JTextField m_display;
         public DirTree() {
              DefaultMutableTreeNode top = new DefaultMutableTreeNode(
                   new IconData(ICON_COMPUTER, null, "My Computer"));
              DefaultMutableTreeNode node;
              File[] roots = File.listRoots();
              for (int k=0; k<roots.length; k++) {
                   node = new DefaultMutableTreeNode(new IconData(ICON_DISK,
                        null, new FileNode(roots[k])));
                   top.add(node);
                node.add( new DefaultMutableTreeNode(new Boolean(true)));
              m_model = new DefaultTreeModel(top);
              m_tree = new JTree(m_model);
              m_tree.putClientProperty("JTree.lineStyle", "Angled");
              IconCellRenderer renderer = new
                   IconCellRenderer();
              m_tree.setCellRenderer(renderer);
              m_tree.addTreeExpansionListener(new
                   DirExpansionListener());
              m_tree.addTreeSelectionListener(new
                   DirSelectionListener());
              m_tree.getSelectionModel().setSelectionMode(
                   TreeSelectionModel.SINGLE_TREE_SELECTION);
              m_tree.setShowsRootHandles(true);
              m_tree.setEditable(false);
                   JScrollPane splitPane = new JScrollPane(
              new JScrollPane(m_tree)
              setLayout( new BorderLayout() );
              add( splitPane );
         DefaultMutableTreeNode getTreeNode(TreePath path) {
              return (DefaultMutableTreeNode)(path.getLastPathComponent());
         FileNode getFileNode(DefaultMutableTreeNode node) {
              if (node == null)
                   return null;
              Object obj = node.getUserObject();
              if (obj instanceof IconData)
                   obj = ((IconData)obj).getObject();
              if (obj instanceof FileNode)
                   return (FileNode)obj;
              else
                   return null;
           class DirExpansionListener implements TreeExpansionListener {
            public void treeExpanded(TreeExpansionEvent event) {
                final DefaultMutableTreeNode node = getTreeNode(
                    event.getPath());
                final FileNode fnode = getFileNode(node);
                Thread runner = new Thread() {
                        public void run() {
                             if (fnode != null && fnode.expand(node)) {
                                  Runnable runnable = new Runnable() {
                                       public void run() {
                                            m_model.reload(node);
                                  SwingUtilities.invokeLater(runnable);
                runner.start();
            public void treeCollapsed(TreeExpansionEvent event) {}
         class DirSelectionListener
              implements TreeSelectionListener {
              public void valueChanged(TreeSelectionEvent event) {
                   DefaultMutableTreeNode node = getTreeNode(
                        event.getPath());
                   FileNode fnode = getFileNode(node);
                   if (fnode != null)
                        m_display.setText(fnode.getFile().
                             getAbsolutePath());
                   else
                        m_display.setText("");
         public static void main(String argv[]) {
              JFrame frame= new JFrame( "FileSystem Viewer");
              DirTree dir = new DirTree();
              frame.getContentPane().add(dir);
              frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              frame.pack();
              frame.setVisible(true);
    class IconCellRenderer
         extends    DefaultTreeCellRenderer {
         public IconCellRenderer() {
              setLeafIcon(null);
              setOpenIcon(null);
         public Component getTreeCellRendererComponent(JTree tree,
              Object value, boolean sel, boolean expanded, boolean leaf,
              int row, boolean hasFocus) {
              // Invoke default implementation
              Component result = super.getTreeCellRendererComponent(tree,
                   value, sel, expanded, leaf, row, hasFocus);
              DefaultMutableTreeNode node =
                   (DefaultMutableTreeNode)value;
              Object obj = node.getUserObject();
              setText(obj.toString());
            if (obj instanceof Boolean)
                   setText("Retrieving data...");
              if (obj instanceof IconData) {
                   IconData idata = (IconData)obj;
                   if (expanded)
                        setIcon(idata.getExpandedIcon());
                   else
                        setIcon(idata.getIcon());
              else
                   setIcon(null);
              return result;
    class IconData {
         protected Icon   m_icon;
         protected Icon   m_expandedIcon;
         protected Object m_data;
         public IconData(Icon icon, Object data) {
              m_icon = icon;
              m_expandedIcon = null;
              m_data = data;
         public IconData(Icon icon, Icon expandedIcon, Object data) {
              m_icon = icon;
              m_expandedIcon = expandedIcon;
              m_data = data;
         public Icon getIcon() {
              return m_icon;
         public Icon getExpandedIcon() {
              return m_expandedIcon!=null ? m_expandedIcon : m_icon;
         public Object getObject() {
              return m_data;
         public String toString() {
              return m_data.toString();
    class FileNode {
         protected File m_file;
         public FileNode(File file) {
              m_file = file;
         public File getFile() {
              return m_file;
         public String toString() {
              return m_file.getName().length() > 0 ? m_file.getName() :
                   m_file.getPath();
         // Alternatively we copud sub-class TreeNode
         public boolean expand(DefaultMutableTreeNode parent) {
              DefaultMutableTreeNode flag =
                   (DefaultMutableTreeNode)parent.getFirstChild();
              if (flag==null)       // No flag
                   return false;
              Object obj = flag.getUserObject();
              if (!(obj instanceof Boolean))
                   return false;      // Already expanded
              parent.removeAllChildren();  // Remove Flag
              File[] files = listFiles();
              if (files == null)
                   return true;
              Vector v = new Vector();
              for (int k=0; k<files.length; k++) {
                   File f = files[k];
                   if (!(f.isDirectory()))
                        continue;
                   FileNode newNode = new FileNode(f);
                   boolean isAdded = false;
                   for (int i=0; i<v.size(); i++) {
                        FileNode nd = (FileNode)v.elementAt(i);
                        if (newNode.compareTo(nd) < 0) {
                             v.insertElementAt(newNode, i);
                             isAdded = true;
                             break;
                   if (!isAdded)
                        v.addElement(newNode);
              for (int i=0; i<v.size(); i++) {
                   FileNode nd = (FileNode)v.elementAt(i);
                   IconData idata = new IconData(DirTree.ICON_FOLDER,
                        DirTree.ICON_EXPANDEDFOLDER, nd);
                   DefaultMutableTreeNode node = new
                        DefaultMutableTreeNode(idata);
                   parent.add(node);
                   if (nd.hasSubDirs())
                        node.add(new DefaultMutableTreeNode(
                             new Boolean(true) ));
              return true;
         public boolean hasSubDirs() {
              File[] files = listFiles();
              if (files == null)
                   return false;
              for (int k=0; k<files.length; k++) {
                   if (files[k].isDirectory())
                        return true;
              return false;
         public int compareTo(FileNode toCompare) {
              return  m_file.getName().compareToIgnoreCase(
                   toCompare.m_file.getName() );
         protected File[] listFiles() {
              if (!m_file.isDirectory())
                   return null;
              try {
                   return m_file.listFiles();
              catch (Exception ex) {
                   JOptionPane.showMessageDialog(null,
                        "Error reading directory "+m_file.getAbsolutePath(),
                        DirTree.APP_NAME, JOptionPane.WARNING_MESSAGE);
                   return null;
    }

  • Signed applet : problem signing jar files that are in build path

    Hello,
    I have a problem while trying to create an ftp applet.
    I use org.apache.commons.net.ftp and i build path for commons-net-1.1.4.jar and then i build my classes.
    When i create a jar file with my classes and after signing it, it works under eclipse but not on a web page.
    I had signed commons-net-1.1.4.jar before to build the path in eclipse but commons-net-1.1.4.jar is not in my jar file.
    What is the way to sign applet correctly even if some jar ressources are in eclipse build path.
    Thank you

    You were right!!!
    I'm not sure what to write down in the formsweb.cfg (configuration file) , following the instructions on the on-line help of Developer Forms 10g , in step 9..
    The step 9 says...
    Because in this release the JACOB code is in an external Jar file and not incorporated into frmwebutil.jar, it needs to be downloaded. To do this, change the WebUtilArchive setting to read: webUtilArchive=/forms/webutil/frmwebutil.jar,/forms/webutil/jacob.jar
    The doudt is pointed to the fact that the frmwebutil.jar isn't in the ORACLE_HOME\forms\webutil path but it is ORACLE_HOME\forms\java path.
    Also , these paths referenced in webUtilArchive are physical paths in a Unix system or they are logical paths in a url?
    Simon

  • Applet with adittional jar files / mp3 with Jlayer

    In order to support multiple MP3 encodings, I created a class that extends MediaPlayer called [MediaPlayerMP3|http://svn.vacavitoria.com/cabecudinhos_1/mp3AsMediaPlayer/src/mp3asmediaplayer/MediaPlayerMP3.fx] ,
    that uses Jlayer to play mp3 files in a separated thread, this works fine inside Netbeans,
    but when I try to run in a applet there is no sounds ...
    I tried to change the HTML to add the jlayer jar mannualy but didnt work also.
    <script>
        javafx(
                  archive: "mp3AsMediaPlayer.jar,jl1.0.1.jar",
                  draggable: true,
                  width: 300,
                  height: 200,
                  code: "mp3asmediaplayer.Main",
                  name: "mp3AsMediaPlayer"
    </script>any idea ?
    the project is available here
    [http://svn.vacavitoria.com/cabecudinhos_1/mp3AsMediaPlayer/]
    this is the reference for previous post about the current restricted support of MP3 files
    [http://forums.sun.com/thread.jspa?forumID=932&threadID=5368966]
    Jlayer mp3 library reference
    [http://www.javazoom.net/javalayer/javalayer.html]

    First fix your html and regenerate the page using the htmlconverter. Valid html requires quotes around attribute values. The code attribute should point at the class file which you are using. In this case, it appears that your ShopSimulation resides in the shop package, so this should be "shop/ShopSimulation.class". Finally, the archive attribute is a relative URI specifying the location of the archive. The way you have written it, the location should be in the same directory as the html page itself. Also, ensure that your jar contents are proper.
    jar tf VirtualShop.jarMETA-INF/
    META-INF/MANIFEST.MF
    shop/ShopSimulation.class
    ...Here's the fixed up html.
    <head><title>Virtual Shop
    </title></head>
    <body>
    <applet code="shop/ShopSimulation.class"
    archive="VirtualShop.jar"
    width=200 height=100>
    </applet>
    </body>

  • Applet tag accessing JAR file

    hi,
    I hope this is not a multi-post, I've searched high and low and I could not find an exact solution to my question...
    How can I load an applet in a browser using an applet tag? My main class is com.my.applet.MainClass.class and the its in a JAR. The jar is in ProjectName/WebContent/WEB-INF/lib/MyJar.jar (a Dynamic Web Project).
    Thx in advance

    i guess there is no solution for this one... i placed it in a resource folder instead... thx everyone...

  • JAR file does not get uploaded to client for my SERVLET generated APPLET

    Some help please...
    I have a servlet that generates the HTML code that contains an APPLET. This APPLET needs a JAR file that is listed under its ARCHIVE property. The SERVLET is in a JAR file that is in the same directory as the other needed JAR file. If I create a static HTML with the output of the SERVLET it works fine. But if go through Weblogic the needed JAR file does not get uploaded to the client so I get a java.lang.NoClassDefFoundError:and my APPLET does not load.
    Q1: I am not sure what to put under the CODEBASE tag. I tried "." and I also tried "http://mymachine" but both did not work. I also tried without the CODEBASE tag. No luck. The SERVLET is bound to http://mymachine/servlet.
    Q2: Does anyone have any suggestions on how to do this? Is there a way to force the browser to upload a certain JAR file?
    Thanks...

    It works!!
    This is what I did:
    The jar file in question was the weblogic.jar. I tried putting it under the lib directory of my war file but I had problems because the weblogic.jar contains other war files inside so when I tried to deploy my war file it also tried to deploy the inner war files which for some reason did not work. So I tried removing the war files from the weblogic.jar and this time I had no problems deploying my war file but I still could not find the classes I needed. So I tried moving the weblogic.jar to the root dir of my war file and it worked!! Now the trick here was: I did not set the CODEBASE AND I had the ARCHIVE paramenter set in TWO places like below:
    <APPLET CODE = "marketmap.client.MarketMapApplet"
    ARCHIVE = "weblogic.jar"
    WIDTH = "657"
    HEIGHT = "382"
    ALIGN = "BOTTOM"
    ALT = "APPLET tag not recognized">
    </XMP>
    <PARAM NAME = CODE VALUE = "MyApplet" >
    <PARAM NAME = "type" VALUE="application/x-java-applet;version=1.2.2">
    <PARAM NAME = "scriptable" VALUE="false">
    <PARAM NAME = ARCHIVE VALUE="weblogic.jar">
    </APPLET>
    Actually if you do not place a parameter named ARCHIVE (at the end) it wil NOT work. I tried with multiple jar files listed and it works great too.
    Anyway I figure I'd share. Thanks for the help too.
    Lastly for people who choose not to upload the jar files to clients, you should look at the bea documentation on applets. It lists a classpath servlet that allows you to provide classes to the clients without having to force them to download the jar file.

  • Applet won't run if put in JAR file

    Hello, I've searched a lot and couldn't find an answer to my problem -
    I want to put my applet into a jar file. and run it, of course.
    I have a jar file that contains "b.class", "temp.class" both of them in directory "package_name", which is their package's name in eclipse. (this jar I obtained by using export from eclipse).
    and - I have my index.html file -
    <APPLET
    CODE="b.class"
    ARCHIVE "jar_file.jar"
    WIDTH="100%" HEIGHT="90"
    </APPLET>
    both the index.html and the jar file in the same directory.
    and the applet wont run!
    what am I doing wrong? somehow I think that the problem is because the classes reside in another directory in the jar file,
    but I already tried everything - with no success :(
    Kogan.

    OK the problem solved -here is highlighted what I was missing -
    <APPLET
    CODE=package_name.b.class ( I was missing the "package_name")
    codebase = "."
    ARCHIVE "jar_file.jar"
    WIDTH="100%" HEIGHT="90"
    </APPLET>
    Edited by: Kogan on Nov 3, 2008 6:51 AM
    Edited by: Kogan on Nov 3, 2008 6:52 AM

  • Problem in loading applet from non executable jar file

    hello ,
    I am new to jar concept plz help.. I am trying to call an applet from another applet through frame it is working fine but its download time is much more. now i want to store all my images , sound files and class files of other applets in a jar file and want to access these inner applets from this jar file so that it will make only one http connection with the server for this jar file only and can reduce the download time of applet.
    Can anyone can give me suggestion plz..
    Thanx

    You have to download what you have to download. You
    probably can't easily share images between 2 separate
    Jar files. Unless you can expose them through the
    other applet via a method that can be known once you
    have the reference to the other applet.Thanx but i think i have to elaborate the problem :
    my project structure is just like this ::
    on the top is ::
    Applet A---> from this applet i am callling Applet B & Applet C in frame
    and communication is established between these 3 applets successfully .
    now i have made a single non executable jar file which contains images , sound and class files of these applets .
    so i am referencing images and sound files in applets through this jar.
    but i wanted to load Applet B & C through this jar file only.
    How can i do this ??
    Thanx .. I hope now the problem is clear

  • Applet -JAR files

    hi,
    can anybody explain ans for doubt that im posting below
    For the applets that includes jar files , for some applet it will work if we place jar files in server and make include in applet tag, but some applet it will wont work, those jar files(or may be class file s also) should also kept in clientside classpath to clean working of applet.
    why this behaviour by applet what r the conditions on that we should keep the jar file on client side
    please anybody could explain this
    thanks in advance

    This may be of help
    http://java.sun.com/docs/books/tutorial/deployment/applet/html.html

  • Adding all dependent classes of an applet to make a jar file

    Hi everyone,
    I have this problem which I was not able to find a solution for, So I truly appreciate any feedback on this.
    I have a project on eclipse which is basically an applet.
    This applet is using some classes in some jars that I have imported as libraries for this project.
    Everything works on eclipse with no problem. However I need to make a jar file of the applet and required classes to use it in an html page.
    Now that's the part I have been facing difficulties, cuz I have to include all the classes that the applet is using from other jar
    files. And I can not come up with a way to find out all those classes.
    On the other side if I include the whole jars then my applet goes over 100 meg and would be useless.
    I am going to give an example of the problem I have in hope of making it a bit clear.
    I have a applet, which uses some classes from some jars. i.e., class A. but class A itself need class B and etc.
    Now how can I find all these dependencies since I have to include them along the applet in the jar file I am going to make.
    Once again I appreciate any feedback and sorry that is a long question.

    Fractalz wrote:
    . . . Now that's the part I have been facing difficulties, cuz I have to include all the classes that the applet is using from other jar
    files. And I can not come up with a way to find out all those classes.See the Class-Path: parameter (of a Manifest file) documentation here:
    http://java.sun.com/javase/6/docs/technotes/guides/jar/jar.html#Manifest-Overview

  • Multiple repeat downloads of applet jar file

    We have an applet that is downloaded from a Weblogic server. The applet is packaged as a jar file. Some of the testers have been complaining that the applet is extremely slow to start up.
    The applet start-up involves three phases. In a first phase, it fetches data from the server. This phase seems to execute in pretty much constant time. During the second and third phases, it constructs a UI using Swing objects. The UI includes some JPEG files, which are extracted from the applet's own jar file.
    Testers report that the slow part of start-up is actually the UI setup. This should theoretically not be network-bound at all. But packet tracing reveals that during this phase, there's a large amount of network traffic going on. It turns out that there are multiple GET requests for the applet jar file being issued. Typically, 29 requests are issued in all; just for reference, the applet is required to extract 28 images from its jar file, so it looks as if the additional requests correspond to image requests.
    One further detail: this does not occur where there is a fast connection to the server. In these cases, the applet is downloaded once. It looks as if the problem only occurs on slower network connections, and the speculation here is that the applet jar is somehow being downloaded only partially, so that requests for images somehow trigger a re-request of the jar file.
    Has anyone seen anything similar and, more to the point, is there a fix or workaround?
    Technical details: Internet Explorer 5.5 or 6.0, JRE version 1.4.2_01 Java HotSpot(TM) Client VM (on the client), WebLogic 8.1 (on the server)
    Thanks in advance for any help.

    Ok.
    I have been trying hard and found the solution. One of the ablove posting says that it works under java 1.4.1 plug-in. That's infact absolutely true. It also says that how to run client using JRE 1.4.2 or higher. That can be solved two. This is definitely a bug with the 1.4.2 plug-in.
    Follow this procedure that will solve the mystry.
    ----------------------start ---------------------------------
    Problem
    Download of applet is very slow
    Why?
    This was happening because of the repeated download of the applet jars by the applet plug in controller. It is quite clear that the Java 1.4.2 plug in controller has a bug that causes the plug in to download same jar files multiple times irrespective of Jar cache in the client side (configurable from client side using the Java plug in control panel) is enabled or disabled. Therefore, we have moved from 1.4.2 plug in to 1.4.1 (controlled from our client (JSP) code) that works fine.
    What the client (applet client) should do?
    You must do the following in the client side in order to avoid the long download time for applet when running from a browser. We have also found that the browser actually do not matter in slow applet downloads. It is only the plug in that does control the applet download.
    Irrespective of what JVM you have already installed (or not yet installed) please do the following:
    1. Download the JRE 1.4.2 from http://java.sun.com/products/archive/index.html
    -At the time of its installation if it shows that the "JRE is already installed do you uninstall it?" Go ahead and uninstall the JRE 1.4.2. After the un-installation again install the JRE 1.4.2
    -If it does not have the JRE 1.4.2 already installed, then you will see any warning window and you will be able to install the 1.4.2 JRE successfully.
    2. Now, go to the same link and install JRE 1.4.1.
    -If this JRE already installed, uninstall first like the step 1 above. then reinstall it.
    3. Now, after successful installation of the JRE 1.4.1, open the Plug-In control panel.
    -You will find the list of control panel(s) in the Start->Control Panel window. Use the control panel that shows the version number 1.4.1. If no version number shown then use the one that do not show any version number at its end.
    4. Do the following on the Plug-In control panel.
    -Verify if this is the 1.4.1 plug in control panel? Go to the "About" tab to see if it shows 1.4.1.
    If it does not show the 1.4.1 (or 1.4.1_x) then plug in was not installed correctly. Reinstall the 1.4.1 JRE following the step in no-2
    -Go to "Basic" tab and select "Show console" radio button.
    -Go to "Advanced" tab and from the drop down select "JRE ...1.4.2" from the "Java Runtime Environment" drop down box.
    -Go to "Browser" tab and select all that in the "Settings" box applicable for browsers.
    -Go to "Cache" select "Enable Caching" if it is not selected currently. Select "Unlimited" from "Size" options.
    Now hit "Apply" button at the bottom and close the control panel using the 'X'.
    5. Restart your Windows machine.
    6. You are ready to run the applet from any of the browser (IE, NS, etc.)
    --------------------------end------------------------------

Maybe you are looking for

  • Connecting EVO headset to a bluetooth laptop

    We have seen quite a number of requests lately on members asking how to connect their EVO headsets wirelessly (via bluetooth). Hence, we have decided to create a thread that will serve as a resource for those who have difficulty pairing their headset

  • Install 10g R2 Win XP,P4,The oui.exe found a problem and need to be closed

    Oracle Database 10g Release 2 10.2.0.1.0 Win32Bit On my computer the Universal Installer that comes with the 10201_database_win32.zip Download fails at startup. I try the the setup.exe and the oui.exe in the "install" subdirectory, but i get the same

  • REST Web Reference with Input Parameters

    I am using  APEX 4.2.0 I was integrating with remote oracle database with API (Restful) it's working me fine from APEX Page items with username and password with static contents that located in the: Home >Application Builder >Application 179 >Shared

  • VMware - I cannot logon to Windows 7 after upgrade to Yosemite

    After upgrading to Yosemite, I cannot logon to Windows under VMware Fusion 7.0.  It was working fine prior to the upgrade. The message I get when logging onto Window is, "The User Profile Service service failed the logon. The User profile cannot be l

  • Align h:graphicImage with h:outputTex

    Greetings; Can any one help me please how align an image rendered using <h:graphicImage /> just beside <h:outputTex/> in the same <td> ,I spent a lot of time getting them fitted nicely, but I coundn't. Any help is greatly apprciated.