• 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

How can I distribute my Java desktop application?

 
Ranch Hand
Posts: 3852
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How can I distribute my Java desktop application?
I mean, say I have an application built in Java, contains some Java classes. I compiled all the classes, created .bat file to run it on a click of mouse.

The bat file will have something like: java com.ankur.MyAppStarter

Now it works on my system because I have JDK's bin folder in my PATH variable.

What if other people doesn't have JDK's bin folder in their PATH? Or worst if they don't have JVM (JRE) on their system?
Shall I distribute JRE with my application (and then I set PATH first before running my application)?

Any suggestions appreciated.

Thanks.





 
author
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Check out some of the *.bat files that come with other Java software to see how they handle these situations. As an example, check the script after the ":checkJava" label in Ant's ant.bat file. You'll notice that is depends on the JAVA_HOME env var being set.
 
Saloon Keeper
Posts: 27752
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Actually, one of the easier way to distribute a Java desktop application is to use Java WebStart. In that case, the app and its dependencies get downloaded (and cached) from a webserver. Makes it a lot easier to support and you can ensure users have the latest version.

Alas, since Microsoft's attempt to hijack Java failed, they got snitty and as a result you can't depend on any Java on a Windows machine. Thus, if you're looking for a cold install - including JRE (you don't need the JDK unless you're installing a server) - you'll have to include installation of one. Due to legal requirements, that means invoking Sun's JRE installer as a sub-task of your own install process.
 
ankur rathi
Ranch Hand
Posts: 3852
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Peter Johnson wrote:Check out some of the *.bat files that come with other Java software to see how they handle these situations. As an example, check the script after the ":checkJava" label in Ant's ant.bat file. You'll notice that is depends on the JAVA_HOME env var being set.



Thanks Peter.
I checked ant.bat file. It is assuming that JAVA_HOME variable will be set.

Now I realized that I am looking for something like - it creates a shortcut (exe, bat or whatever) on desktop which can run my program. I don't want user to go into that folder where user stores my application, to run it...


 
Tim Holloway
Saloon Keeper
Posts: 27752
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
JAVA_HOME is a convention used by many Java apps, but it's not an actual language requirement.

For getting desktop icons, however, you will have to use an OS-specific installer. Java only supports universal functions and there's no universal desktop API.
 
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Ankur,

So you want to create a want to create desktop icons or Shortcut icons.

Just check this URL "http://www.jrsoftware.org/isinfo.php"

I have been using the Inno setup to distribute my Java Desktop applications.

It creates your Installer, Creates a desktop icon and also creates uninstaller.

But for those all these things you have to write your Inno script (iss) and then integrate it in your ANt/Maven script which will automatically invoke the Inno setup compiler and creater your setup.exe.

I have been using this software since ages for my Desktop based applications and its good and the main thing its free.

Please check the help file you will get lot of examples.

Thanks and Regards,
AKshat
 
ankur rathi
Ranch Hand
Posts: 3852
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Akshat.

I checked this, looks a bit complex...
I am considering bat file option for now as nowadays windows comes with JRE installed (& java is available in path variable), I suppose. I checked with some of my friends who don't know what Java is? & when they type java on command prompt it ran (shown command usage)...

Thanks again.
 
ankur rathi
Ranch Hand
Posts: 3852
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Tim Holloway wrote:

Alas, since Microsoft's attempt to hijack Java failed, they got snitty and as a result you can't depend on any Java on a Windows machine. Thus, if you're looking for a cold install - including JRE (you don't need the JDK unless you're installing a server) - you'll have to include installation of one. Due to legal requirements, that means invoking Sun's JRE installer as a sub-task of your own install process.



Thanks Tim.
I think we can depend. I am not sure though.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic