Jump to content

View more

Image of the Day

Adding some finishing touches...
Follow us for more
#screenshotsaturday #indiedev... by #MakeGoodGames https://t.co/Otbwywbm3a
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.


Sign up now

Headfirst program doesn't run in cmd

4: Adsense

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.


  • You cannot reply to this topic
2 replies to this topic

#1 Jeffige   Members   

113
Like
0Likes
Like

Posted 11 August 2012 - 08:44 PM

I am following along with HeadFirst java. Got the path(s) correct, checked to make sure java was installed correctly with javac. I created a folder in: C:\Users\JEFFD\headfirst. Changed dir to C:\Users\JEFFD\headfirst. When I try and run javac MyVeryFirstApp.java, the dos window pauses for a half a second and returns with C:\Users\JEFFD\headfirst.


public class MyVeryFirstApp {

public static void main (String [] args) {
	 System.out.println( "I Rule!");
	 System.out.println("The World!");
	  }
}

thanks for any help.

#2 darookie   Members   

1441
Like
1Likes
Like

Posted 12 August 2012 - 01:29 AM

That is to be expected. Javac is just the compiler that generates bytecode from your program. You can execute the program using the java command.

#3 !Null   Members   

380
Like
0Likes
Like

Posted 15 August 2012 - 03:34 AM

Darookie is right, once the compiler has created the jar, if you run a command line from the same folder as the .jar you can use the cmd

java -jar MyVeryFirstApp.jar

that will run the jar from the cmd....or you could just double click it.
/********************************************************************************\
/**********************He Who Dares, Wins**********************************\
/********************************************************************************\




Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.