Classpath problem for current directory
I am working in a directory called c:\j21work. I created a class file called PrimeFinder.class that contains a class definition and another class file called PrimeThreads.class which contains a class and main() method.
I am receiving the error:
Exception in thread "main" java.lang.NoClassDefFoundError: PrimeThreads/java
After researching it, this is apparently due to needing the specify that the current path be used in the CLASSPATH environment variable. I checked the variable, and the very first character of the CLASSPATH is "." followed by a ";" and all of the other paths included in the classpath.
I am frustrated because that is supposed to be all the classpath needs to compile properly, allowing java to look at the current directory and find the file it needs to find, which is PrimeFinder.class, but it does not.
If I use the command line: java -classpath . PrimeThreads, it works fine, but I don't want to have to use the -classpath argument to run my class files, it just means that I don't have the proper configuration in CLASSPATH.
So I went ahead and added C:\j21work as a path in CLASSPATH, and although it works, it really isn't the same as having the current directory checked. With this fix, it means that every time I want to work in a new directory and create java class files in it, I have to specify that directory as well in the CLASSPATH environment variable, or place that directory as a subdirectory to an already specified directory in the classpath.
I am just trying to do things the right way and configure java properly so it is more efficient and I don't make more work for myself and more configuration changes than necessary. I'm sorry if this was a lengthy post, but I would really love to solve this problem. Thanks a lot for reading this and taking the time to help me out, I really do appreciate it! :)
"Your head asplode!"