You actually run Java applications with the Java tool named, appropriately enough, java. This tool is a program that comes with the Java SDK (java.exe in Windows, in the Java bin directory).
To run the ch10_01 application, I use the java tool like this on the command line: %java ch10_01 The result appears at once: %java ch10_01 Welcome to Java You can see what this looks like in Figure 10-1, where I'm running this application in a DOS window in Windows. Figure 10-1. Running a Java application.
That's all it takes. You've created, compiled, and run your first Java application. (Note that if your application isn't responding or you want to stop it for some reason, you can type Ctrl+C in Windows. If that doesn't work, try the Escape key.) While we're on the topic of compiling and running code, there is another detail that we should cover: commenting your Java code. |