Jar file not executing on double-click

Hello,
I have a .jar file that I would really like to execute using a double-click in win xp.
I can execute the jar file witha java -jar command on the command prompt and the program runs but when double-clicking i get the error: cannot find the main class: program will exit
I had win rar installed on my computer which changed itself to the default app to open jar files.
So this is what I've tried
I tried modifying the registry command to run java -jar, javaw -jar but they don't work.
I have created several manifest.mf files with this in them
Manifest-Version: 1.0
Created-By: 1.4.2_07 (Sun Microsystems Inc.)
Main-Class: MyClass
I know that a carraige return needs to be at the end though I don't know really how to check for it (I assume its there because I have a few extra lines after the last text peice). I've read through some other threads but nothing seems to work. It's getting really annoying always having to go through the runline. Thanks for the help.

I don't understand why Netbeans has such a hard time creating working jar's for applications. This is the second time I've written an application that just will not work when trying to execute using the jar. The last time this happened I used Eclipse and imported everything (including the layout) and Eclipse got it working the first time.
This time, I thought I'd go back to Netbeans since they released a newer version 4.0 (I haven't gone to 4.1 yet). Apparently nothing has changed as my application, once again will not run from the jar. What's the deal with Netbeans?
I think I'll, once again bring my project into Eclipse and have that make the jar.
Kurt

