Results 1 to 5 of 5
  1. #1
    paluee is offline Member
    Join Date
    Mar 2009
    Posts
    8
    Rep Power
    0

    Question About Executable JAR files

    Hello,
    I am trying to understand executable JAR files.
    I seem to be finding conflicting information.

    One person tells me that when one creates an executable JAR file
    it must be executed via command line, for example by Batch file(.bat) in windows.
    But then I have downloaded example JAR files that when I double click it
    executes like a regular windows .exe file.

    Then what I found was : "If a java application is GUI based then the executable JAR file can be double clicked to activate the program".

    BUT then I got another sample java program and it was GUI based
    but the executable JAR file could not be clicked to run it , one had
    to double click the Batch file that was included to run it.

    SO I am getting conflicting results here.

    My only conclusion is that there must be some kind of parameter setting
    that may need to be set when creating the Executable JAR file.

    Really appreciate it if somebody can clear up this confusion.

    Sincerely,

    Paluee

  2. #2
    angryboy's Avatar
    angryboy is offline Senior Member
    Join Date
    Jan 2009
    Posts
    742
    Rep Power
    6

    Default

    "If a java application is GUI based then the executable JAR file can be double clicked to activate the program".
    that's correct.

    My only conclusion is that there must be some kind of parameter setting
    that may need to be set when creating the Executable JAR file.
    no... please post the batch file.
    USE CODE TAGS--> [CODE]...[/CODE]
    Get NotePad++ (free)

  3. #3
    paluee is offline Member
    Join Date
    Mar 2009
    Posts
    8
    Rep Power
    0

    Default more on executable JAR files

    Hello,
    Thanks for your response, but I think I just found something.

    It does have to do with JAR file creation it seems, it has something to do with
    this thing called the Manifest file.

    See this link below:

    ****java.ittoolbox.com/documents/executable-jar-files-18780****

    ************************************************** ****

    When we see properties of any jar file it says its type as executable jar file. But it doesn't mean all jar files can be executed by double clicking.

    But jar files can be made so that they can execute on double clicking.
    For this jar file must have a class with
    public static void main(String a[])
    function and a manifest file declaring main class name present in jar file command is
    jar -cmf manifest.mf exefile.jar *.class
    manifest file should have
    Jar-Version: 1.0
    Main-Class: MainClassNameWithoutExtension

    There should be at least 1 blank line after above entry.
    ************************************************** ***

    So can you explain this explanation.

    Paluee

  4. #4
    angryboy's Avatar
    angryboy is offline Senior Member
    Join Date
    Jan 2009
    Posts
    742
    Rep Power
    6

    Default

    thats the rule for all jar, doesn't matter if its console or gui.

    but that still doesn't explain why it only opens with a batch and not double-click. Unless... that jar file you had was not properly made.
    USE CODE TAGS--> [CODE]...[/CODE]
    Get NotePad++ (free)

  5. #5
    logicbug's Avatar
    logicbug is offline Member
    Join Date
    Jan 2009
    Location
    The Great White North, eh?
    Posts
    76
    Rep Power
    0

    Default

    Could be the jar file itself has other jar files in it and it uses the bat file to set the class path instead of doing it in the code.

Similar Threads

  1. Executable java project ..
    By xVent in forum Java Applets
    Replies: 5
    Last Post: 03-29-2009, 07:46 PM
  2. executable files
    By akinpam in forum Advanced Java
    Replies: 10
    Last Post: 01-06-2009, 05:01 AM
  3. executable
    By smooth in forum New To Java
    Replies: 4
    Last Post: 06-14-2008, 06:12 PM
  4. Executable Java
    By eva in forum New To Java
    Replies: 3
    Last Post: 12-31-2007, 12:38 AM
  5. Executable JAR
    By bugger in forum New To Java
    Replies: 4
    Last Post: 12-05-2007, 06:41 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
  •