| Author |
How to install Java JAR program on computer
|
john price
Ranch Hand
Joined: Feb 24, 2011
Posts: 495
|
|
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
|
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” (Mosher's Law of Software Engineering)
“If debugging is the process of removing bugs, then programming must be the process of putting them in.” (Edsger Dijkstra)
|
 |
Stephan van Hulst
Bartender
Joined: Sep 20, 2010
Posts: 3053
|
|
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
Joined: Feb 24, 2011
Posts: 495
|
|
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
Joined: Oct 27, 2005
Posts: 19216
|
|
|
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.
|
SCJP 1.4 - SCJP 6 - SCWCD 5
How To Ask Questions How To Answer Questions
|
 |
john price
Ranch Hand
Joined: Feb 24, 2011
Posts: 495
|
|
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
Bartender
Joined: Oct 14, 2005
Posts: 16483
|
|
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
Joined: Feb 24, 2011
Posts: 495
|
|
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
Joined: Oct 27, 2005
Posts: 19216
|
|
|
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.
|
 |
 |
|
|
subject: How to install Java JAR program on computer
|
|
|