Jar file doesn't execute correctly

I have created a jar file both manually and using Eclipse. I seem to run into the same strange issue however.
When I run the jar file from the command line, it executes some of the code, however, it doesn't seem to run any code in one of my classes. The program doesn't fail, however, and doesn't give me any exception.
When I extracted the .class files in the .jar, my class is there. The decompiled code is also the same as I had written. When I execute the class file in the command prompt, everything works fine.
Has anyone seen anything like this before?

if you have problem to make a jar and you dosent understund what to do i have made a special program for you. in the beginning it was just for myself byt you lookslike you chould need it. www.tiinusen.hello.to/download/ just download jar converter there is a explanation/readme when you zip it up.

Similar Messages

  • JSP referencinc taglib.tld in JAR file doesn't work.

    I have some custom tags which work fine under Weblogic 5.1 when I do a
              normal deployment of files, including the taglib.tld. However, when I
              try to reference the taglib.tld located in a JAR file, then weblogic
              throws an error saying that it cannot resolve into a valid tag library.
              I am only doing this because I am testing the same site agains both
              iPlanet Web Server and Weblogic. iPlanet will only find the taglib.tld
              when it is in a JAR file.
              Can anyone shed some light on referencing the taglib.tld in a JAR file.
              This should work, as it is covered in the JSP 1.1 specification.
              FYI - the jar file is in the same location as the JSP which references
              it. The URI to the JAR file (in the JSP) is from the root of the site.
              Thanks for any help.
              -Scott Edwards
              

    Welcome to the Sun forums.
    Subject: My Applet Jar file doesn't work !! .
    1) Note that one '!' denotes exclamation, whereas 2 or more often denotes a dweeb.
    2) Since you are on your first post, I will point out that applets are an advanced topic, and should not be attempted by newbies.
    3) "doesn't work" is very vague. It is likely to produce a reply like "maybe the applet is lazy - try flogging it".
    Amera wrote:
    ..I have written this java applet :When posting code, code snippets, HTML/XML or input/output, please use the code tags. The code tags help retain the formatting and indentation of the sample. To use the code tags, select the sample and click the CODE button.
    Also note that the most preferred form of code is an SSCCE *(<- link).* In an SSCCE, your would remove all but one button (if the actionPerformed fails with 6 or 7 buttons, trim it down to fail with just one or two.
    i made a jar file :So does the applet work before you make the Jar file? Your post so far suggests the Jar file is the problem.
    i created a file and named it MANIFEST.MF .i wrote inside it :
    Main-Class: test
    Then i placed it in a folder with the test.class .I created jar file using command line.
    I entered the test.class path and then wrote this command :
    jar cvfm myjar.jar MANIFEST.MF *.class
    Then the jar file "myjar.jar" is created .
    it's executed but this function "public void actionPerformed(ActionEvent e) " won't wrok.
    i keep pressing the buttons but nothing is happening !!So you get 'no output in the console & no effect in the applet'?
    What is the URL where I can see your applet failing?
    As an aside, since Sun does not guarantee that applet clients will act on the showDocument command, even if it does not work, it would not be a 'bug'.
    Edited by: AndrewThompson64 on Dec 28, 2009 11:18 AM

  • My  Applet Jar file doesn't work !!

    hello ,
    I have written this java applet :
    import java.awt.*;
    import javax.swing.*;
    import java.applet.Applet;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.net.URL;
    public class test4 extends Applet implements ActionListener{
         private static final long serialVersionUID = 1L;
         private JButton B1 =new JButton("Forward ");
         private JButton B2 =new JButton("Backward");
         private JButton B3 =new JButton("Left");
         private JButton B4 =new JButton("Right");
    private JPanel P1 = new JPanel();
    private JPanel P2 = new JPanel();
    private JPanel P3 = new JPanel();
    private JPanel P4 = new JPanel();
    private JPanel P5 = new JPanel();
    private JPanel P6 = new JPanel();
    private JLabel L3 = new JLabel(" ");
    private JLabel L4 = new JLabel(" ");
    private JLabel L5 = new JLabel(" ");
    private JLabel L6 = new JLabel(" ");
    private JLabel L7 = new JLabel(" ");
    JSplitPane sppSplitPane0 = new JSplitPane( );
         public test4()
              JFrame.setDefaultLookAndFeelDecorated(true);
              sppSplitPane0.setDividerLocation( 250 );
              P3.add(L4);
              P3.add(B1);
              P3.add(L5);
              P5.add(B3);
              P5.add(L3);
              P5.add(B4);
              P4.add(L6);
              P4.add(B2);
    P4.add(L7);
              P1.setLayout(new BorderLayout());
              P1.add("North",P3);
              P1.add("Center",P5);
              P1.add("South",P4);
              P2.setLayout(new BorderLayout());
              P2.add("North" , P1);
              B1.addActionListener(this);
              B2.addActionListener(this);
              B3.addActionListener(this);
              B4.addActionListener(this);
              sppSplitPane0.setLeftComponent(P2);
              sppSplitPane0.setRightComponent(P6);
         public void actionPerformed(ActionEvent e) {
              try {
                   if (e.getSource() == B4) {
              URL myNewURL = new URL("http://amera/cgi-bin/test.cgi?R");
              System.out.println("URL = " + myNewURL);
              getAppletContext().showDocument(myNewURL,"blank");
                   else
                        if (e.getSource() == B3) {
                        URL myNewURL = new URL("http://amera/cgi-bin/test.cgi?L");
                        System.out.println("URL = " + myNewURL);
                        getAppletContext().showDocument(myNewURL,"blank");
                        else
                             if (e.getSource() == B2) {
                             URL myNewURL = new URL("http://amera/cgi-bin/test.cgi?B");
                             System.out.println("URL = " + myNewURL);
                             getAppletContext().showDocument(myNewURL,"blank");
                             else {
                                  URL myNewURL = new URL("http://amera/cgi-bin/test.cgi?F");
                                  System.out.println("URL = " + myNewURL);
                             getAppletContext().showDocument(myNewURL,"blank");
              } catch (Exception err) {
              System.err.println("Error!\n" + err);
              showStatus("Error, look in Java Console for details!");
         public static void main(String[] args) {
              test t=new test();
              JFrame frame =new JFrame();
              frame.add(t.sppSplitPane0);
              frame.setSize(1100,700);
              frame.setVisible(true);
    i made a jar file :
    i created a file and named it MANIFEST.MF .i wrote inside it :
    Main-Class: test
    Then i placed it in a folder with the test.class .I created jar file using command line.
    I entered the test.class path and then wrote this command :
    jar cvfm myjar.jar MANIFEST.MF *.class
    Then the jar file "myjar.jar" is created .
    it's executed but this function "public void actionPerformed(ActionEvent e) " won't wrok.
    i keep pressing the buttons but nothing is happening !!
    please help me .
    Edited by: Amera on Dec 27, 2009 2:51 PM

    Welcome to the Sun forums.
    Subject: My Applet Jar file doesn't work !! .
    1) Note that one '!' denotes exclamation, whereas 2 or more often denotes a dweeb.
    2) Since you are on your first post, I will point out that applets are an advanced topic, and should not be attempted by newbies.
    3) "doesn't work" is very vague. It is likely to produce a reply like "maybe the applet is lazy - try flogging it".
    Amera wrote:
    ..I have written this java applet :When posting code, code snippets, HTML/XML or input/output, please use the code tags. The code tags help retain the formatting and indentation of the sample. To use the code tags, select the sample and click the CODE button.
    Also note that the most preferred form of code is an SSCCE *(<- link).* In an SSCCE, your would remove all but one button (if the actionPerformed fails with 6 or 7 buttons, trim it down to fail with just one or two.
    i made a jar file :So does the applet work before you make the Jar file? Your post so far suggests the Jar file is the problem.
    i created a file and named it MANIFEST.MF .i wrote inside it :
    Main-Class: test
    Then i placed it in a folder with the test.class .I created jar file using command line.
    I entered the test.class path and then wrote this command :
    jar cvfm myjar.jar MANIFEST.MF *.class
    Then the jar file "myjar.jar" is created .
    it's executed but this function "public void actionPerformed(ActionEvent e) " won't wrok.
    i keep pressing the buttons but nothing is happening !!So you get 'no output in the console & no effect in the applet'?
    What is the URL where I can see your applet failing?
    As an aside, since Sun does not guarantee that applet clients will act on the showDocument command, even if it does not work, it would not be a 'bug'.
    Edited by: AndrewThompson64 on Dec 28, 2009 11:18 AM

  • Jar file doesn't work

    I am quite new to java so I hope my question is not stupid.
    I used bluej to realize an application.It works when executing the main method in bluej,but when I create the jar file,it simpy doesn't work.I have included the main class when creating the jar file.When double-clicking on the jar file, it makes the typical error sound of windows,but it doesn't show any message.
    What is the problem?

    Welcome to the Sun forums.
    Subject: My Applet Jar file doesn't work !! .
    1) Note that one '!' denotes exclamation, whereas 2 or more often denotes a dweeb.
    2) Since you are on your first post, I will point out that applets are an advanced topic, and should not be attempted by newbies.
    3) "doesn't work" is very vague. It is likely to produce a reply like "maybe the applet is lazy - try flogging it".
    Amera wrote:
    ..I have written this java applet :When posting code, code snippets, HTML/XML or input/output, please use the code tags. The code tags help retain the formatting and indentation of the sample. To use the code tags, select the sample and click the CODE button.
    Also note that the most preferred form of code is an SSCCE *(<- link).* In an SSCCE, your would remove all but one button (if the actionPerformed fails with 6 or 7 buttons, trim it down to fail with just one or two.
    i made a jar file :So does the applet work before you make the Jar file? Your post so far suggests the Jar file is the problem.
    i created a file and named it MANIFEST.MF .i wrote inside it :
    Main-Class: test
    Then i placed it in a folder with the test.class .I created jar file using command line.
    I entered the test.class path and then wrote this command :
    jar cvfm myjar.jar MANIFEST.MF *.class
    Then the jar file "myjar.jar" is created .
    it's executed but this function "public void actionPerformed(ActionEvent e) " won't wrok.
    i keep pressing the buttons but nothing is happening !!So you get 'no output in the console & no effect in the applet'?
    What is the URL where I can see your applet failing?
    As an aside, since Sun does not guarantee that applet clients will act on the showDocument command, even if it does not work, it would not be a 'bug'.
    Edited by: AndrewThompson64 on Dec 28, 2009 11:18 AM

  • Including a jar file inside an executable jar file

    Is it possible to include a jar file inside another (executable) jar file such that the included file is part of the class path for the outer file? If so, how do you specify this in the classpath in the manifest?

    Russ_Bjork wrote:
    Is it possible to include a jar file inside another (executable) jar file such that the included file is part of the class path for the outer file?No. Actually, I suppose it would be possible if you do all the 'heavy lifting', but Java is not designed to handle Jars within Jars.
    What do you see as the advantage of doing that?
    Is your app. a rich client (e.g. Swing, AWT, SWT..)?
    Can you distribute the app. from a server or the internet?

  • Executable Jar file doesn't show images

    Hello all,
    In my jar file, I have two references to images, which are instantiated as follows:
    Icon something = new ImageIcon("image.gif");
    However, when I compile an executable JAR file, these images don't show.
    I've included the image in the directory which is used for the jar source, and I can't think of any other reasons why it wouldn't work... Does anyone have any ideas?
    Thanks
    Gemma

    First you need to create an URL to the image inside your jar
    String insideJarPath = "/mypackage/images/myImage.jpg"; // starts with a /
    Url myImageURL = getClass().getResource(insideJarPath);
    Then use that to create your ImageIcon:
    ImageIcon myIcon = new ImageIcon(myImageURL);
    See API of Class.getResource()
    It will tell you that you can work absolute from inside the jar by starting with a "/" for the insideJarPath.
    Or you can work relative from the package directory of the class instance calling getClass() by not starting with "/".

  • JAR doesn't execute correctly

    I have created a jar file using NetBeans 5.5. When I try to run the jar file outside of the IDE it does not display correctly. All that shows up is a window bar with the 3 normal buttons (minimize, maximize, close). It uses 3 external jars (j3d jars) that are in a sub directory to the one my jar file is in. Below is the manifest. Any ideas on what might be wrong? Thanks.
    Manifest-Version: 1.0
    Ant-Version: Apache Ant 1.6.5
    Created-By: 1.6.0-b105 (Sun Microsystems Inc.)
    Main-Class: DRSFrame
    Class-Path: lib/j3dcore.jar lib/j3dutils.jar lib/vecmath.jar
    X-COMMENT: Main-Class will be added automatically by build

    I figured out what the problem was. I didn't set the preferred size.

  • Jar file is not executing

    hi all,
    i was creating a jar excutable, when i was trying to execute it by double clicking on it(its placed in the desktop), open with dialog box is coming. could u plz help me out??
    here what i've done.. in the manifest file i've entered
    Manifest-Version: 1.0
    Main-Class: Class2Jarand to create the jar file i've given the command
    jar cmf manifest.mf max.jar Class2Jar.classthankx & regards,
    max

    open with dialog box is comingLooks like a broken file association. Try re-installing the Java runtime to have Jars associated to it again.

  • Jar file won't execute

    I have written a program to manipulate an access database, it works fine from Eclipse but when I create a jar file using Jarbuilder 0.8, this jar file wont execute. It returns
    Exception in thread "main" java.io.IOException: invalid header field
    at java.util.jar.attributes.read(Unknown Source)
    at java.util.jar.Manifest.read(Unknown Source)
    at java.util.jar.Manifest.<init>(Unknown Source)
    at java.util.jar.Jarfile.getManifest(Unknown Source)
    The whole set of classes is online together with the database at users.skynet.be/NewOne/Televisie.rar (with Hoofdvenster as Manifest)
    and the jar file at
    users.skynet.be/NewOne/Televisie.jar
    I was wondering, do I have to include anything special because i m working with an ODBC here, or what else could be the problem ?
    All comments and suggestions are welcome, thnx in adance !!

    Hi there!
    After a brief look at your manifest a saw that you specifie the path to your main-class like this:
    Main-Class: gui/Gui
    ...and when you make the jar-file you type:
    jar cmf Manifest.txt JAppointment.jar Gui/*.class ...etc..
    Remember that Java is case-sensitive and look at "gui" and "Gui" differently!
    Maybee that could be the problem?
    /Andrew

  • Wrapping Jar Files in Linux Executables?

    I was wondering how to wrap my Jar file in a Linux Executable. I tried dowloading Launch4j, but that only allowed Windows Executables. Is there an easy way to do this? I'm trying need to be able to pass arguments to the Jar file.
    Thanks!

    And the arguments vary each time the user use your application ?
    Then you will have to write a small shell script which takes the user input, e.g. myShellScript.sh var1 var2 ...
    Inside the script you place the java -jar myProg call and pass the arguments to it:
    cd /path/to/jar
    java -jar myProg $1 $2
    whereas $1 $2 ... holds the argument(s) which you have passed to myShellScript.sh.
    To make it a little bit more comfortable you can define an alias for you myShellScript.sh so there is no need that myShellScript.sh is in /usr/bin,
    Is it that what you are looking for?
    Edited by: Michael_Knight on 17.11.2008 08:26
    I just recognized that you use a debian package ... probably you can ignore my last hint.

  • Jar file doesn't read classpath environment variable from windows xp

    I created a small program that uses javamail and jdbc driver. I program on Win XP and use java 1.6.04.
    When I compiled my classes the program works fine but when I created a jar package the jar file cannot 'see' the classpath that windows has already set.
    I have to set the classpath in the manifest file and then it works ok.
    Is this normal? I was expecting that the jar file would work just fine without any complication since the classpath is already set in the system?
    If you could point to any documentation that covers this it would be great.
    Thank you very much.
    Genti

    genti_tech wrote:
    I specified the class-path in manifest in jar file and I looked at the tutorial you are suggesting:
    http://java.sun.com/docs/books/tutorial/deployment/jar/
    which is not clear at all about the fact that jar ignores the class-path environment variable.It is specified for java. http://java.sun.com/j2se/1.5.0/docs/tooldocs/windows/java.html#-jar

  • Jar file doesn't run properly, please help!

    Hi everyone, i'm a student and i'm programming a game for my homework of AI subject. When i compiled the code from Eclipse, the game run smoothly, but when I create the jar file of the project, it appear blank when i run it. Here is the image:
    [blank screen|http://c.upanh.com/upload/4/299/3L0.8429518_1_1.png]
    and run from Eclipse:
    [Run from Eclipse|http://c.upanh.com/upload/4/299/TL0.8429668_1_1.png]
    I have followed the instruction of creating jar file in Eclipse properly, and now the trouble come. If anyone can show me how to solve this problem?
    Thanks all.

    I have all of e.printStackTrack( ) in my try - catch block. But i also think the blank screen appears because the class can not find my resources. Maybe it's my fault, because i create by hand a folder name "res" in project folder, then put all my resource in this folder. And in Eclipse when i try to get these resource, i wrote something like this:
         Image robot1N, robot1E, robot1S, robot1W;
         private void initResources() {               
              try {               
                   String sb = "car1";
                   robot1N = ImageIO.read(new File("res\\img\\unit\\" + sb +"_N.png"));
                   robot1E = ImageIO.read(new File("res\\img\\unit\\" + sb +"_E.png"));
                   robot1S = ImageIO.read(new File("res\\img\\unit\\" + sb +"_S.png"));
                   robot1W = ImageIO.read(new File("res\\img\\unit\\" + sb +"_W.png"));
              catch(Exception e) {
                   e.printStackTrace();
         }Maybe the string of path to resource is right in Eclipse but wrong in Window?

  • Jar files won't execute

    "Could not find the main class. Program will exit!"
    no matter what i put in the manifest, i keeps saying that,
    i've read everything i could find at jar files, and nothing works

    Have you put Main-class attribute in manifest file ?
    if yes, did you put a new line after this attribute ?

  • Created jar-file doesn't find other jars

    Hi,
    I built an application using jars (among others the ojdbc14.jar) - working "perfectly" in eclipse.
    But when I create a jar - I receive an "Class-not-found-Exception", when the
    Class.forName("oracle.jdbc.driver.OracleDriver"); is invoked.
    I tried using newInstance() but it didn't work.
    The classpath seems to be correct:
    <?xml version="1.0" encoding="UTF-8"?>
    <classpath>
         <classpathentry kind="src" path=""/>
         <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
         <classpathentry exported="true" kind="lib" path="ojdbc14.jar"/>
         <classpathentry kind="output" path=""/>
    </classpath>I also "included" the jar(s) in the manifest:
    Bundle-ClassPath: ojdbc14.jarAnd of cause they are included in the jar.
    So - where is the bug? Do I have to use another command than the forName to load the driver?
    Thanks for any tip.
    adicko

    Hi again :)
    when I use instead of the "...getName()..."
    DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());I don' receive the ClassNotFoundError"- but the jar doesn't do anything (seems like hanging-up)

  • Linked .ai file doesn't show correctly in pdf, what to do?

    I have placed into my InDesign document an Illustrator file which contains white vector graphic elements on a transparent background (a map with lines and texts converted to vectors). The linked file shows correctly in InDesign but when I make a .pdf file it omits some of the texts (not all) in the .ai file. All of the texts have been converted to vectors so that shouldn't have anything to do with the problem. The quality of the pdf doesn't make any difference either. Could someone help me?

    Strange...Try this
    - Open you .ai file
    - Create a "my white" spot colour,  (I mean creat a white spot colour, and name it "my white" to not to be confused with the standard white)
    - select all your white elements and coulour them with  "my white"
    - save into standard .ai file
    - import the file into Indesign, the "my white" should appear in your colour swatch pannel
    - convert "my white" into CMYK ( you'll get the framed little quarter just beside your colour swatch)
    - export  your pdf file, whatever RVB or CMYK should work with both

Maybe you are looking for

  • Unable to configure Oracle Applications Adapter to capture Business Event

    Hi All, I am new to SOA and BPEL so please bare that in mind when reading and responding to this post. I am attempting to trigger BPEL from an EBS business event as per the SOA gateway developers guide. I am working on EBIZ R12.1.2, 11g weblogic, Jde

  • Logic for internal table

    Hi, I have an internal table with the following structure. PO Number     PO Line Number     Quantity     ETA PO_1     001     10     10 Aug 2009 PO_1     002     12     11 Aug 2009 PO_2     001     5     10 Aug 2009 PO_1     001     13     10 Aug 200

  • Reports compilation errors (6i to 9i)

    Hello, When migrating a report from Oracle 6i to Oracle 9i, I get a number of errors. Here are 2 sample functions and the associated errors at compile time: function AfterReports return boolean is begin /* Delete referenced files */ update lot set re

  • Adobe Request: multi-column scripts

    Hi guys/gals, We're looking for examples of multi-column scripts as we develop Story.  If any of you here have real-world examples and want to share them, please send me a private message on how we can get them. Thanks in advance for any assistance!

  • How to remove a component

    Is there a better way to remove a component named 'instructions': instructions.parent.removeChild(instructions);