Results 1 to 10 of 10
- 02-04-2012, 10:14 PM #1
Member
- Join Date
- Feb 2012
- Posts
- 35
- Rep Power
- 0
-
Re: How could I make this work in Executable JAR File?
What problems are you having? Does the manifest file identify this class as the one with the application's entry point, the Main-Class?
- 02-04-2012, 10:36 PM #3
Member
- Join Date
- Feb 2012
- Posts
- 35
- Rep Power
- 0
Re: How could I make this work in Executable JAR File?
Umm.. i'm not exactly sure, but it works in eclipse and shows the text "Hello" in the console like it should, but when i export it to the desktop, the file doesnt run when i click it
-
Re: How could I make this work in Executable JAR File?
When you click it you will never see if it runs since you don't create a long-standing console window. If you're in Windows, create a console via cmd.exe, and run your jar file from there.
- 02-04-2012, 10:48 PM #5
Member
- Join Date
- Feb 2012
- Posts
- 35
- Rep Power
- 0
Re: How could I make this work in Executable JAR File?
Ok, and how exactly can i do that?
Sorry for not knowing this.. :/
-
Re: How could I make this work in Executable JAR File?
do what? Run a jar file on the command line? Google can help you find that. One of the first hits it gave me was: Running JAR-Packaged Software (The Java™ Tutorials > Deployment > Packaging Programs in JAR Files)
- 02-04-2012, 11:12 PM #7
Member
- Join Date
- Feb 2012
- Posts
- 35
- Rep Power
- 0
Re: How could I make this work in Executable JAR File?
I looked at that page but didn't really understand much of it.
I dont know what type of file this would be, but I CAN tell you what i want to do.
Here's what i want to do:
I made a new project and made a new class in that.
I wrote this code into that class:
It runs and shows the message "Hello" on the console in Eclipse.Java Code:package practice; public class variables1 { public static void main(String[] args){ System.out.print("Hello"); } }
Here's where I don't know what to do:
I don't know how to make that file into some file in a folder that can be clicked on, and open a window that shows the message "Hello" and closes when i click X.
That's what i want to do.
Thanks alotLast edited by Etimer; 02-04-2012 at 11:15 PM.
-
Re: How could I make this work in Executable JAR File?
The simplest solution is to display your output with a JOptionPane:
Then use Eclipse's export wizard to create a jar file that holds this file, but making sure to set the Main class in the export wizard to this class.Java Code:import javax.swing.JOptionPane; public class HelloWorld { public static void main(String[] args) { JOptionPane.showMessageDialog(null, "Hello World"); } }
Then if your OS has been configured correctly, double clicking on the jar file will run the class and show the option pane.
- 02-04-2012, 11:42 PM #9
Member
- Join Date
- Feb 2012
- Posts
- 35
- Rep Power
- 0
Re: How could I make this work in Executable JAR File?
Thank you very much!
Not only did you help me out, but you gave me a valuable tip(the dialogue box thing).
-
Similar Threads
-
Allow YOUR work to make a DIFFERENCE!!
By erictgroup in forum Jobs OfferedReplies: 0Last Post: 06-01-2011, 11:19 PM -
Make it work !
By PhQ in forum New To JavaReplies: 6Last Post: 09-20-2010, 08:22 AM -
How do i make this work What am i doing Wrong.
By Ramaan in forum New To JavaReplies: 2Last Post: 03-01-2010, 11:36 PM -
Make the Button Work
By ŖàΫ ỏƒ Ңόρę in forum New To JavaReplies: 1Last Post: 02-27-2010, 10:52 AM -
Can't make JTable work -- please help!!
By cagalli83 in forum Advanced JavaReplies: 0Last Post: 02-13-2008, 09:31 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks