• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to install Java JAR program on computer

 
john price
Ranch Hand
Posts: 495
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How do you install a Java JAR program on a computer? I guess my real question is what is installation of a program? Would the advantage be a steady place for the program/application to sit? The end result of this is to make a program show up in the "Installed programs" section of an OS.
Thanks,
cc11rocks aka John Price
 
Stephan van Hulst
Bartender
Pie
Posts: 5594
55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The simplest form of installation is simply letting the user put the JAR where they want it, and executing it directly. They can also put it in a folder and make a shortcut to it elsewhere. You can also write a program that does this for them.

Installation can also be as complex as an installer that checks whether a JRE is installed, and if not, giving the user the option to download and install one first, either globally, or a separate JRE just for your application. It all depends on what you want.

Personally I think install4j is a great tool that generates executables that will install your program, provide an uninstaller and make a program entry, and even download or pre-package a JRE in case the user doesn't have Java installed. It's not free though.
 
john price
Ranch Hand
Posts: 495
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there a Java properties such as like "System.getProperty(path.installation)" or something?
In Windows, it is generally "C:\Program Files". Is there a way to get this (and still be OS independent)?
Thanks,
cc11rocks aka John Price
 
Rob Spoor
Sheriff
Pie
Posts: 20512
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Unfortunately not. There is no official way to get the location where a JAR file or class file is located. There are some tricks (search for my posts in this forum, but they're probably quite old already) that are not guaranteed to work.
 
john price
Ranch Hand
Posts: 495
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That is not what I was asking. I was asking if you could find where the other programs were installed. If you installed OpenOffice for example, it would be installed in the "Program Files" (Windows) section. Is there a way to find the "Program Files" folder?
Thanks,
cc11rocks aka John Price
 
Paul Clapham
Sheriff
Posts: 20983
31
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You seem to be asking how to write a Windows installer for a Java application.

The techniques for writing Windows installers are well known -- in the Windows world, that is. It isn't a Java question at all. And in the Windows world, people rarely write their own installers. Instead they use one of the well-known commercial installers. So I would go along with Stephan's suggestion of using a well-known Java installer instead of doing it yourself.

Another alternative is to use Java Web Start, which allows people to download and run your application directly from your web site. If set up correctly it also takes care of ensuring that a compatible JRE is available and so on.
 
john price
Ranch Hand
Posts: 495
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am asking how to write an installer for any operating system. I realize with your comments that it is very hard to do (or not worth my time), so I'll just close this. Thanks!
cc11rocks aka John Price
 
Rob Spoor
Sheriff
Pie
Posts: 20512
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's the thing - each OS has different ways of installing applications. Windows usually uses C:\Program Files but this can be different; the drive can be different, and on 64-bit systems there is C:\Program Files (x86) next to C:\Program Files. Linux has different ways for installing; Ubuntu uses Synaptic, Debian uses apt / dselect, RedHat and Fedora Core use RPM, and all of them also support compiling from source. Mac OSX has its own installation mechanism which I don't know.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic