Results 1 to 7 of 7
  1. #1
    Manfizy's Avatar
    Manfizy is offline Senior Member
    Join Date
    Nov 2008
    Location
    Germany
    Posts
    193
    Rep Power
    6

    Post Problem Jar executable files

    Hi pple,
    I have created a GUI project using Netbeans IDE and now i want to distribute my program. Netbeans creates the jar file automatically in the dist folder
    When i double click the jar file, my program should start but i get an error for java vietual machine launcher "Could not find main class and the program will exit"What could be the problem with my jar file??

    Cheerz!!
    We Learn Through Mistakes..,
    Manfizy:rolleyes:

  2. #2
    makpandian's Avatar
    makpandian is offline Senior Member
    Join Date
    Dec 2008
    Location
    Chennai
    Posts
    450
    Rep Power
    6

    Default

    There is no problem in your JVM and JAR file.While you build your project you would have mentioned invalid main class,i think.
    So open your project and configure properties and then build it.
    you will solve the problem certainly..
    Mak
    (Living @ Virtual World)

  3. #3
    PhHein's Avatar
    PhHein is offline Senior Member
    Join Date
    Apr 2009
    Location
    Germany
    Posts
    1,430
    Rep Power
    7

    Default

    Rubbish!

    @Manfizy: You have to specify the main class in the manifest file of your jar.
    Have a look at the tutorial: Trail: Deployment (The Java™ Tutorials)

  4. #4
    Manfizy's Avatar
    Manfizy is offline Senior Member
    Join Date
    Nov 2008
    Location
    Germany
    Posts
    193
    Rep Power
    6

    Post

    On refering to Netbeans GUI tutorial, i realised that on building my program, apart from the jar file in dist folder, a lib folder should also be created alongside the jar file and the manifest file should designate main class and any libraries that are on the projects path.

    In my case, none of the above is done. I dont have the lib folder in PROJECT_HOME/dist folder. Again the manifest file does not have the main class and libraries.
    Is it that my settings are not right because from my understanding all this is supposed to be done automatically in Ntbeans? and if so, how can i change them?

    Best regards,
    manfizy
    We Learn Through Mistakes..,
    Manfizy:rolleyes:

  5. #5
    Manfizy's Avatar
    Manfizy is offline Senior Member
    Join Date
    Nov 2008
    Location
    Germany
    Posts
    193
    Rep Power
    6

    Post

    Now the manifest file has been updated properly but on clicking the jar file i still get the error "main class not found" ans sometimes nothing happens.
    Am so confused now. Anyone who has used netbeans before pls help me on this. I really need to get this program working

    cheerz!
    We Learn Through Mistakes..,
    Manfizy:rolleyes:

  6. #6
    Manfizy's Avatar
    Manfizy is offline Senior Member
    Join Date
    Nov 2008
    Location
    Germany
    Posts
    193
    Rep Power
    6

    Post

    Manifest-Version: 1.0
    Ant-Version: Apache Ant 1.7.1
    Created-By: 11.0-b15 (Sun Microsystems Inc.)
    Main-Class: XenonConcUI
    Class-Path: lib/appframework-1.0.3.jar lib/swing-worker-1.1.jar lib/jf
    reechart-1.0.12.jar lib/jcommon-1.0.15.jar lib/AbsoluteLayout.jar lib
    /class
    Thats the content of the mynifest file

    Though it could help in trying to figure out the problem

    cheerz
    We Learn Through Mistakes..,
    Manfizy:rolleyes:

  7. #7
    Join Date
    Aug 2009
    Posts
    21
    Rep Power
    0

    Default

    other system may not have java
    so just past the jdk in new folder
    and paste the lib(which is in the dist)
    and paste the jar file
    and write code for bat file of windows and sh file linux
    it will run
    :) javadeveloper

Similar Threads

  1. Packaging all files into a single executable .jar
    By ichwar in forum New To Java
    Replies: 5
    Last Post: 01-27-2010, 02:31 AM
  2. problem communication between 2 files
    By Questionmark in forum AWT / Swing
    Replies: 6
    Last Post: 07-30-2009, 12:23 PM
  3. About Executable JAR files
    By paluee in forum New To Java
    Replies: 4
    Last Post: 03-31-2009, 08:03 PM
  4. executable files
    By akinpam in forum Advanced Java
    Replies: 10
    Last Post: 01-06-2009, 05:01 AM
  5. Problem with executing .jar files
    By hiranya in forum NetBeans
    Replies: 2
    Last Post: 10-02-2007, 08:24 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •