I have implemented a software by Java. I want to make the software user friendly and as simple as possible.
Can I make my Java code into an application that the users do not have to install Java in their computer?
Printable View
I have implemented a software by Java. I want to make the software user friendly and as simple as possible.
Can I make my Java code into an application that the users do not have to install Java in their computer?
bad news - no, you cannot. good news - everybody already has Java anyway.
Every one already has the JRE installed (well not every body, but 95%+ of the people, and the 5% that don't eather have computers so old that it can not run it, or removed it for reasons of their own, but the poeple you are focusing I would say 99.999% of them probably do have the JRE installed)
So all they will need to run your program is the class files or the jar file (if you put all your code in a jar file, and I recomend you do)
All you really need to do is put all in a jar file.
Many thanks to all of you! Special thanks to Drun!
My software imports a jar file for an external package.
How can I make my java code as a jar file with such a "imported" jar file?
Many thanks in advance!
There are 2 ways I can think of. 1) include the jar file with your jar file and make sure you set up the class path when your program is ran. 2) (not 100% sure how to do this but I seen it done) unpack the other jar file, and pack the class files from inside of that jar file (a jar file is nothing more then a zip file with a few special directories and files inside of it) into your jar file.
It is possible to write code in Java and deploy it to machines that don't have a JRE installed -- but it's a particular subset of Java compiled into JavaScript by Google Web Toolkit and deployed to web browsers.
Google Web Toolkit - Google Code
I do not mean to suggest that this is a viable replacement for real Java. But depending on what it is, how it's designed, and how much Java it uses, it may be a possibility.
-Gary-
I think my question is a common concern for software developers. I want the users to make a simple click and then he/she can start the journey of using my soft.
If I make a jar file then the user need either:
1) Go to DOS and specify the class path
2) Go to eclipse and create the project.
I think 2) is easier but not everyone has Eclipse.
As a practical matter, it's very unusual today for a piece of software not to have some sort of runtime requirement. More and more Windows software is based on the .NET runtime, and for many years before that there were Visual Basic runtimes and MFC dependencies and library dependencies people spoke of as ".DLL hell". And other platforms have their dependencies as well.
-Gary-
Thanks for your advises!
Can anyone tells me which option is better for the users to run the Java Software?
1. Use DOS Command to run the Jar file (I think users have to specify the class path)
2. Use Eclipse to run the Jar file
1.) Works only on computers that have DOS.
2.) Eclipse is a development kit used by developers. Why would users need to install Eclipse to be able to run your program if they already have the JRE?
Better get Oracle's tutorial on jar files and deployment and read it.
Users can use DOS to run the .jar file. But it is complicated for them to specify the class path, isn't it?
You would have to create the .bat file for them.
Much better is to read the tutorial I suggested so that you can create an executable jar than can be used on different platforms as long as they have the JRE.
If you've built your jar file correctly (ie with the correct Manifest in it) the user should simply be able to double click on the jar and run it. If you have dependencies on thrid party jars then you package them with your jar. Netbeans creates a directoty structure something like:
and the Manifest refers to the jars in the lib directory.Code:dist -> MyJar.jar
lib -> other libs
Can anyone tell me how to make the jar file and how to specify the class path when the users just want to use it?
Your help will be very much appreciated!
Between that and my little diagram of a distribution structure you should be able to write this yourself.
A bit of an example; here's a manifest file I use:
Add this as your manifest in your .jar file (after supplying the necessary information) and you can simply double click on the .jar to run it.Code:Manifest-Version: 1.0
Created-By: my company
Main-Class: MyMainClass
Class-Path: relative/path/to/other/files.jar
Built-By: my company
Name: Name Of This Application
Specification-Title: Title Of This Application
Specification-Version: 1.0
Specification-Vendor: my company
Implementation-Title: Title Of This Application
Implementation-Version: 1.0
Implementation-Vendor: my company
kind regards,
Jos