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.

Similar Messages

  • 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...

  • 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 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();
    }

  • 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

  • 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

  • Regarding jar file creation

    hi friends
    i created jar file using export in eclipse...Successfully created the jar file..but i want to include libarary files also with that jar..for example jdbc connector jar file with that jar..please help
    regards

    [Creating JAR file|http://java.sun.com/docs/books/tutorial/deployment/jar/build.html]

  • Regarding Jar file

    Hi,
    i need to download a jar file which would help me in accessing the methods present in IWD Bussiness Graphics Interface.
    Can you please let me help in these.
    Regards,
    Raju

    Hi,
    I can suggest a workaround that,  Use different ViewContainer UI elements for each Graph Type and Hide all the ViewContainers by setting the Visible Property to a node of type IWDVISIBLE. And in doinit method just set that node to VISIBLE_NONE.  So on seleting the graph type, capture the value and write if conditions and set the VISIBLE_TRUE for the View Container as required.  Like
    if(attr == bar)
    wdContext.node().setVisiAttr(VISIBLE_TRUE);
    the above code is an example. (just make changes to syntax)
    Revert me if you have any queries.
    Regards
    Raghu

  • Problem deploying and using custom Tags in jar files

    I am trying to create a custom tag library of Java classes, package them in a JAR file, and use them in another web application. Here is the JAR file structure, named mytags.jar:
    META-INF
    META-INF/manifest.mf
    META-INF/taglib.tld
    mytags/FooBar.class
    mytags/Another.class
    ...Here is the taglib.tld file:
    <?xml version="1.0" encoding="ISO-8859-1" ?>
    <taglib xmlns="http://java.sun.com/ns/j2ee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee web-jsptaglibrary_2_0.xsd"
    version="2.0">
       <tlib-version>1.0</tlib-version>
       <short-name>foo</short-name>
       <uri>fooTags</uri>
       <info>My tags</info>
       <tag>
         <name>fooBar</name>
         <tag-class>mytags.FooBar</tag-class>
         <body-content>empty</body-content>
         <attribute>
           <name>name</name>
           <required>false</required>
           <rtexprvalue>true</rtexprvalue>
         </attribute>
      </tag>
    </taglib>The FooBar class has getName(String) and setName() methods.
    In the web application, I have copied mytags.jar into the WEB-INF/lib directory. I've verified that it lands in the corresponding directory for my appserver (I'm using Tomcat 6.0.10).
    Here's the header for my JSP:
    <%@ page language="java" contentType="text/html;charset=UTF-8" %>
    <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
    <%@ taglib uri="fooTags" prefix="foo" %>
    <foo:fooBar name="dummy" />
    ...When I access my page, the browser sits there and spins, not able to do anything. I know that some of the content is executed, but it is not able to get to the fooTags. I have tried replacing fooTags with WEB-INF/lib/mytags.jar, to no effect.
    According to the docs, I should not need to include anything in web.xml to reference the fooTags. The tag library classes are valid, since I used them as local tags prior to moving them into a Jar library.
    Any help would be appreciated

    Take the code of the jsp file :
    <%@ page language="java" %>
    <%@ taglib uri="WEB-INF/struts-html.tld" prefix="html" %>
    <html>
       <head>
         <title> First Struts Application </title>
       </head>
         <body>
            <table width="500" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td> </td>
            </tr>
            <tr bgcolor="#36566E">
              <td height="68" width="48%">
                <div align="left">
                  <img src="images/hht.gif" width="220" height="74">
                </div>
              </td>
            </tr>
            <tr>
             <td> </td>
            </tr>     
           </table>
           <html:form action="Lookup"
                      name="lookupForm"
                      type="wiley.LookupForm" >
           <table width="45%" border="0">
            <tr>
              <td>Symbol:</td>
              <td><html:text property="symbol" /> </td>
            </tr>
             <tr>       
              <td colspan="2" align="center"><html:submit/> </td>
             </tr>       
            </table>              
          </html:form>
         </body>
    </html>

  • Regarding jar file checkin in CRM ISA 6.0

    Hi,
    I want to checkin some java files in CRM ISA using NWDI but these java classes have dependency on some third party jars which i need to checkin as well.
    I am unable to find the location where i can checkin the jar files so that these files can be compiled and build without any error.
    Please reply ASAP.

    1) create an Extneral library DC
    2) import the JARs to the libraries folder of the External Library DC project
    3) Right-click on each of the JARs imported to the project and add them to the public part.
    This DC is now ready to be used as a build-time reference that will allow CBS to build the DC that will use the external libraries. Next, we have to create a new DC to hold the class files here are the steps:
    1) Create a new DC
    2) Create a new public part, selecting the "Can be packaged into other build results" option
    3) Rename the JARs as Zip files and extrct the full content (folders and class files) to your root folder
    4) Import the folders and files to the src/packages folder
    5) Expand the public part node that was created and select the "Entities" node, right-click it and choose Edit
    6) In the Entity Type list select the "Folder" option then in the selected entities tree pick each of the folders that you imported in step 5 (above)
    7) Now do a DC build and a DC deploy of the project
    Then check-in, activate, and release any activities you have associated with creating these two projects. In the DC perspective, refresh the Active DCs and Inactive DCs to ensure that both new DCs appear in the Active list. Now we have to setup the references to these DCs in our main Web Dynpro application. To do this, follow these steps:
    1) Open the respective perspective and right click the Used DCs node then choose "Add Used DC.."
    2) Pick the public part of the External Library DC that we created (first) and set it to have a Build Time dependency
    3) Again, right click the Used DCs node and choose "Add Used DC.." then choose the public part of the DC that we created to hold the classes  and give it a Run Time dependecy (weak) and click finish.
    4) Now, due to what I think is a bug. You must right click on the Web Dynpro "used DC" that you just added in the previous step, and set the run time dependency again (it seems to revert to the default values for some reason)
    5) Now do a DC build and a DC deploy on the "main" DC application.
    6) Check-in, activate, and release any activities associated with adding these references and then others on your team may use the classes in the external libraries within the Web Dynpro project.
    I think this will work this is working perfectly for webdynpr DC's
    Thanks and Regards
    shanto aloor

  • Help regarding jar file

    hi all,
    i have jar file called com and i placed jar file in lib/ext
    in that i have two class say for ex. class a and class b.
    And class b extends class a.
    i am importing class b in some other class( in diffrent project)
    when i going to use the methods of class b it giving
    an error .......The type SQLPropertiesFN cannot be resolved. It is indirectly referenced from
    required .class files
    i don't no what the error is
    please help to solve this problem
    thanks in advance
    daya

    i have jar file called com and i placed jar file in lib/ext
    The type SQLPropertiesFN cannot be resolved. It is indirectly referenced from required .class files
    i don't no what the error is please help to solve this problem
    ...Where did you get that com.jar? Maybe there were also other jars or README file bundled with it?
    The error means that some class in "com.jar" needs another class that's not available, so probably you should add some other jar too...

  • 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>

  • Regarding JAR files.

    Dear sir,
    I have given the following coding as an assignment from my college.Please help me to solve it.I have to submit in few days. please reply me as soon as possible.
    And assignment is:
    h3. Problem Statement
    You are trapped in a room full of zombies. Luckily the room is pitch black and, while the zombies can't see, you have night vision goggles. To get out though you will have to be careful, since bumping into a zombie is hazardous to your health.
    More specifically, each zombie will have x and y coordinates between 0 and 99 inclusive. You start at (0,0). If you can get to (99,99), you can take an elevator to safety. You may not leave the room any other way. Get there as fast as you can!
    You must implement a method move. This method takes two int[]s, zx and zy, giving the locations of all the zombies, along with ints x and y giving your location. Your method should return "S" to stand still, or "R", "L", "U", or "D" for the four cardinal directions, and "RU", "RD", "LU", or "LD" for the four diagonal directions: {noformat} LU U RU
    L S R
    LD D RD
    {noformat}Moving right increases your x coordinate, while moving down increases your y coordinate.
    After each of your moves, the zombies will all move randomly. Each zombie will chose a random direction (from the 9 including no move) and attempt to move in that direction. If a zombie wants to move outside of the box defined by (0,0)-(99,99) it will stay where it is instead. Note that while the initial locations of all the zombies are distinct, they will not stay that way -- multiple zombies may occupy the same location.
    Each test case will be generated by first choosing a zombie density in [0.05,0.15]. All locations with x or y at least 5 will then contain one initial zombie with probability equal to the density.
    The simulation will be run for a maximum of 10,000 time steps. You may run into zombies at most 10 times -- the 11th one will kill you. If you fail to reach the exit but you manage to stay alive for T time steps, your score will be T. If you make it to the exit at time T, your score will be 30000 - 2 * T plus 1000 per unused life. In other words, you have 10,000 steps to escape, and you get a bonus of 2 points for each time step you don't need to use. Your final score will simply be the average of your individual scores.
    A simple is provided . To use it you need to write a program which communicates via standard IO. Your main method should first read in N, the number of zombies. For each call to move, you should read in N integers for zx, then N integers for zy, and finally two integers for x and y. You should simply output the move you would return. You can run it with something like: {noformat}java -jar Zombie.jar "java Zombie" -delay 1 -seed 1
    {noformat}"java Zombie" is the executable, and should be replaced with whatever command will run your program. The -delay parameter sets the delay in milliseconds between moves. The -seed parameter specifies the random number generator seed (the examples are 1-10). There is also a -novis parameter which causes the simulation to be run with the visualization. Be careful not to output anything other than your moves to standard out. Standard error may be used for debugging purposes"
    "CODING PROVIDED BY COLLEGE"
    import java.util.*;
    import javax.swing.*;
    import java.io.*;
    import java.security.*;
    import java.awt.*;
    import java.awt.event.*;
    public class BrownianZombies extends JFrame{
    int[] zx, zy;
    int x, y;
    int[] idx;
    boolean[][] visited;
    double p;
    Random r;
    int delay = 100;
    boolean novis, history;
    void generate(String seed){
    try{
    r = SecureRandom.getInstance("SHA1PRNG");
    r.setSeed(Integer.parseInt(seed));
    } catch (Exception e) {
    e.printStackTrace();
    int[] tx = new int[10000];
    int[] ty = new int[10000];
    idx = new int[10000];
    visited = new boolean[100][100];
    int ptr = 0;
    p = r.nextDouble()*0.1+0.05;
    for(int i = 0; i<idx.length; i++)idx[i] = i;
    for(int i = 0; i<100; i++)for(int j = 0; j<100; j++){
    if(i >= 5 || j >= 5)if(r.nextDouble() < p){
    tx[ptr] = i;
    ty[ptr] = j;
    ptr++;
    zx = new int[ptr];
    zy = new int[ptr];
    for(int i = 0 ;i<ptr; i++){
    zx[i] = tx;
    zy[i] = ty[i];
    public void move(){
    for(int i = 0; i<zx.length; i++){
    int s = r.nextInt(i+1);
    int t = idx[i];idx[i] = idx[s];idx[s] = t;
    for(int i = 0; i<zx.length; i++){
    int xx = zx[idx[i]] + r.nextInt(3) - 1;
    int yy = zy[idx[i]] + r.nextInt(3) - 1;
    if(xx < 100 && yy < 100 && xx >= 0 && yy >= 0){
    zx[idx[i]] = xx;
    zy[idx[i]] = yy;
    int lives = 10;
    int T;
    public boolean ok(){
    for(int i = 0; i<zx.length; i++)if(x == zx[i] && y == zy[i])lives--;
    return lives >= 0;
    public String checkData(String s){return "";}
    public double runTest(String lt){
    try{
    int time = 10000;
    generate(lt);
    StringBuffer sb = new StringBuffer();
    sb.append(zx.length).append('\n');
    os.write(sb.toString().getBytes());
    os.flush();
    int score = 30000; T = 0;
    if(history)visited[0][0] = true;
    while((x != 99 || y != 99) && T < 10000){
    T++;
    sb.delete(0,sb.length());
    sb.append(zx[0]);
    for(int i = 1; i<zx.length; i++)
    sb.append(' ').append(zx[i]);
    sb.append('\n');
    sb.append(zy[0]);
    for(int i = 1; i<zy.length; i++)
    sb.append(' ').append(zy[i]);
    sb.append('\n').append(x).append(' ').append(y).append('\n');
    os.write(sb.toString().getBytes());
    os.flush();
    String dir = input.next();
    if(dir.equals("S")){
    }else if(dir.equals("R")){
    x++;
    }else if(dir.equals("L")){
    x--;
    }else if(dir.equals("U")){
    y--;
    }else if(dir.equals("D")){
    y++;
    }else if(dir.equals("RU")){
    x++;
    y--;
    }else if(dir.equals("LU")){
    x--;
    y--;
    }else if(dir.equals("RD")){
    x++;
    y++;
    }else if(dir.equals("LD")){
    x--;
    y++;
    }else{
    System.out.println("Invalid Direction: "+dir);
    return 0;
    if(x < 0)x = 0;
    if(y < 0)y = 0;
    if(x == 100)x = 99;
    if(y == 100)y = 99;
    if(!ok()){
    System.out.println("Brains... Score = "+T);
    return T;
    move();
    if(!ok()){
    System.out.println("Brains... Score = "+T);
    return T;
    score -= 2;
    if(!novis){
    if(history)visited[x][y] = true;
    repaint();
    Thread.sleep(delay);
    System.out.println("Score: "+(score + lives * 1000));
    return score + (x != 99 || y != 99 ? 0 : lives * 1000);
    }catch(Exception e){
    e.printStackTrace();
    return 0;
    class Vis extends JPanel{
    public void paint(Graphics g){
    if(zx == null)return;
    Graphics2D g2 = (Graphics2D)g;
    g2.setColor(new Color(200,200,200));
    g2.fillRect(0,0,getWidth(),getHeight());
    Font f = new Font(g2.getFont().getName(),Font.PLAIN,20);
    g2.setFont(f);
    FontMetrics fm = g2.getFontMetrics();
    int th = fm.getAscent();
    int mul = Math.max(1,Math.min((getWidth()-1)/100,(getHeight()-1-2*th)/100));
    int[][] cnt = new int[100][100];
    for(int i = 0; i<zx.length; i++){
    cnt[zx[i]][zy[i]]++;
    for(int i = 0; i<100; i++){
    for(int j = 0; j<100; j++){
    if(cnt[i][j] == 1)g.setColor(Color.red);
    else if(cnt[i][j] > 1)g.setColor(Color.magenta);
    else if(visited[i][j])g.setColor(Color.cyan);
    else g.setColor(Color.white);
    if(i == x && j == y)g.setColor(Color.blue);
    g.fillRect(mul*i+1,2*th+mul*j+1,mul,mul);
    g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_ON);
    String txt = "Moves Made: "+T;
    g.setColor(Color.black);
    g.drawString(txt,0,th);
    txt = "Lives left : "+lives;
    g.drawString(txt,0,2*th);
    static Process pr;
    static Scanner input;
    static InputStream error;
    static DataOutputStream os;
    public static void main(String[] args) throws IOException{
    BrownianZombies b = new BrownianZombies();
    String exec = null;
    String seed = "1";
    for(int i = 0; i<args.length; i++){
    if(args[i].equals("-delay")){
    b.delay = Integer.parseInt(args[++i]);
    }else if(args[i].equals("-seed")){
    seed = args[++i];
    }else if(args[i].equals("-novis")){
    b.novis = true;
    }else if(args[i].equals("-history")){
    b.history = true;
    }else{
    exec = args[i];
    if(exec == null){
    System.out.println("Please enter an executable");
    System.exit(1);
    //for(int i = 0; i<b.zx.length; i++){
    //System.out.println(i+" "+b.zx[i]+" "+b.zy[i]);
    if(!b.novis){
    b.add(b.new Vis());
    b.setSize(450,450);
    b.setVisible(true);
    b.addWindowListener(new Closer());
    pr = Runtime.getRuntime().exec(args[0]);
    input = new Scanner(pr.getInputStream());
    error = pr.getErrorStream();
    os = new DataOutputStream(pr.getOutputStream());
    new ErrorReader().start();
    b.runTest(seed);
    pr.destroy();
    public String displayTestCase(String s){
    generate(s);
    return "p = "+p;
    public double[] score(double[][] d){
    double[] ret = new double[d.length];
    for(int i = 0; i<ret.length; i++)
    for(int j = 0; j<d[0].length; j++)
    ret[i] += d[i][j];
    return ret;
    static class ErrorReader extends Thread{
    public void run(){
    try{
    byte[] ch = new byte[50000];
    int read;
    while((read = error.read(ch)) > 0){
    String s = new String(ch,0,read);
    //System.out.println("err: "+s+" "+s.endsWith("\n"));
    System.out.print(s);
    System.out.println();
    }catch(Exception e){
    //System.err.println("Failed to read from stderr");
    static class Closer implements WindowListener{
    public void windowActivated(WindowEvent e){}
    public void windowDeactivated(WindowEvent e){}
    public void windowOpened(WindowEvent e){}
    public void windowClosing(WindowEvent e){
    pr.destroy();
    System.exit(0);
    public void windowClosed(WindowEvent e){}
    public void windowIconified(WindowEvent e) {}
    public void windowDeiconified(WindowEvent e) {}

    haytony, let me give you a word of advice. The more work you show, the more work the volunteers are often willing to give. For instance, if you've done a ton of research, wrote most of your own code but were stuck on specific points and posted this, the folks here will bend over backwards to lend you a strong hand to help you as much as possible.
    If on the other hand, you simply post your entire assignment and don't show that you've done one speck of work, often we ignore you at best or ridicule you at worst.
    C'mon, it's up to you. Step up to the plate and show us your work, and your worthiness for help. If you can prove yourself to be a hard-working studious type, then I personally will do all in my upmost to help you. If on the other hand you repeatedly spam these forums with pathetic attempts at getting others to do homework where there is absolutely no evidence that you have done a lick of work yourself, then I will ridicule, flame, and bother you to know end.
    So which is it to be? Again, it's all up to you. Time to go to bat.

Maybe you are looking for

  • Audio output issue in Adobe Acrobat

    We have embedded .mp3 file in Adobe Acrobat XI Pro trial version. We tested in various versions of Adobe Reader in Windows and Mac. The audio is playing fine. But as per our client the audio does not work for her. She is using Windows 8. We could not

  • Copy and Paste Large (more than 999 rows) Spreadsheet

    I have a large spreadsheet that has a number of hidden columns.  It is about 1,135 rows long.  I have no trouble copying and pasting the spreadsheet into Pages (both are IWork '09) as long as I only try to copy and past 999 or fewer rows.  But when I

  • Mail displaying incorrect messages

    I have an odd problem that has suddenly appeared within the last couple days. I use mail with my .mac email address and have so for many years now. As of the other day when I receive a new email some of them will display incorrectly: ie the message m

  • IMac + Airport Snow as wireless bridge?

    I have an older iMac G5 that I have connected in one of the rooms in the house to the wireless router in the front of the house. My issue is that any rooms past the iMac are unable to connect to the original router in the front. My question is can I

  • INT. EXPL. 9, 32- AND 64-bit factory-installed on 64-bit W7: Did Lenovo or did Microsoft do this?

    The RELEVANCE of this question is that, in the future, I might have to re-install Internet Explorer 9 WITHOUT re-installing the whole Operating System from Lenovo. Therefore, I need to know what I will be getting from the Microsoft download webpage.