-
Notifications
You must be signed in to change notification settings - Fork 201
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unexpected NoClassDefFoundError
when compiling the bridge
#743
Comments
Looks related to scala/bug#10603 and scala/bug#11154, which happen when higher versions of Java 8 are used. It's not clear to me this is bloop's fault.
The error here happens when compiling the bridge, so you should be able to reproduce by just compiling the project. |
NoClassDefFoundError
when compiling the bridge
Thanks @jvican uninstalling my Java11 does solve the problem. |
@ouchxp Bloop does not spawn any new JVM processes, so either this is a mismatch between the configuration of I don't know why Mac OSX causes these problems but they are for sure really annoying. I would be grateful if you can find a way to solve this problem and avoid any conflicts with Java 11 installations because, as you say, having Java 11 for other projects is critical for some people. |
Had a closer look at this issue, The |
Thanks for the careful investigation @ouchxp. Can you copy paste your change in the |
@jvican
And then calling the
|
@ouchxp I've dug deeper into this limitation because it's a show-stopper. It all boils down to the fact that brew services uses launchd/launchtl to run the services and their environment variables must be configured manually. How can the user configure manually the environment variables used by brew services and, concretely,
The recommended solution doesn't work when "Reopen windows after reboot" is enabled, so if you're having some problems after reboot I recommend restarting bloop I wished there was a more straightforward way of telling you how to fix this, but there isn't. Mac OS is making our life difficult here. These solutions require manual user intervention. A way we could fix this in the future without educating our users is if coursier/coursier#879 sets the JAVA_HOME of the bootstrapped script to the available JAVA_HOME available for the Extra references: |
@jvican can the bloop plist hardcode the full Java 8 path?
|
@olafurpg It would need to be |
|
You can run java -jar coursier fetch org.scalameta:mtags_2.12:0.2.0 The flag I agree it would be a nice improvement nevertheless to make |
Yep, as @olafurpg says, you can always run |
This fix uses the godsend `/usr/libexec/java_home` to detect the java home for 1.8 and use that one to run `coursier launch` (failing with a helpful error message if it doesn't find it). The main idea here comes from the discussion in the bug and some ideas by Olafur (olafurpg). In reality, this means that the server must be run with Java 1.8 or it will fail. This is a good compromise for now until we can ensure that we are as efficient and correct in other Java versions as we're in Java 1.8. I've tested this in my machine where Java 8 is installed via jenv (which doesn't set the java home variable directly) and Java 11 was installed via homebrew casks. I believe this scenario stresses this fix enough to make it valid. For now, we only use this approach in Mac OS because libexec/java_home only exist in OSX. Fixes #743
I re-opened because I found a way to fix this in our installation process so that this doesn't bite future users. This fix doesn't require any user custom configuration and therefore we don't need to educate them about launchd, doing |
I'm getting NoClassDefFoundError: javax/tools/DiagnosticListener when running 2.11 project. However if I switch to 2.12, everything works just fine.
The text was updated successfully, but these errors were encountered: