views:

142

answers:

7

I have just written a program in Java. I am curious if I can make the program downloadable online so that my friends and family can take advantage of it. No clue where to even begin.

I would like it to run locally. I am able to run the program locally on my computer by simply double clicking the .class file, I also can create a shortcut to the .class file and run it directly from my desktop. Is there a way to zip the .java file along with the .class files (there are 4 .class files) and email that to those that I wish to use it? I tried to send an email with the zip file to another computer in the house, but the .class file wouldn't run the program on the other computer...is there another way to make this happen?

Any suggestions?

A: 

You could distribute the runnable Jar file itself, or if you're interested in making it install via the browser you could also look into java web start

AphexMunky
A: 

If you created a web application you can host it on GAE, which is a really nice way to have online applications. If your application is a desktop java application, then just upload it on any FTP/HTTP server.

Another solution is to use the java web start style, which will allow the users to download the application and run it directly from the browser.


Resources :

On the same topic :

Colin Hebert
I would like them to be able to download the file, and run the program seperate from the browser
javaTheHut
Then look a the second part of my answer.
Colin Hebert
+11  A: 

Have a look at Java Web Start:

"The Java Web Start software allows you to download and run Java applications from the web. The Java Web Start software:

  • Provides an easy, one-click activation of applications
  • Guarantees that you are always running the latest version of the
    application
  • Eliminates complicated installation or upgrade procedures"
Dan Diplo
+1  A: 

hi,

why don't you simply upload your *.jar file to a web server and let your friends download it from there? if you want the program to be embedded in a web page, you should write a java applet.

MichL
+1  A: 

There are a lot of free code hosting sites.

There are many more. There's even a Wikipedia page about this, outlining all features and so on.

BalusC
I think he wants to make the executable available
Noel M
@Noel: Yes, I understood that. Code hosting sites add another advantages on top of that as well. A simple web hosting is apparently a *too obvious* answer since the OP doesn't have a clue where to begin.
BalusC
If the OP wants to post source code, for even fewer bells and whistles it's hard to beat pastebin: http://en.wikipedia.org/wiki/Pastebin
GregS
A: 

Unfortunately, Java is not the best language to share an app "with family and friends".
Basically, if you want them to be able to run the program, you first need to create a jar, and they need to have the JRE installed, and run it from command line. A really good option is to use something like Launch4J which will help you create "native" executables, with an embedded JRE or a link to download it, an icon, an installer, and all that stuff that make your program look more professional and less hobby-like

Pablo Grisafi
A: 

This is possible. Let's consider that [yourclass] is the name of the primary class (the name of the class file on which you double-click) and [appname] is whatever name you want for your application. Both are case sensitive. Just follow the next steps:

1) make a blank file with the name "manifest.mft".

2) write in manifest.mft:
"Manifest-Version: 1.0
Main-Class: [yourclass]
Class-path: .
"

3) make a blank file named "run.bat"

4) write in run.bat: "java -jar [appname].jar"

5) you first need to compile your .java file: "javac [file].java"

6) you then need to package all the class files and the manifest file in a jar file:
"jar cvfm [appname].jar manifest.mft *.class"

7) all you have to do now is to send the [appname].jar and run.bat to whom you want and all they got to do is to double click on the run.bat file to run your program. They must have JRE installed and the bin foder of the JRE in windows PATH system variable.

cripox