Results 1 to 8 of 8
Thread: Running .jar in command prompt
- 07-17-2011, 11:40 PM #1
Member
- Join Date
- Jul 2011
- Posts
- 4
- Rep Power
- 0
Running .jar in command prompt
I'm a little confused if you can actually do this, I set the program up not using a GUI because it doesn't need one, so I am trying to figure out if I can make the program run in command prompt with user interaction.
Example: "What is 2+2?"
User input: "4"
"Correct!".
I hope this makes enough sense.
- 07-18-2011, 12:09 AM #2make the program run in command prompt with user interaction
I've never tried reading from the console from a program in a jar file, so I don't know if it will work.
- 07-18-2011, 12:20 AM #3
Member
- Join Date
- Jul 2011
- Posts
- 4
- Rep Power
- 0
Yes I have tried, but the .jar wont open. When I open command prompt and test it using "java ProjectName" it runs fine, I just can't get the .jar to open command prompt.
- 07-18-2011, 12:22 AM #4I just can't get the .jar to open command prompt
Open the command prompt and enter: java -jar JARFILENAME.jar
Or do you want to display a text field and allow the user to type input into that?
- 07-18-2011, 12:27 AM #5
Member
- Join Date
- Jul 2011
- Posts
- 4
- Rep Power
- 0
I opened command prompt and typed that in, and it worked, but how would I make it do that when the user opens the .jar file?
- 07-18-2011, 12:29 AM #6
It might work if you used a batch file.
But why stay with command line I/O?
Write a simple GUI with a text field and a button.
- 07-18-2011, 12:33 AM #7
Member
- Join Date
- Jul 2011
- Posts
- 4
- Rep Power
- 0
I stayed with the command I/O because I figured at first it would be easier. I will see how it goes with a GUI. Thanks!
- 07-18-2011, 12:35 AM #8
Similar Threads
-
error in the Command Prompt when running a bat file
By bluesagemedia in forum New To JavaReplies: 1Last Post: 10-03-2010, 02:05 AM -
Compiling/Running in Command Prompt
By coke_in_a_can in forum New To JavaReplies: 12Last Post: 05-31-2010, 10:05 AM -
running command prompt using java
By xclaim in forum New To JavaReplies: 1Last Post: 01-14-2010, 04:46 AM -
Running applet from command prompt
By niteshwar.bhardwaj in forum Java 2DReplies: 1Last Post: 03-12-2009, 09:10 AM -
problems in running d command prompt commands
By postaholic066 in forum Advanced JavaReplies: 1Last Post: 09-10-2008, 04:47 PM
Bookmarks