Re: Swing error :Exception in thread "main" java.lang.NoClassDefFoundError
pdlemper@earthlink.net wrote:
Only problem I had with setup is classpath. Am storing source files
and compiling/running from bin directory.
What bin/ directory? Surely not the bin/ directory of the Java installation?
Java source and output should go in some sort of project directory, for
example, "%HOME%/projects/" (Windows envar style). Let's say your project
"foo" is in there:
%HOME%/project/foo/src/
would be the root of your source tree, and
%HOME%/project/foo/build/classes/
the root of your class output tree, and thus your runtime class path. For an
application (a Java class with a main()), you'd invoke it like this:
java -cp %HOME%/project/foo/build/classes/ example.packg.foo.Primary
You would have compiled it like this:
cd %HOME%/project/foo/src/
javac \
-cp %HOME%/project/foo/build/classes/;%JAVA_JARS%/log4j-1.2.14.jar \
-d %HOME%/project/foo/build/classes/ \
example/packg/foo/Primary.java
(ignoring the linewrap)
From
<http://java.sun.com/javase/6/docs/technotes/tools/index.html>
review
<http://java.sun.com/javase/6/docs/technotes/tools/windows/java.html>
and
<http://java.sun.com/javase/6/docs/technotes/tools/windows/javac.html>
also
<http://java.sun.com/javase/6/docs/technotes/tools/findingclasses.html>
--
Lew