Similar Messages

  • Compile target 1.6 = JAR not executable anymore (double click)

    I made my JAR executable by adding "Main-Class:" and "Class-Path:" entries into the manifest file. This works great with Java 1.5 compiled code. But simple switching the compile target from "1.5" to "1.6", the generated JAR is not executable anymore and shows an error dialog instead:
    Java Virtual Machine Launcher
    Could not find the main class. Programm will exit.
    I create the JAR with an ANT script. Just toggling between target "1.5" and "1.6" forth and back results in an executable JAR (for target "1.5") or this error (for target "1.6").
    Strange: it works when I call the JAR from command line (java -jar myJar.jar), so the error above only occurs when double clicking. (Running on Windows 2000, JDK 1.6.0_03)
    I haven't found any notes about changes in the manifest file for target 1.6 compiled classes.

    PraveenKJain wrote:
    I have created a executable jar file of an swing desktop application, It is working fine if i use the command line (java -jar option) but when i try to execute it by double clicking its shows the error message (could not find the main class. program will exit).If this is a Windows icon, then I suspect the "Start in:" directory is wrong. Mind you, judging by the classpath, it doesn't look like whatever tool created your executable jar did a very good job.
    Winston

  • JAR suddenly not working on double click...

    I have a program that I have been working on for the past few months. I want to run it from the desktop in the form of a .jar file. I use netbeans to create the jar file. In previous versions, this has worked very well. With the most recent build, I have problems running it when clicking on it.
    When the .jar is within the project's folder it is possible to run by double clicking. When I take that same file and move it anywhere else, for example, the desktop, it will not run on double click. It forms a javaw.exe process and hangs. I can run the newly moved jar from the command line with "java -jar 'path'", but not with the double click I want. I have tried this on several computers using the same version of Java..
    This really puzzles me cause it has worked as intended for a few months now, but not anymore.. If anyone has any suggestions of why this might be happening, it would be very much appreciated as I really need this thing to run like I hoped it would
    Thanks!

    no, there is a bug in your code that is causing this strange behavior. What people here are suggesting is that this bug is probably causing an exception, but you are not handling this exception correctly, probably catching it but never doing even a printStackTrace(). This causes the application to fail without you knowing why.
    My suggestion is to run the code from an IDE so you can step through it in debug mode, and see where it is going wrong.

  • Running .jar files in linux on double click

    Hi,
    i needed a solution to run the jar files on double click in linux system.Necessity is mainly because when i run the jar file by java -jar myapp.jar in terminal it works fine .Iam running my app continuosly in system tray(a server kind).But if i close the terminal my app exits.
    How to resolve this ?

    I am taking a SWAG.....it sounds like your problem is how to run a java app without a terminal window. So as I recall, there is some way in Linux to enter a command and have it execute in a new process. I don't recall the syntax but maybe putting a '&' character in the command line? Anyway, you should be able to use the method and use "javaw" instead of "java" to launch your app. You should be able to do this in a batch file too. Something like, javaw -jar yourjar.jar &

  • "File not found" when double clicking an .ai or .eps file

    Hello.
    I have Adobe DesignWebPremium_CS6_LS6 ME.
    When I double click an illustrator fornat file (.ai .eps .pdf) or right click and open with illustrator - I get the following error:  "File not found".
    I tried to uninstall and install again - but it's still has this bug.

    lee gal,
    Presuming nothing is wrong with the file(s) you try (can you open it/them in Acrobat/Reader?), you may try to reinstall using the full three step way:
    Uninstall, run the Cleaner Tool, and reinstall.
    http://www.adobe.com/support/contact/cscleanertool.html

  • Files not opening on double click (Gnome)

    That is the problem im having.
    Im using a virtual Arch (virtualbox) via RDP ... all the system is fine. The only thing not working is that whenever i double click on any document//picture/archive it does not open it's default app....
    I dont think is something to do with the RDP protocol because if i open the mouse settings manager, where you have a small zone for testing the double click actions (the small bulb that lights on/off when you double click) the test shows that the system is actually detecting a double mouse click.............. is there any global settings, in gconf-editor, perhaps, where i can correct this?
    thank you!

    Solved: I had nautilus-elementary from archlinux.fr
    I did: pacman -Rd nautilus-elementary
    then:
    pacman -S nautilus
    All working again....

  • Why does my .jar file do nothing when double clicked?

    Hi all. Just got into java, though I do have a background in Visual Basic, PHP, C / C++ and JavaScript. Anyway, i've written a "Hello World" program and it runs successfully in the IDE, however when I run the .jar executeable file, nothing happens. Why? Thanks in advance.

    I'm using NetBeans IDE, and I have everything set up correctly to the best of my knowledge. As said, no problems arise when running the application in the IDE, just running the .jar file directly is giving me problems. Here is the code if it provides any assistance in solving my problem:
    package including;
    * @author jayz
    import java.io.*;
    // #include <java.io.h>
    public class Main
        //in Java, everything is encapsulated in2 classes, not functions
        public Main()
        //creates a Main() object
        public static void main(String[] args)
            System.out.println("Hi");
        //is our main function (method)
    }

  • How to make .jar files executable by double clicking

    hi,
    I've been trying to make my .jar file created via ANT Tool executable by double clicking it but I'm not being successfull. I looked at the ANT Tool for making manifest.mf and I included most of the attributes listed there and later found that Main-Class attribute is required but its not mentioned in the documentation.
    So, I'll be very greatful to receive any suggestions
    regards,
    Jay

    ya I've been doing things the same way mentioned there but it isn't working. here is the code for it:
    //All the .class files are in the build directory and the class files are under the package org.home.proj.
    <!-- For making .jar files -->
    <target name="jar" depends="compile" description="Makes CyberStation.jar from the CyberStation code.">
        <mkdir dir="${bin}" />
        <jar jarfile="${bin}/CyberStation.jar" basedir="${build}">
          <exclude name="**/run.bat" />
            <manifest>
           <attribute name="Buily-By" value="${user.name}" />
           <attribute name="Main-Class" value="org.home.proj.CyberSoft" />
             <section name="org/home/proj/CyberSoft.class">
               <attribute name="Sealed" value="false" />
             </section>
         </manifest>
        </jar>
      </target>It show the error: Could not find the main class. The program will exit.
    regards,
    Jay

  • Jar file not working  - sometimes?

    I have a jar file with the following Manifest file:
    Manifest-Version: 1.0
    Ant-Version: Apache Ant 1.6.5
    Created-By: 1.6.0_02-b06 (Sun Microsystems Inc.)
    Main-Class: windows.ItemCreatorUI
    Class-Path: lib/AbsoluteLayout.jar
    X-COMMENT: Main-Class will be added automatically by build
    The class under the Main-Class header has a main method in it, and the jar file is executable on the six computers I have tested and had others test. However, two of my users have reported a "Can not find main method, the program will now exit" error and subsequent crash. They are using a copy of the file downloaded directly from my personal ftp, so I'm fairly certain that it's something on their end. Further, they have sent me the file that they downloaded and I was able to run it without fail.
    Does anybody have any experience with this sort of problem, and know a fix? Both users have the most current version of Java (in fact, one of them updated to the latest version while I was working with him).
    Thanks in advance

    There is one more thing to test
    I suppose it is a windows machine
    open My computer>> from the title bar select
    Tools>>Folder options
    select "file types" tab
    select JAR file
    Click advanced
    In the Actions column there will be an option open
    slect open and Click edit
    in the column Application used to perform Action
    you have the below text
    "C:\j2sdk1.4.2_04\bin\javaw.exe" -jar "%1" %*
    *chang the javainstalation directory according to youe machine                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Executable jar does not execute !!

    Dear all,
    i am having a bunch of classes i create a jar out of them
    now
    when i attempt to run this jar in another machine i found the following prblames
    1. i get the error related to "mian does not exist"
    2. in another machine it ask me extract the jar file (i think coz win rar is installed)
    while in fact that jar file cotains a main class and i want to execute that jar file when ever some one click on that.
    So any one please guide to achieve the solution of my problame.
    thanking you
    ishan

    Your manifest file seems to be wrong.
    give the main class name in your manifest file.
    for example:
    here main class name is NewSearch.java
    and the jar file name is Search.jar.
    the content of manifest file is
    Manifest-Version: 1.0
    Main-Class: NewSearch
    Command: jar cvfm Seach.jar Manifest.mf *.class
    I hope this will help you.

  • Can't open .jar file, nothing happens when I click, MAC OS 10.6.8

    Hello,
    I can't open .jar file, nothing happens when I click on the .jar file.
    I have MAC OS 10.6.8
    The thing it, I have desktop application that I'm building on Netbeans and when I compile and deploy it... it runs from Netbeans folder where I have all the files but copying the .jar on the desktop. It says "The Java JAR file "blablabla.jar" could not be launched check the Console for possible error messages"
    Any idea or solution will be appreciated.
    Thanks in advance
    Charles

    These are Java files.  http://www.java.com/en/ is where you can get the latest Java for your operating system. If your Java files need an older version of Java, there are instructions on the web to downgrade Mac Java, but it is difficult, and poses security issues.

  • Photoshop CS2 will not open to double click in Snow Lepard

    Since loading Snow Leopard I have been unable to open Photoshop files with a double click. Double clicking .psd file opens PS with the message "Could not complete your request because Photoshop does not recognize this type of file." Right click "open with" gets the same result. I CAN open files through the file menu in PS. But, files opened via the file menu and saved as... will not open with a double click.
    The "Open with" in the file info window reads "Adobe Photoshop CS2". Even forcing it to open in Preview and then back to PS CS2, sort of like hitting it with a hammer, does not improve the situation.
    CS2 on and year old dual quad.
    Before you knee jerk a "CS2, what did you expect..." CS2 seems to work fine once open. And I have access to another brand new iMac 24" with CS2 and Snow Leopard that does not have this problem, files open with a double click.
    On my troubled machine the thousands of files in question opened yesterday, pre Snow Leopard. I have found a few PS files that are several years old that do open to a double click.
    Thoughts?

    In a partial answer to my own question...
    I have discovered that the Adobe CS2 files (as well as Illustrator CS2, Microsoft Office X, Silo, etc.) will open with a double click in some cases.
    Files on my main hard drive (Mac pro dual quad with four one terabyte hard drives, Snow Leopard 10.6.1) is a RAID made up of two of the internal terabyte hard drives will not open with a double clip. (They do open via the file menu in the given program).
    But files on non-RAID drives open with a double click as expected.
    It appears that the RAID drive (Apple software RAID) is the culprit.
    It is likely that a simple fix from Apple in the operating system to correct the opening of files with a double click from an Apple sotware RAID drive would solve the problem as the various programs all work fine otherwise with Snow Leopard 10.6.1.

  • How can i run a jar file as EXE on mouse click..

    *{color:#0000ff}how can i run a jar file as EXE on mouse click..is it possible in any way?????????{color}*

    amrit_j2ee wrote:
    *{color:#0000ff}how can i run a jar file as EXE on mouse click..is it possible in any way?????????{color}*Do you mean converting it from a jar file to an EXE file or do you mean that you would like to run the application by just double clicking it?
    If it's the latter then you need to make the jar file including a manifest.
    The manifest can be just a txt file with its content to be something like this:
    Manifest-Version: 1.0
    Ant-Version: Apache Ant 1.7.1
    Created-By: Somebody
    Main-Class: NameOfTheMainClass
    Class-Path:
    X-COMMENT: Main-Class will be added automatically by buildTo make the jar file including the manifest, use something like this in your command prompt (of course you must have compiled your java file(s) first):
    jar cfm test.jar MANIFEST.txt NameOfTheMainClass.classAfter that you'd be able to run your application just by double clicking it.
    If you're a NetBeans user, you can build your standalone application by right-clicking your project and then going to properties => run => and choosing a Main class. After that right click on that project and "Clean and Build", locate the jar file in the "dist" folder and double click it =]
    Hope it helps,
    LD

  • Photos in my iPhoto library will not enlarge when double clicked on.  they fill the screen and then screen goes black.  hasn't happened before.  thanks--

    photos in my iPhoto library will not enlarge when double clicked on.  they fill the screen for a second (or less) and then screen goes black.  hasn't happened before.  thanks--

    There are several possible causes for the Black Screen issue
    1. Permissions in the Library: Back Up and try rebuild the library: hold down the command and option (or alt) keys while launching iPhoto. Use the resulting dialogue to rebuild. Include the option to check and repair permissions.
    2. Minor Database corruption: Back Up and try rebuild the library: hold down the command and option (or alt) keys while launching iPhoto. Use the resulting dialogue to rebuild.
    3. A Damaged Photo: Select one of the affected photos in the iPhoto Window and right click on it. From the resulting menu select 'Show File (or 'Show Original File' if that's available). (On iPhoto 11 this option is under the File -> Reveal in Finder.) Will the file open in Preview? If not then the file is damaged. Time to restore from your back up.
    4. A corrupted iPhoto Cache: Trash the com.apple.iPhoto folder from HD/Users/Your Name/ Library/ Caches...
    5. A corrupted preference file: Trash the com.apple.iPhoto.plist file from the HD/Users/ Your Name / library / preferences folder. (Remember you'll need to reset your User options afterwards. These include minor settings like the window colour and so on. Note: If you've moved your library you'll need to point iPhoto at it again.)
    If none of these help: As a Test:
    Hold down the option (or alt) key key and launch iPhoto. From the resulting menu select 'Create Library'
    Import a few pics into this new, blank library. Is the Problem repeated there?

  • Scheduling Jar files to execute

    Hey Everyone!
    Help Please!
    Im needing to schedule one of my jar files to execute late at night,when no one is around! The jar file works perfectly, but when scheduled does not run,I have tried using various schedulers and none of them execute the jar file at the scheduled time, it doesnt even start up the JRE,it just gives an error msg that it could not start!I have tried with various jar files and various schedulers!
    I dont want to use Java's timer, I want to be able to schedule it using something like win98 scheduler!So that my clients can schedule it for anytime they want to,at that level of ease!And I dont want a thread running in the background 24-7!
    Is this a bug in java,or am i missing out on something here???
    Thanks guys!
    Justin

    I schedule all my java *.jar program through a batch file. For example, if you have a program HelloWorld.jar in c:\test directory. I would create a HelloWorld.bat file such as:
    c:
    cd c:\test
    java -jar HelloWorld.jar
    exit
    Then, I will schedule my HelloWorld.bat to run at anytime I like.
    This works for me on all my scheduled java progarms.

Maybe you are looking for