Compiling and Running A Java Application
- 2 Comment
Compiling and Running A Java Application
Java source files can be compiled using the Java compiler tool javac, which is part of the Java 2 SDK.
The source file Client.java contains the definition of the Client class. The source file can be compiled by giving the following input at the command line:
>javac Client.java
This creates the class file, Client.class, containing the Java byte code for the Client class. The Client class uses the CharStack class, and if the file CharStack.class does not already exist, the compiler will also compile the source file CharStack.java.
Compiled classes can be executed by the Java interpreter java, which is also part of the Java 2 SDK. Java can be run by giving the following input at the command line:
>java Client
Note that only the name of the class is specified, resulting in starting the execution of the main() method from the specified class.
[...] code. These values are interpreted as line-terminator characters by the compiler, and will cause compile time errors. One should use the escape sequences ‘n’ and ‘r’, respectively, for correct [...]
[...] for another type in a given context) at compile time. However, some checks are only possible at runtime (for example, which type of object a reference actually denotes during execution). In cases where [...]