Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Packaging a Swing application as exe

 
Santosh Raveendran
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Team

i have developed a small swing application using netbean5.5.1 IDE and it working fine , i have used the package option under build to package the application, i found that my GUI jar executes only if its inside the project folder ,
i want to package my entire application as a executable file and want to install it in my machne , can any one advice on this
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
not a 'Swing' problem, better off putting your question to a Netbeans forum
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
By "executable file", do you mean double-clickable? If so, then jar files can do that. If the application relies on other libraries, then you'll need to adapt the jar file manifest accordingly; see http://faq.javaranch.com/java/JarFiles for more detail.
 
Santosh Raveendran
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ulf,

Thanks for the response ,let me explain my requirement currently if i check my project directory which i got as i

explained above , i have a directory created by the name dist and it contains a directory lib and my GUI jar

Processor.jar , when i am viewing the MANIFEST.MF inside META-INF of my Processor.jar it has referenced the

springlayout.jar available in the lib folder , i want to create the entire thing either as a jar or exe file which can be

installed in a windows machine, please advice.

 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If the Class-Path entry in the manifest file simply refers to "springlayout.jar" (without any directory), then you can simply put both jar files in the same directory and they will work. Is it of vital importance that only a single file is distributed? You could distribute a ZIP file that extracts to a directory containing all the required files; that's a common method of distribution.

You could also re-package all required class files into a single jar file for distribution.
 
Santosh Raveendran
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ulf,


is there any way we can install this jar so that it will come under programs in a windows machine
 
eric aro
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
for small programs, using maven, (or by hand) you can package all your classes, and all dependencies classes into a single jar.

then you use launch4j with the option "embed jar", and you'll get an independent exe, that works right out of the box.

This solution is nice, but not scalable for big programs (with megas of dependencies )

 
Rob Spoor
Sheriff
Pie
Posts: 20531
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Michael Dunn wrote:not a 'Swing' problem, better off putting your question to a Netbeans forum

I half agree. This is not a Swing problem, but I think Java in General is a better problem since creating EXE or JAR files is not IDE specific.
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
is there any way we can install this jar so that it will come under programs in a windows machine

That's just a directory like any other; what difficulty are you facing putting the file there?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic