aspose file tools*
The moose likes Beginning Java and the fly likes How to make distributable copies of my program? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "How to make distributable copies of my program?" Watch "How to make distributable copies of my program?" New topic
Author

How to make distributable copies of my program?

Agnes Lapka
Greenhorn

Joined: Dec 26, 2000
Posts: 23
Hi Everyone!
I wrote a little program in Java and I'd like to give it to a few friends. My question is how do I do it? Since there are no exe files in Java, how would they run my little application? Do they need to install JVM and run it from the command line? That doesn't sound right... Please, give me some ideas...
A.
Junilu Lacar
Bartender

Joined: Feb 26, 2001
Posts: 4757
    
    7

If your friends have browsers that are capable of running applets then you can make your program into an applet then make an html document that contains that applet. Put your html and your .class file on the web somewhere and your friends will be able to see.

Junilu - [How to Ask Questions] [How to Answer Questions]
Conrad Kirby
Ranch Hand

Joined: Jun 17, 2001
Posts: 178
There are various websites to download a Java compiler. It probably wouldn't be too difficult to tell your friends how to run the Java application you made.
Cindy Glass
"The Hood"
Sheriff

Joined: Sep 29, 2000
Posts: 8521
Give your friends a copy of the class files. Tell them exactly what directory that you want them to put the files in.
Make a bat file that has the java commands in it. Include the classpath in the invokation command that names the directory that you told them above.
Almost all machines these days come loaded with java already. Chances are they can just double click the bat file and all will be well.

"JavaRanch, where the deer and the Certified play" - David O'Meara
Agnes Lapka
Greenhorn

Joined: Dec 26, 2000
Posts: 23
Thank you for all your suggestions!
I'm affraid applet wouldn't do, because I'm accessing database from the my application ( I don't think applets can do that, unless I'm wrong...).
Cindy, your answer is exactly what I've been looking for!
Thanks!
A.
Agnes Lapka
Greenhorn

Joined: Dec 26, 2000
Posts: 23
Just one more thing...
Is there a way of letting the user decide in which directory they want to put those class files? Couldn't one write a small 'installation wizard' in some other language (that has exe files), store the path the user chooses and append it to the bat file?
I have absolutely no knowledge of those kinds of operations, so those questions might seem silly... But I'd like to know how professionals do it? Any ideas?
A.
Cindy Glass
"The Hood"
Sheriff

Joined: Sep 29, 2000
Posts: 8521
At work we use a product called InstallSheild that bundles up the class files, our own copy of the JRE (to protect the application against user upgrades and damaging the generic java stuff), any properties files, image files, icons etc. It makes an executable out of the above, and when the user downloads the thing and double clicks it, a standard install routine is invoked that allows the user to specify the directory, and modifies the bat file with the chosen directory as it drops them in place. It also allows you to have a deploy routine to do stuff like set up an Icon, and put the application in the Start Menu etc.
There are other products besides that one available also.
sharan basu
Greenhorn

Joined: Feb 05, 2001
Posts: 12
hello cindy,

according to u if we use InstallSheild for .class files,
after installing executable,class files can be decompiled(as decompilers availabe) then how to protect my source files.any
suggestions plz.
sharan

------------------
Cindy Glass
"The Hood"
Sheriff

Joined: Sep 29, 2000
Posts: 8521
Got to a portal (like google.com) and do a search on obfuscators. The muddle up the compiled code to make it difficult (hopefully impossible) for decompilers to work.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to make distributable copies of my program?