#1
  1. No Profile Picture
    Permanently Banned
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2013
    Posts
    257
    Rep Power
    0

    How to create a JAR file?


    Please give me a specific answer.
  2. #2
  3. Contributing User
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Aug 2010
    Location
    Eastern Florida
    Posts
    3,713
    Rep Power
    348
    Use the jar command that comes with the JDK.

    Here is a Windows batch file I use to create a jar file:
    Code:
    Rem           Create the ExtractBoards.jar file:
    @REM
    set JarName=%DEV_HOME%\JavaDevelopment\Misc_Projects\GetHandsFromFiles\ExtractBoards.jar
    %DEV_DRIVE%
    cd %DEV_HOME%\JavaDevelopment\Misc_Projects\GetHandsFromFiles
    D:\Java\jdk1.7.0.7\bin\jar -cmf ExtractBoards.mnf %JarName% *.class
    Echo ----- Created %JarName% -----
    More
    and the ExtractBoards.mnf file:
    Code:
    Main-Class: ExtractBoardsGUI
    %DEV_DRIVE% is an environment variable with the address of a disk drive. For example: D:
  4. #3
  5. No Profile Picture
    Permanently Banned
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2013
    Posts
    257
    Rep Power
    0
    Java said that the file is automatically compiled, how to locate the jar file? can I change it to an exe file? How?
  6. #4
  7. Contributing User
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Aug 2010
    Location
    Eastern Florida
    Posts
    3,713
    Rep Power
    348
    Java said that the file is automatically compiled, how to locate the jar file? can I change it to an exe file?
    What version of Java are you using? I have never seen it print out a message like that.
    The java command does not create jar files. jar files are created by the jar command.

    There are third party programs that will create exe files from jar files. I have never used them. I always execute my jar files using the java command with the -jar option.
  8. #5
  9. No Profile Picture
    Permanently Banned
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2013
    Posts
    257
    Rep Power
    0
    Can you give me any examples?
  10. #6
  11. Contributing User
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Aug 2010
    Location
    Eastern Florida
    Posts
    3,713
    Rep Power
    348
    Post #2 has the contents of a windows batch file that uses the jar command.
  12. #7
  13. No Profile Picture
    Permanently Banned
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2013
    Posts
    257
    Rep Power
    0
    Originally Posted by NormR
    Post #2 has the contents of a windows batch file that uses the jar command.
    I mean the third party software that can convert java files to exe files.
  14. #8
  15. Contributing User
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Aug 2010
    Location
    Eastern Florida
    Posts
    3,713
    Rep Power
    348
    third party software that can convert java files to exe files.
    I don't know any. I never have done it.

IMN logo majestic logo threadwatch logo seochat tools logo