A browser with JavaScript enabled is required for this page to operate properly.
Trail: Essential Classes
Lesson: The Platform Environment
Questions and Exercises
Home Page > Essential Classes > The Platform Environment

Questions and Exercises: The Platform Environment

Questions

1. A programmer installs a new library contained in a .jar file. In order to access the library from his code, he sets the CLASSPATH environment variable to point to the new .jar file. Now he finds that he gets an error message when he tries to launch simple applications:

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

In this case, the Hello class is compiled into a .class file in the current directory — yet the java command can't seem to find it. What's going wrong?

Exercises

1. Write an application, PersistentEcho, with the following features:

Check your answers.


Problems with the examples? Try Compiling and Running the Examples: FAQs.
Complaints? Compliments? Suggestions? Give us your feedback.

Previous page: PATH and CLASSPATH
Next page: Regular Expressions