GeeCON Prague 2014*
The moose likes Beginning Java and the fly likes java program and Windows users Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Beginning Java
Bookmark "java program and Windows users" Watch "java program and Windows users" New topic
Author

java program and Windows users

Ivan Witteveen
Greenhorn

Joined: Jun 02, 2008
Posts: 4
I want to distribute a java program to Windows users, with XP or Vista. Say I have a .class file Test.class. Then I will do two things:

1) I'll tell the users to download and install java from www.java.com.

2) I'll supply a .bat file with the Test.class. What is the best command in this file: "java Test" or "start java Test"?

Will this garantee that the program will work for all users?
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42030
    
  64
Instead of messing with a script, package the classes in a jar file that you make double-clickable (by using the Main-Class attribute in the manifest). That will automatically start the JVM and run the main class.


Ping & DNS - my free Android networking tools app
M Brindamour
Greenhorn

Joined: Jul 14, 2008
Posts: 2
It's worth noting, though, that embedding other jars within your jar, and using them from your executable jar is not easy or well supported. If you need to do this, I would suggest looking for another solution. (app packager of some kind)
Andre Brito
Ranch Hand

Joined: Dec 13, 2007
Posts: 95

Ooopz.
The Jars' functions are that, Brindamour.
Ok, sometimes it can get a little hard, but I believe it's the best way.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42030
    
  64
I don't fully understand what Andre is saying, but let's not get sidetracked by jar files. They can easily be incorporated into the application jar file by unjaring/rejaring.
Andre Brito
Ranch Hand

Joined: Dec 13, 2007
Posts: 95

Originally posted by Ulf Dittmer:
I don't fully understand what Andre is saying, but let's not get sidetracked by jar files. They can easily be incorporated into the application jar file by unjaring/rejaring.


That's what I tried to say
Jars rocks (but some people just make their reputation looks like shit because they don't really know how to use them. I'm sorry but I'm a little bad with english :|).
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14193
    
  20

To make installation easy (so that your users don't have to manually download and install a JRE), you could use one of these installer generators to generate an installation program. Some of those in the list can automatically download and install a JRE if the user doesn't have it (or doesn't have the right version for your application).

You could also use Webstart (but your users will need to have Java already installed to use that).
[ July 14, 2008: Message edited by: Jesper Young ]

Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 8 API documentation
 
GeeCON Prague 2014
 
subject: java program and Windows users