java.lang.NoClassDefFoundError: com/sun/tools/javac/main/OptionName

2,523 views
Skip to first unread message

robert cooke

unread,
Jul 19, 2013, 5:57:27 PM7/19/13
to cof...@googlegroups.com
Hi,

I keep getting this problem.
The classes are in the tools.jar and I tried everything to add it to the class path but, I still keep getting this error. 

build:
    [mkdir] Created dir: C:\Users\jesse\git\cofoja\target\.apt_generated
    [javac] C:\Users\jesse\git\cofoja\cofoja-build.xml:39: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds
    [javac] Compiling 4 source files to C:\Users\jesse\git\cofoja\target\.apt_generated
    [javac] An annotation processor threw an uncaught exception.
    [javac] Consult the following stack trace for details.
    [javac] java.lang.NoClassDefFoundError: com/sun/tools/javac/main/OptionName
    [javac] at com.google.java.contract.core.apt.AnnotationProcessor.setupPaths(AnnotationProcessor.java:225)
    [javac] at com.google.java.contract.core.apt.AnnotationProcessor.init(AnnotationProcessor.java:148)
    [javac] at com.sun.tools.javac.processing.JavacProcessingEnvironment$ProcessorState.<init>(JavacProcessingEnvironment.java:503)
    [javac] at com.sun.tools.javac.processing.JavacProcessingEnvironment$DiscoveredProcessors$ProcessorStateIterator.next(JavacProcessingEnvironment.java:600)
    [javac] at com.sun.tools.javac.processing.JavacProcessingEnvironment.discoverAndRunProcs(JavacProcessingEnvironment.java:693)
    [javac] at com.sun.tools.javac.processing.JavacProcessingEnvironment.access$1800(JavacProcessingEnvironment.java:94)
    [javac] at com.sun.tools.javac.processing.JavacProcessingEnvironment$Round.run(JavacProcessingEnvironment.java:1020)
    [javac] at com.sun.tools.javac.processing.JavacProcessingEnvironment.doProcessing(JavacProcessingEnvironment.java:1154)
    [javac] at com.sun.tools.javac.main.JavaCompiler.processAnnotations(JavaCompiler.java:1146)
    [javac] at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:832)
    [javac] at com.sun.tools.javac.main.Main.compile(Main.java:517)
    [javac] at com.sun.tools.javac.main.Main.compile(Main.java:376)
    [javac] at com.sun.tools.javac.main.Main.compile(Main.java:365)
    [javac] at com.sun.tools.javac.main.Main.compile(Main.java:356)
    [javac] at com.sun.tools.javac.Main.compile(Main.java:77)
    [javac] at com.sun.tools.javac.Main.main(Main.java:62)
    [javac] Caused by: java.lang.ClassNotFoundException: com.sun.tools.javac.main.OptionName

Nhat Minh Lê

unread,
Jul 19, 2013, 6:27:06 PM7/19/13
to cof...@googlegroups.com, robertje...@gmail.com
Hi,

It's not a problem with tools.jar being included. If it weren't,
Cofoja wouldn't build. Here, you're having an issue with the fact that
even though the compiler is a Sun-derivative javac, the OptionName
class is not found (no classpath or anything is needed since the
compiler uses OptionName itself, so it should be loaded anyway
regardless).

Thing is, looking at the OpenJDK commit logs, it seems that OptionName
was removed more than a year ago, but it probably was never rolled out
to more stable javac releases. Which version of JDK/javac are you
using?

Nhat
> --
> You received this message because you are subscribed to the Google Groups
> "cofoja" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to cofoja+un...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

robert cooke

unread,
Jul 20, 2013, 3:14:10 AM7/20/13
to cof...@googlegroups.com
Seems your right!

I used this jvm :

java version "1.8.0-ea"
Java(TM) SE Runtime Environment (build 1.8.0-ea-lambda-nightly-h4816-20130617-b95-b00)
Java HotSpot(TM) 64-Bit Server VM (build 25.0-b34, mixed mode)

Now I changed it to :

java version "1.7.0_40-ea"
Java(TM) SE Runtime Environment (build 1.7.0_40-ea-b34)
Java HotSpot(TM) 64-Bit Server VM (build 24.0-b53, mixed mode)

And the there is no problem anymore.

Do you have any idea how to make cofoja work with 1.8.
I really need some of the new features that 1.8 provides.

Kind regards,

Robert

Nhat Minh Lê

unread,
Jul 21, 2013, 3:55:05 PM7/21/13
to robert cooke, cof...@googlegroups.com
Hi,

Yes, making it work with 1.8 should be fairly straightforward. It's
just that the option names have moved to Option from OptionName.
But all this option parsing is optional and as a quick workaround, you
can simply comment out the whole if block that uses these internal Sun
classes, and it should work.

I haven't tried running Cofoja on Java 1.8 yet, and am a bit busy
right now to work on a proper fix, but if you run into other issues,
don't hesitate to post your issues on the mailing list.
Also, if you could create an issue on the bug tracker for the
OptionName problem, that'd be great.

Thanks,
Nhat

On Sat, Jul 20, 2013 at 3:08 AM, robert cooke
<robertje...@gmail.com> wrote:
> Seems your right.
>
> I tried with this.
>
> java version "1.8.0-ea"
> Java(TM) SE Runtime Environment (build 1.8.0-ea-lambda-nightly-h
> Java HotSpot(TM) 64-Bit Server VM (build 25.0-b34, mixed mode)
>
> I changed the jvm to :
>
> java version "1.7.0_40-ea"
> Java(TM) SE Runtime Environment (build 1.7.0_40-ea-b34)
> Java HotSpot(TM) 64-Bit Server VM (build 24.0-b53, mixed mode)
>
> And there is no problem.
>
> Do you have any idea how to make cofoja work with 1.8.
> I really need some of the new features that 1.8 provides.
>
> Kind regards,
>
> Robert
>
>
>

robert cooke

unread,
Jul 27, 2013, 12:20:17 PM7/27/13
to cof...@googlegroups.com, robert cooke
Done thank you for your reply!

Gachoud Philippe

unread,
Aug 23, 2021, 7:49:27 AM8/23/21
to cofoja
Hey! new to cojofa comming from Eiffel world...
Running 1.8 in my enterprise, has that been fixed? 
Could you describe precisely where and what to fix?

Gachoud Philippe

unread,
Aug 23, 2021, 7:54:17 AM8/23/21
to cofoja
Would like to be able to include that with mvn repo. Any possiblity do do that without having to do it myself?
Reply all
Reply to author
Forward
0 new messages