How do I compile and run java files if you don't know the specific package used by the developer...
I got a folder of java files written by someone else, and I'm trying to compile and run the java files, I can compile the files by running javac *.java
, but if I try to run the main class by calling java MainClass
, I get an error like so: Error could not find or load main class MainClass, Caused by: java.lang.NoClassDefFoundError: SomePackageName/MainClass (wrong name: MainClass)
I have no idea whats the SomePackageName its defined by the developer and I have no control over that.
so the question is how do I compile and run the java files if all I know is which is the main class?