Running Java aplication in Windows

Once you've finished a Java application, what does another user need to run it under Windows? How do you get the app installed and run-clickable? I know this must sound like a daft question, but I just done get it!

Any one got the answer, please?
afterburnerAsked:
Who is Participating?
 
CEHJCommented:
Yes, you are, and it comes from Sun at http://java.sun.com. This site's getting messy to navigate, but look for the JRE
0
 
Peter KwanAnalyst ProgrammerCommented:
A simple way is that you may try to package your Java application into exe using Java2exe.

Java2exe:
http://www.duckware.com/java2exe/index.html

I have not tried it out. Please have a try on it, and tell us if this works.
0
 
CEHJCommented:
Or just create a Windows shortcut where the command is something like:
C:\jdk1.4\bin\java.exe c:\Main
You may need to put in the classpath as a parameter before the main class
0
Introducing Cloud Class® training courses

Tech changes fast. You can learn faster. That’s why we’re bringing professional training courses to Experts Exchange. With a subscription, you can access all the Cloud Class® courses to expand your education, prep for certifications, and get top-notch instructions.

 
nebekerCommented:
If you use one of the commerical Installers available, they will do this automatically for you (i.e. create a custom launcher program)...

I've used InstallAnywhere by ZeroG software (http://www.zerog.com) and have been quite pleased with the results.  If you have a very simple application, their InstallAnywhere NOW! product is absolutely free, and will handle all of the basic installer needs.
0
 
objectsCommented:
Converting to an exe may suit your needs but it does have limitations.

Another possibility is to create an executable jar. When the jre is installed it generally sets up a file association under Windoze for starting an executable jar.
An executable jar is simply a jar file, with the name of the main class specified in the Manifest using the Main-Class attribute. It can then be started without knowledge of the main class name.


0
 
afterburnerAuthor Commented:
CEHJ

I dont get the C:\Main thing.

Suppose my class is called X, on C:, then would I need ..

C:\DirContainingJava.exe\java.exe c:\X.Main()

or what?

Thanks.
0
 
CEHJCommented:
Sorry about that. A bit of a slip on my part. Give me the following and I'll supply the text for the shortcut:

1. Path to java.exe
2. Path to your class
3. Name of your class

I can assure you shortcuts are perfectly workable. You can even add you own custom Java icon!

0
 
afterburnerAuthor Commented:
CEHJ

I have several java.exes on the machine it appears. However, I reckon I could handle that; so say the path is C:\MyJavaExeDir, and the class is called myClass and is in C:\MyClassDir.
0
 
afterburnerAuthor Commented:
CEHJ

I have several java.exes on the machine it appears. However, I reckon I could handle that; so say the path is C:\MyJavaExeDir, and the class is called myClass and is in C:\MyClassDir.
0
 
CEHJCommented:
Well there's no mystery here, but test it at the command line first - if it doesn't work from there, it sure as hell won't inside the shortcut!

C:\MyJavaExeDir\java.exe -classpath %CLASSPATH%;C:\MyClassDir myClass

Left-click the desktop
New | Shortcut
Paste in the command line

You might find you can shorten -classpath to -cp. I do!
0
 
objectsCommented:
If you create an executable jar, then you can simple d-click on that file, you do not need to create a shortcut.
0
 
afterburnerAuthor Commented:
I am now confused as to what exactly the difference is between java.exe and javaw.exe. They both seem to do the same thing.

How do you ever know that another computer can run your java app (not aplet) anyway? What does another PC need on it to run my app?
0
 
CEHJCommented:
objects is almost certainly right, but I've never created an executable jar file.

The difference between javaw.exe and java.exe is that the former does not have a console window.

Any machine that has the runtime environment will be able to run it. Look for the executable called 'java' (java.exe on Windows, java on Unix)
0
 
afterburnerAuthor Commented:
Before I close this question, can I ask then if someone does not have java on their machine, do you just copy the java executable over to them? Do they need any other supporting files?
0
 
CEHJCommented:
No, it's not quite as simple as copying java.exe over. You must *install* the JRE (Java Runtime Environment)
0
 
nebekerCommented:
You would need the entire runtime (JRE) environment.  Just the java.exe won't work, because you also need the supporting native libraries (dll's) and runtime jar files.
0
 
CEHJCommented:
No, it's not quite as simple as copying java.exe over. You must *install* the JRE (Java Runtime Environment)
0
 
afterburnerAuthor Commented:
And am I permitted to supply a third party with all the files etc needed for that, and where does it all come from?
0
 
afterburnerAuthor Commented:
You've all been greeeeeeeeat.
aftrbrnr.
0
 
afterburnerAuthor Commented:
Much appreciated.
0
 
nebekerCommented:
The JRE is freely distributable with your Java application.   For applets, the Java plugin is freely available...

The JDK/SDK is not freely distributable....
0
 
afterburnerAuthor Commented:
Right.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.