The command line is a direct interface to the operating system.
One of the most powerful and useful skills you can learn is how to use the command-line interface, also called the “terminal”. What’s nice about this feature is that you don’t have to create a new class, declare a main method, write arbitrary expressions inside statements, save the source file, and get all of your code to compile in advance.Īlso, you can press the up/down arrows on the keyboard to repeat previous commands and experiment with incremental differences. This feature saves you from having to type every time. Notice in Figure A.2 that the variable declarations end with semicolons, but the logic expressions in the following lines do not. If you don’t end an expression (or statement) with a semicolon, DrJava automatically displays its value. There is one subtle detail to note when using the Interactions pane. Refer to the DrJava documentation ( ) for more details. Simply double-click the JAR file to run DrJava. We recommend that you save it to your Desktop folder or another convenient location.
To install DrJava, visit and download the JAR file. The IDE we recommend is DrJava, which is an open source development environment written in Java (see Figure A.1).ĭownload and run the installer for your operating system. The JDK we recommend is OpenJDK, an open source implementation of Java SE (Standard Edition).
We avoided putting these details in the main text, because they can be distracting. The steps for compiling, running, and debugging Java code depend on your development environment and operating system.