In the directory:
/home/ThinkPinkApp/flocks
I have the following two source files:
FlockingInformation.java FlockLists.java
at the top of each source file I have
package home.ThinkPinkApp.flocks
Compiling the files causes no issue, however, when I attempt to run the main methods for each file, I receive the following error:
Error: Could not find or load main class FlockingInformation Caused by: java.lang.NoClassDefFoundError: home/ThinkPinkApp/flocks/FlockingInformation (wrong name: FlockingInformation)
Compiling and running the files in my home directory ~/ThinkPinkApp/objects
without the package keyword is fine and causes no issue. When I add package objects
to the same sources files in my home directory though I receive the same error.
I have attempted to use the -CLASSPATH option with the java command, and still receive the same error. I have read the official oracle documentation regarding the java command and am unsure of what I am doing wrong. My understanding is that the JVM looks for files in the current directory by default, so why isn't it able to find/load these classes? I understand that the JVM also uses the class path variable, but I am unsure how to access/change that. and even then I should be able to use the -cp option to manually change what directories it looks in right?
I have also attempted running the files with java home.ThinkPinkApp.FlockingInformation
this produces a similar error, minus the (wrong name: FlockingInformation)
part. Unsure of what this means though.
Any explanation or suggestions would be greatly appreciated.