TextPad and Java - FAQ

How to compile and run Java file using TextPad.

  1. Choose "Tools | Compile Java" to compile Java file. If compilation is successful, Command Results Windows would show "Tool completed successfully" message.
  2. Choose "Tools | Run Java Application" to run Java file.

Why do I encounter "ClassNotFound" errors when compiling using TextPad?

If the Java program you run has a dependency on the system environment variables having a classpath that is set to a specific Java SDK directory the way TextPad does, you will encounter compilation errors if the classpath is not set properly. This can occur if the system environment variables don't contain a classpath at all.

  1. To check the classpath on a Windows XP computer, you can type in "echo %classpath%" under command prompt. For example, in the output "c:\jdk1.5.0_04;.", the period represents that the current directory is in the class path.
  2. Another method to check the classpath: Choose Start | Settings | Control Panel | double-click System. Select the advanced tab and then Environment Variables. Look for "Classpath" under the system Variables.
  3. If the classpath does not exist, or if the classpath does not look similar to this:"C:\Program Files\jdk 1.5.0_6\lib;C:\Program Files\Java\jdk 1.5.0_6\bin;.;C:\Program Files\Java\jre 1.5.0_6\QTJava.zip", open TextPad and choose "Configure | Preferences | Tools | Compile Java". Then change the Parameters by entering "-cp . $File" in the box. This will eliminate the need for the classpath to be set on the system.
  4. Compile Java file again.

Why do I encounter "ClassNotFound" errors when running Java application using TextPad?

  1. Same as step 1 of Why do I encounter "ClassNotFound" errors when compiling using TextPad.
  2. Same as step 2 of Why do I encounter "ClassNotFound" errors when compiling using TextPad.
  3. Open TextPad and choose "Configure | Preferences | Tools | Run Java Application". Then change the Parameters by entering "-cp . $BaseName" in the box.
  4. Run Java application again.