rules_scala icon indicating copy to clipboard operation
rules_scala copied to clipboard

NoClassDefFoundError

Open tjarvstrand opened this issue 5 years ago • 5 comments

Hi again,

I'm having some trouble running my code. The error java.lang.NoClassDefFoundError: java/sql/Date

The Java options I'm using are the following:

default_javac_opts = [ "-target", "1.8",
                       "-encoding", "UTF-8",
                       "-source", "1.8",
                     ]

When I build, I get the following warning which I suspect may be related: [Warn] bootstrap class path not set in conjunction with -source 8

If removing the source option I still get the same error at runtime however.

I'm currently building with openjdk version 1.8.0_222. Can I solve this using -Xbootclasspath? What should the value be?

tjarvstrand avatar Dec 05 '19 10:12 tjarvstrand

Could you provide a minimal reproducible case for this? It could also because something except Java options is going wrong in the code.

[Warn] bootstrap class path not set in conjunction with -source 8

It's a warning so it may not be the root cause.

borkaehw avatar Dec 09 '19 22:12 borkaehw

Hey @borkaehw

Sorry for the delay. I've been very busy and it took me some time to isolate the problematic part into a minimal example but here it is: https://github.com/tjarvstrand/bazel-classdef

tjarvstrand avatar Jan 23 '20 16:01 tjarvstrand

@tjarvstrand Any solution. I'm running into the same problem. I'm trying to move our codebase from the "other" rules_scala, where we didn't have this problem.

subotic avatar Aug 20 '20 16:08 subotic

Googling, I've found this but I'm not sure how to add this.

subotic avatar Aug 20 '20 16:08 subotic

@subotic Eventually I gave up. I came back to the problem a few months later and didn't run into the same issue then. My suspicion is that I didn't have JAVA_HOME properly set in my environment the first time around but I can't say for sure.

tjarvstrand avatar Aug 21 '20 05:08 tjarvstrand