• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Java executable

 
Greenhorn
Posts: 23
Netbeans IDE Ubuntu Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
author
Posts: 23951
142
jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux Windows
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 57
Python Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Bartender
Posts: 5167
11
Netbeans IDE Opera Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Netbeans IDE Ubuntu Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 119
Oracle Opera Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
set your class path and the path to the jar through a .cmd file in windows
 
Marshal
Posts: 79151
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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".
 
Ranch Hand
Posts: 637
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 5167
11
Netbeans IDE Opera Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic