This past weekend I went Barnes and Noble to use a gift certificate I have had for a while. I ended up buying “Murach’s Java SE 6” book. I know. A real page turner. Anyways, I was trying to set up my computer to be able to wrote some code and for my “Hello World” application, it would compile but not run. I was getting

Exception in thread "main" java.lang.NoClassDefFoundError: TestApp

After some searching I found the problem. I am using TextPad to write my code and I needed to include the classpath variable at runtime for the app to work. In TextPad, click on Configure, Preferences. The click on Tools in the tree view and select Run Java Application. There is a box called “Parameters:” Inside the box is $BaseName. Edit this value and type in

-classpath . $BaseName

This should resolve your problem. When I get some more time, I will explain why you have to do this.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.