2

Possible Duplicate:
Export JAR with Netbeans

I have created a NetBeans Project and now I want to create a package from the project. As this is my first project in NetBeans. Can any one help me to create a package from my project for distribution?

Community
  • 1
  • 1
Anu
  • 1,844
  • 13
  • 30
  • 1
    `clean and build` will do the job...executables will be inside dist folder – Vineet Menon Apr 26 '12 at 06:47
  • is it possible to create a .exe file? or to make the dist filder itsel an executable file? – Anu Apr 26 '12 at 06:53
  • @anu:dist folder will contain the jar file for project, since I assume you are using java as language, from the tagging.. jar's are the executable for java... – Vineet Menon Apr 26 '12 at 06:55
  • ok.. can I give my own icon image to the executable file? – Anu Apr 26 '12 at 07:05
  • While it is possible to cram and x-platform Jar into a `.exe`, but that doesn't make it a good idea. – Andrew Thompson Apr 26 '12 at 07:06
  • @Anu, yes icon can be set in Swing framework GUIs. using Frame.seticonimage method http://docs.oracle.com/javase/1.3/docs/api/java/awt/Frame.html#setIconImage%28java.awt.Image%29.....Before doing that it's suggested that you try a tutorial for GUI development in Java, It will be helpful – Vineet Menon Apr 26 '12 at 07:09

3 Answers3

1

Expanding on the question for the .exe:

I have good experience using Winrun4J to generate an exe launcher for my Java applications. It's quite forward to setup and generate and it supports 32 and 64 bit Windows.

You can even put all needed jars into the exe.

http://winrun4j.sourceforge.net/

But (as you seem to be new to Java): the exe is only a wrapper. It still requires a Java Runtime to be installed on the system where you start the exe!

a_horse_with_no_name
  • 440,273
  • 77
  • 685
  • 758
  • *"It .. requires a Java Runtime"* As does JWS. The [`deployJava.js`](http://docs.oracle.com/javase/7/docs/technotes/guides/jweb/deployment_advice.html#deplToolkit) checks the user has the required minimum version (helps them to install it, if not), before running an applet or providing a link to a JWS app. Though I have not tried it, it seems it should be possible to replace the `OurApp.jnlp` HREF with one pointing to a `OurApp.exe`, though it would make more sense to link to an `OurAppInstaller.jnlp` that could kick off the EXE, or the equivalent for OS X etc. (and partition the download). – Andrew Thompson Apr 26 '12 at 08:43
  • @AndrewThompson: I know. But very often when people talk about "exe creation" they implictly expect that the exe is "standalone" and does not require a Java Runtime. I just wanted to make that clear to Anu – a_horse_with_no_name Apr 26 '12 at 09:39
  • (in relation to Java apps) *"..very often when people talk about "exe creation".."* ..they are very inexperienced, and generally confused. ;) All good clarification. :) – Andrew Thompson Apr 26 '12 at 09:43
0

If you want to code desktop apps. that will run on Windows, OS X & *nix, write them in Java & deploy them from a link using Java Web Start.

JWS provides many appealing features including, but not limited to, splash screens, desktop integration, file associations, automatic update (including lazy downloads and programmatic control of updates), partitioning of natives & other resource downloads by platform, architecture or Java version, configuration of run-time environment (minimum J2SE version, run-time options, RAM etc.), easy management of common resources using extensions..

I high-lit the part that is relevant to your next comment.

can I give my own icon image to the executable file?

Why should the user ever see a .jar (or a .exe for that matter)? JWS offers desptop integration, which might consist of a desktop shortcut and/or menu item on supported OS'. Either of those can have an image (within limitations) as supplied by you.


The deployJava.js script checks the user has the required minimum version (helps them to install it, if not), before running an applet or providing a link to a JWS app.

Community
  • 1
  • 1
Andrew Thompson
  • 163,965
  • 36
  • 203
  • 405
  • IMHO, in that case http://www.javadesktop.org/articles/jdic/index.html is better than JWS – Vineet Menon Apr 26 '12 at 07:28
  • @VineetMenon IMO JDIC is dead. Links on that page pointing to [JDIC Home Page](https://jdic.dev.java.net/) result in 404. The page mentions 'screensavers' - WTF?!? The last Java based project on screen savers that I worked with, was SaverBeans. It is now gone & largely forgotten, but only ever worked on Windows & *nix. Is your opinion based on experience with JDIC, or the blurb? – Andrew Thompson Apr 26 '12 at 07:54
  • I tried to do some programming in JDIC mainly for status icon in windows and linux, but that was a few months ago.. – Vineet Menon Apr 26 '12 at 08:36
0
  1. If you have several project in development environment, make sure you have set the project you want to distribute as a main project. It can be done via mouse right click menu on project name in the left pane.
  2. Click on menu: "Run -> Clean and build main project"
  3. Inspect your project folder, find folder dist in your project folder. There is *.jar file. It is packaged compiled project file.