next up previous contents
Next: MSDOS tips Up: A. How to use Previous: A. How to use   Contents

Instructions

The recommended Java environment for this course is Oracle's Java Development Kit (JDK) version 616. The standard edition is free to download and it contains all you need to compile and run Java programs. Later in this section there is information about installing it on your own computer. It is of course already installed on the lab PCs.

To write and edit Java programs, you can use any text editor such as Wordpad or Notepad, however the recommended editor is Jext. It is aware of the Java language, so it makes it easier for you by colour-coding key words and indenting correctly at the start of a new line. Jext is available on the lab PCs via the Windows Start Menu: Programs $ \rightarrow$Academic Applications $ \rightarrow$Physics $ \rightarrow$Jext

Image startjext Image startmsdos

When you create a new file with Jext, you should set the language to Java on the menu at the top right of the Jext tool bar.

Files can be opened and saved through the File menu or using the appropriate icons. You must keep your own Java files in a folder under your home drive; it is suggested that you save them in a dedicated subdirectory called Y :\java. You can create this directory in the normal way using Windows Explorer.

To compile and run java programs, type commands into an MSDOS window17. To open a MSDOS window, go to the Windows Start menu and in the search box, type cmd then return.

To change to the folder where you saved your Java file from the text editor, Y :\java, type:

  Y:
  cd Y:\java

Some other useful MSDOS commands and tips are given later in this section.

In order to run a Java program, you must first compile it. To compile the Java class defined in the file `ClassName.java', simply type:

  javac ClassName.java

To run a compiled class, type:

  java ClassName


next up previous contents
Next: MSDOS tips Up: A. How to use Previous: A. How to use   Contents
RHUL Dept. of Physics