permaculture playing cards*
The moose likes Beginning Java and the fly likes  How do i get my none programmer friends to try out my simple programs by just clicking on them? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » Beginning Java
Reply locked New topic
Author

How do i get my none programmer friends to try out my simple programs by just clicking on them?

Neil Cartmell
Ranch Hand

Joined: Feb 13, 2010
Posts: 150
Hello. So my friends are asking me to show them some of the little programs i have been developing, and i would love to just send it as an email attachment so they can just click on it and it automatically loads up. But at the moment the only way i know to run my programs is by using an IDE or the command line and if they were to use the command line i would have to explain to them about how to set the classpath and tell them to type in things like cd C:\ java.

So obviously when people write programs the user does not have to go through all that. They should be able to just click on the file and it loads up. ( I know they would need to have java on their computer though).

I have only just started learning about GUIs and am at the stage of learning to add buttons and learning about Action Listeners and such. But i've been flicking ahead though my books and i can't find any mention of how i can get others to use my programs.

So is there a way to do this? If so can you write a link to an article explaining how, or even just a term that i can search in google.

Thanks to anyone who takes the time to help.

Steve Luke
Bartender

Joined: Jan 28, 2003
Posts: 4181
    
  21

The term you want to search for is 'Executable JAR'.

A JAR is a Java ARchive, very much like a ZIP file, but with a special manifest (text file) which tells Java where the main class is. A good IDE will have a wizard for making a JAR file (or it can be done using the command line). The JAR has to contain all of the classes for the app. The user downloads the JAR, double clicks it, and the app runs (as long as they have Java properly installed). Do a quick search and you will find lots of help on how to build them.


Steve
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 39478
    
  28
To add to what Steve has told you: look in the Java™ Tutorials section.
Neil Cartmell
Ranch Hand

Joined: Feb 13, 2010
Posts: 150
Steve Luke wrote:The term you want to search for is 'Executable JAR'.

A JAR is a Java ARchive, very much like a ZIP file, but with a special manifest (text file) which tells Java where the main class is. A good IDE will have a wizard for making a JAR file (or it can be done using the command line). The JAR has to contain all of the classes for the app. The user downloads the JAR, double clicks it, and the app runs (as long as they have Java properly installed). Do a quick search and you will find lots of help on how to build them.


Thank you! That's all i needed to know. :)
Neil Cartmell
Ranch Hand

Joined: Feb 13, 2010
Posts: 150
Campbell Ritchie wrote:To add to what Steve has told you: look in the Java™ Tutorials section.


Cheers i'll read that now.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 39478
    
  28
You're welcome
Neil Cartmell
Ranch Hand

Joined: Feb 13, 2010
Posts: 150
Hello i've been trying to make a jar file and something seems to be going wrong.

This is an article with the instructions i have been following Creating an Executable jar File
The error i'm getting when i try to run the jar file is "Could not find the main class: TurtleTest3 . Program will exit."

I have 3 classes in my program the one with the main method is called "TurtleTest3" and the other two are called "Turtle3" and "Instructions".

These are the exact steps i have taken. I am using command prompt.


echo Main-Class: TurtleTest3 >manifest.txt

(then i push enter)

jar cvfm TurtleGame.jar manifest.txt TurtleTest3.class Turtle3.class Instructions.class

(then i push enter and it displays a load of info)

TurtleGame.jar

(then it displays the error message i told you about)


Anyone know what i'm doing wrong?





Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 39478
    
  28
Please don't post a new and fresh question on an old thread. Closing thread.
 
 
subject: How do i get my none programmer friends to try out my simple programs by just clicking on them?