File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Java executable

 
Kasun Liyanage
Greenhorn
Posts: 23
Java Netbeans IDE Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi!

Is it possible to make a Java executable file from a Netbeans project? i mean, a file which i can double click and run.

Thanks.
 
Henry Wong
author
Marshal
Pie
Posts: 20836
75
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Kasun Liyanage wrote: i mean, a file which i can double click and run.


Most OSes, if configured, will run executable jar files upon a double-click.

Henry
 
Edwin Torres
Ranch Hand
Posts: 55
Eclipse IDE Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes. When you build a Netbeans Java Application, it creates a .jar file. As long as you have the Java Runtime Environment installed on your OS, you can run the .jar file by double-clicking it or running it from the command line: java -jar myapp.jar
 
Darryl Burke
Bartender
Posts: 5116
11
Java Netbeans IDE Opera
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Also, as long as the NetBeans project being built has a main class set, and that class has a public static void main(String[] args) method.
 
Kasun Liyanage
Greenhorn
Posts: 23
Java Netbeans IDE Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the replies! i set the jar as an executable in Ubuntu and used Executer to convert jar file in to an exe in Windows. And it works, thanks.
 
Atul Darne
Ranch Hand
Posts: 118
Java Oracle
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
set your class path and the path to the jar through a .cmd file in windows
 
Campbell Ritchie
Sheriff
Pie
Posts: 47300
52
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Atul Darne wrote:set your class path and the path to the jar through a .cmd file in windows
Is that necessary? As long as the file association for .jar is the same as your javaw runtime, it should work. Note you usually use javaw for executable .jars, not "java".
 
Rahul Sudip Bose
Ranch Hand
Posts: 637
Eclipse IDE Firefox Browser Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Henry Wong wrote:
Kasun Liyanage wrote: i mean, a file which i can double click and run.


Most OSes, if configured, will run executable jar files upon a double-click.

Henry


How to configure an OS to do that, say windows 7 (mine is already configured but fails to open some jars).
 
Darryl Burke
Bartender
Posts: 5116
11
Java Netbeans IDE Opera
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, the jar does have to be an executable jar.
http://download.oracle.com/javase/tutorial/deployment/jar/appman.html
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic