Java Programming for Android Developers For Dummies
Book image
Explore Book Buy On Amazon
TextPad is an inexpensive ($27) text editor that you can integrate with the Java Development Kit (JDK) to simplify the task of coding, compiling, and running Java programs. It isn’t a true integrated development environment (IDE), as it lacks features such as integrated debugging, code generators, and drag-and-drop tools for creating graphical user interfaces.

TextPad is a popular tool for developing Java programs because of its simplicity and speed. It’s ideal for learning Java because it doesn’t generate any code for you. Writing every line of code yourself may seem like a bother, but the exercise pays off in the long run because you have a better understanding of how Java works.

You can download a free evaluation version of TextPad from Helios Software Systems. You can use the evaluation version free of charge, but if you decide to keep the program, you must pay for it. (Helios accepts credit card payment online.)

If the Java JDK is already installed on your computer when you install TextPad, TextPad automatically configures itself to compile and run Java programs. If you install the JDK after you install TextPad, you need to configure TextPad for Java by following these steps:

  1. Choose Configure→Preferences to open the Preferences dialog box.
  2. Click Tools in the tree that appears on the left side of the dialog box.
  3. Click the Add button to reveal a drop-down list of options and then click Java SDK Commands. The figure below shows how the Preferences dialog box appears when the Java tools are installed. As you can see, the Tools item in the tree on the left side of the dialog box includes three Java tools: Compile Java, Run Java Application, and Run Java Applet. (The Run Java Applet tool is obsolete, so you can safely ignore it.)

    Configuring tools in TextPad. Configuring tools in TextPad
  4. Click OK. The commands you need to compile and run Java programs are added to TextPad’s Tools menu.

If you plan on using any preview features in Java, add the --enable-preview and --release 14 flags to the command line arguments for the Compile tool. The complete Compile tool arguments should look like this:

--enable-preview --release 14 $File

Then, add just the --enable-preview flag to the Run Java Application arguments list; the complete arguments should look like this:

--enable-preview $BaseName

Do not add the --release flag to the Run Java Application tool. If you do, the tool won’t be able to start the JVM, because --release is not a valid flag for the java command.

About This Article

This article can be found in the category: