Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Executable File  RSS feed

 
Rocky Summers
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Just curious: how can I make a java project an executable file? is there any way to do this... this is for Swing programs btw...
Rockster
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There are some products which make executable files from Java, but there are problems using some APIs (especially Swing) with some of them, and in general, it's a bad idea because you are breaking the WORA (Write Once, Run Anywhere) that Java was built around.

Depending on what you want to do, you can get comparable results from either -
  • making system dependent shell scripts (Unix/Linux/BSD scripts, Windows bat files) to just call "javaw program options" (the "javaw" command is just like "java" but it doesn't launch an additional command line window.)
  • making an executable JAR file. (link here) Most OSes will understand what to do when you click on an executable JAR file and will run it correctly.


  • With either of these solutions you can make desktop icons, shortcuts, etc.

    (NEP - added additonal "javaw" tip. )
    [ February 24, 2004: Message edited by: Nathan Pruett ]
     
    Peyton McCullough
    Ranch Hand
    Posts: 31
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    If you want to turn it into a '.exe' file, there are a number of utilities out there. Just do a search.
    There was one really good EXE wrapper for JAR files on sourceforge, but I can't remember the name and just whiped Windows yesterday for Mandrake.
     
    Paul Santa Maria
    Ranch Hand
    Posts: 236
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    You might also want to explore Java Web Start:
    http://java.sun.com/products/javawebstart/
    http://java.sun.com/docs/books/tutorial/information/javawebstart.html
    Your .. PSM
     
    It is sorta covered in the JavaRanch Style Guide.
    • Post Reply Bookmark Topic Watch Topic
    • New Topic
    Boost this thread!