-1

I have written a simple little program that opens a JFrame window every time you click a button. Although each time I want to run it I have to go into my IDE(NetBeans) and run it from there. Would I be able to make a .jar thing and it will run like that? How do you make it executable. Should I use a batch or bash file to run it?

ROMANIA_engineer
  • 54,432
  • 29
  • 203
  • 199
Andrew
  • 9
  • 3
  • 1
    See this: http://www.jwrapper.com/ - also this question has been answered many times on this website! Be sure to check and good luck! – Brandon Palmer Oct 04 '14 at 17:05

2 Answers2

3

In Netbeans you can right click on your project in the Project Explorer and then select clean and build.

enter image description here

After that you can find the .jar under dist, which is located in your project folder.

enter image description here

MarGar
  • 465
  • 5
  • 12
0

You're looking to make a jar file. If you're on windows/x whatever graphical interface, you simply run it like any other executable. If not then you can run it from the command line like any other program.

To make a jar from the command line as per the Oracle documentation http://docs.oracle.com/javase/tutorial/deployment/jar/build.html:

jar cf jar-file-name input-file(s)

NetBeans also has an interface to turn your project into a .jar if I recall correctly.

Edit: Yes it does have an interface. A quick search of the site yields: How to create a Jar file in Netbeans

Community
  • 1
  • 1
Charles B.
  • 193
  • 1
  • 7