Caleb is right. A .jar file is not executable (it's a compressed file in ZIP format which contains your .class files and other files needed). Normally, it won't run when we double-click the bile in Windows Explorer. But if your windows has successfully associate .jar extension with java.exe (from the JRE installation) you can still double-click the .jar file to run the app.
Regards, Herianto. --- On Sun, 11/22/09, Caleb Watson <[email protected]> wrote: > From: Caleb Watson <[email protected]> > Subject: Re: [java programming] Need some help with Java compiler > To: [email protected] > Cc: [email protected] > Date: Sunday, November 22, 2009, 2:06 AM > Will, > In order to run your project from the command like > you need to use the "javac" command with your > terminal (linux/unix/os x) or cmd prompt (win): > javac Hello.java > > It will compile your file into a .class file. > Once this is done then you need to run the "java" > command on your file without the extension: > java Hello > > This will run your application and you will see any > output in the terminal. > A .jar file or .zip file of you project is what > you should turn in as homework. A .jar is just a zip format > to pack up your project - it is not meant to run when you > click on it. > > Link: http://www.javapassion.com/handsonlabs/javaprogenv/index.html#Exercise_2 > Hope this helps. > > Caleb > > > On Sat, Nov 21, 2009 at 10:05 AM, > will phan <[email protected]> > wrote: > > Hi > everyone ! > > I've just started with this course and now I have a > problem. > I have a Hello project and then build it to Hello.jar. When > I double click on this Hello.jar nothing happens. How can I > execute it directly !? (not convert to .exe) > > > > Hope somebody can show it to me ! Many thks > > > > > -- > > To post to this group, send email to > [email protected] > > To unsubscribe from this group, send email to > [email protected] > > For more options, visit this group at > http://groups.google.com/group/javaprogrammingwithpassion?hl=en > > > > > > -- > > To post to this group, send email to > [email protected] > > To unsubscribe from this group, send email to > [email protected] > > For more options, visit this group at > http://groups.google.com/group/javaprogrammingwithpassion?hl=en -- To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/javaprogrammingwithpassion?hl=en
