[JSR308] ClassNotFoundException using BasicChecker
Jonathan.Gibbons at Sun.COM
Wed Aug 12 11:37:37 EDT 2009
You should be able to use the -processorpath option for javac to load
the annotation processor classes.
The use of the CLASSPATH environment variable is somewhat antiquated
-- you should be able to do everything through command line options.
On Aug 12, 2009, at 8:16 AM, Mahmood Ali wrote:
> I am sorry that you are experiencing some difficulties with using the
> BasicChecker. I would like to move the discussion to jsr308-bugs at lists.csail.mit.edu
> , the mailing list dedicated for tool bugs.
>> I am getting a ClassNotFoundException using BasicChecker.
>> I first compile the Encrypted class using:
>> javac src/myquals/Encrypted.java
>> Then I try to compile and check Test.java:
>> javac -cp src -processor checkers.basic.BasicChecker
>> -Aquals=myquals.Encypted src/myquals/Test.java
>> But I receive the following error:
>> java.lang.Error: java.lang.ClassNotFoundException: myquals/Encrypted
>> Why am I not able to use my own annotation with BasicChecker?
> It seems that there are two classpath variables here:
> - classpath for the compiler to use for compilation
> '-cp src' sets the lookup path for the javac as it compiles
> - classpath for the JVM (ClassLoader more specifically) to load
> classes while compiling
> The compiler uses the CLASSPATH environment variable to lookup the
> classes to load. checkers.jar for example live in the path.
> While your Encrypted annotation is in the first classpath, ClassLoader
> cannot find it! Hence you getting the error.
> Try (if using *nix - Linux or MacOS):
> $ CLASSPATH=src:$CLASSPATH javac -cp src -processor
> checkers.basic.BasicChecker \
> -Aquals=myquals.Encrypted src/myquals/Test.java
> I don't know if you can do a one-liner in Windows, but I assume you
> can use set/export.
> Thanks for reporting the problem. We will document it in the manual,
> and hopefully have a better workaround.
> JSR308 mailing list
> JSR308 at lists.csail.mit.edu
More information about the JSR308