I've written a java application with several classes all in the same .java file. It works just fine. Now, I've broken it up so that each class has its own .java file. Still works fine. My next step is to put those classes into a package, but I'm not about to get the program to run.
The .java source files are all in /home/user/src
I've set the CLASSPATH to /home/usr/src
All of the source files have "package com.myfirm.program" on the first line.
I compiled the application with:
javac -d . File1.java File2.java File3.java (etc...)
the compiler created the directory:
/home/user/src/com/myfirm/program
and put all of the .class files in there.
So how do I get the program to run?
if I run from /home/usr/src
java File1
I get:
Exception in thread "main" java.lang.NoClassDefFoundError: File1 (wrong name: com/myfirm/program/Program)
Any help would be appreciated.
No comments:
Post a Comment