Skip to content
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

java.lang.RuntimeException: unsupported Java version: 9 #300

Open
andersonDadario opened this issue Nov 4, 2017 · 16 comments

Comments

Projects
None yet
@andersonDadario
Copy link

commented Nov 4, 2017

Tried to use s3_website on Mac and unfortunately it does not run with Java 9

user$ s3_website push --dry-run
[info] Downloading https://github.com/laurilehmijoki/s3_website/releases/download/v3.4.0/s3_website.jar into /var/folders/pv/qhqsh1rj0r11dknn95w1yxbmvfy2z6/T//s3_website-3.4.0.jar
Exception in thread "main" java.lang.ExceptionInInitializerError
	at org.jruby.Ruby.newInstance(Ruby.java:266)
	at s3.website.Ruby$.rubyRuntime$lzycompute(Ruby.scala:4)
	at s3.website.Ruby$.rubyRuntime(Ruby.scala:4)
	at s3.website.model.Config$$anonfun$15.apply(Config.scala:229)
	at s3.website.model.Config$$anonfun$15.apply(Config.scala:227)
	at scala.util.Try$.apply(Try.scala:192)
	at s3.website.model.Config$.erbEval(Config.scala:227)
	at s3.website.model.Site$$anonfun$2.apply(Site.scala:28)
	at s3.website.model.Site$$anonfun$2.apply(Site.scala:27)
	at scala.util.Success.flatMap(Try.scala:231)
	at s3.website.model.Site$.parseConfig(Site.scala:27)
	at s3.website.model.Site$.loadSite(Site.scala:100)
	at s3.website.Push$.push(Push.scala:62)
	at s3.website.Push$.main(Push.scala:40)
	at s3.website.Push.main(Push.scala)
Caused by: java.lang.RuntimeException: unsupported Java version: 9
	at org.jruby.RubyInstanceConfig.initGlobalJavaVersion(RubyInstanceConfig.java:1878)
	at org.jruby.RubyInstanceConfig.<clinit>(RubyInstanceConfig.java:1585)
	... 15 more

Java version

user$ java --version
java 9.0.1
Java(TM) SE Runtime Environment (build 9.0.1+11)
Java HotSpot(TM) 64-Bit Server VM (build 9.0.1+11, mixed mode)
@laurilehmijoki

This comment has been minimized.

Copy link
Owner

commented Nov 5, 2017

Pull request highly appreciated!

@laurilehmijoki

This comment has been minimized.

Copy link
Owner

commented Nov 5, 2017

And thank you for the report :)

@andersonDadario

This comment has been minimized.

Copy link
Author

commented Nov 5, 2017

Btw @laurilehmijoki , thank you for s3 website. It`s a great project :)

@betterdesign

This comment has been minimized.

Copy link

commented Nov 17, 2017

Also getting the same issue... would love to get this working as it would be my first time using it. Thank you!

——————

Downloading https://github.com/laurilehmijoki/s3_website/releases/download/v3.4.0/s3_website.jar into /Users/clementyeung/.gem/ruby/2.4.2/gems/s3_website-3.4.0/s3_website-3.4.0.jar Exception in thread "main" java.lang.ExceptionInInitializerError at org.jruby.Ruby.newInstance(Ruby.java:266) at s3.website.Ruby$.rubyRuntime$lzycompute(Ruby.scala:4) at s3.website.Ruby$.rubyRuntime(Ruby.scala:4) at s3.website.model.Config$$anonfun$15.apply(Config.scala:229) at s3.website.model.Config$$anonfun$15.apply(Config.scala:227) at scala.util.Try$.apply(Try.scala:192) at s3.website.model.Config$.erbEval(Config.scala:227) at s3.website.model.Site$$anonfun$2.apply(Site.scala:28) at s3.website.model.Site$$anonfun$2.apply(Site.scala:27) at scala.util.Success.flatMap(Try.scala:231) at s3.website.model.Site$.parseConfig(Site.scala:27) at s3.website.model.Site$.loadSite(Site.scala:100) at s3.website.Push$.push(Push.scala:62) at s3.website.Push$.main(Push.scala:40) at s3.website.Push.main(Push.scala) Caused by: java.lang.RuntimeException: unsupported Java version: 9 at org.jruby.RubyInstanceConfig.initGlobalJavaVersion(RubyInstanceConfig.java:1878) at org.jruby.RubyInstanceConfig.<clinit>(RubyInstanceConfig.java:1585) ... 15 more

java --version java 9.0.1 Java(TM) SE Runtime Environment (build 9.0.1+11) Java HotSpot(TM) 64-Bit Server VM (build 9.0.1+11, mixed mode)

@laurilehmijoki

This comment has been minimized.

Copy link
Owner

commented Nov 18, 2017

A workaround is to use jenv: #298

@alandipert

This comment has been minimized.

Copy link

commented Nov 28, 2017

Could this be as simple as upgrading JRuby in build.sbt?

jruby/jruby#4558 (comment)

@lucascantor

This comment has been minimized.

Copy link

commented Jan 28, 2018

My experience figuring out how to use jenv as a workaround, for anyone having trouble:

#298 (comment)

@andersonDadario

This comment has been minimized.

Copy link
Author

commented Apr 23, 2018

I just used Docker, problem solved.

Here is what I did:

  1. Created a s3_website directory on my app root directory
  2. There I created 3 files:

Dockerfile

FROM ruby:2.3.3

RUN apt-get update -qq && \
    apt-get install --assume-yes -y \
       build-essential \
       libpq-dev \
       openjdk-7-jre \
    && apt-get clean \
    && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

# Use en_US.UTF-8 as our locale
ENV LC_CTYPE en_US.UTF-8
ENV LANG en_US.UTF-8

# Run bundle
RUN gem install s3_website && s3_website install

RUN mkdir /app
VOLUME /app
WORKDIR /app

CMD bash

build.sh

#!/bin/bash
docker build -t utils/s3_website .

deploy.sh

#!/bin/bash

docker run --rm \
    --name s3_website \
    -it \
    -v "$(cd .. && pwd):/app" \
    utils/s3_website \
    s3_website push

And I still keep the s3_website.yml file in my app root folder. The app container will access it through a shared volume.

The process is simple:

  1. Install Docker
  2. $ bash build.sh # just need to do it once to create the image
  3. $ bash deploy.sh # loads info from ../s3_website.yml

Note: I am sure that this process can be optimized, e.g., let --dry-run be parameter for deploy.sh, but so far it works well for me.

@xaviershay

This comment has been minimized.

Copy link
Contributor

commented Jul 26, 2018

I tried and failed to make a PR to fix. I know basically nothing about Scala or Java, so no real surprise. Notes:

  • Tried to run ./sbt assembly, failed with error around Missing dependency 'object java.lang.Object in compiler mirror'. Googling seems to suggest this is likely a result of sbt being too old for java 9 (0.13.2).
  • Tried to replace project/sbt-launch.jar with 0.13.7 downloaded from SBT website. Failed with error module not found: org.scala-sbt#sbt;0.13.17. This appears to be same actual error as #312, workaround posted there. Command now works, but "assembly" not a valid command.
  • Switched to a project I have an pointed it at local s3_website with path: option in bundler. Still getting error: scala.reflect.internal.MissingRequirementError: object java.lang.Object in compiler mirror not found. when trying to publish.
  • Turns out something created project/build.properties which was locking SBT version (./sbt sbtVersion) to 0.13. Updated that to 1.1.6 (latest). No cannot resolve sbt-assembly and sbt-idea dependencies, pretty sure those are specified somewhere in this project.
  • Updated sbt-assembly to latest and removed sbt-idea (for now). Commented out code to fix error: not found: object AssemblyKeys (this will very likely burn me later), sbtVersion now reports 1.1.6.
  • publishing still results in object java.lang.Object in compiler mirror not found :(
@natseg

This comment has been minimized.

Copy link

commented Aug 6, 2018

#300 (comment) I would also recommend using asdf to manage different versions of java on your mac. It's a meta manager so it can also manage ruby, nodejs, elixir, erlang, ...

That's how I "fixed" this issue on my machine.

@AndrewKvalheim

This comment has been minimized.

Copy link

commented Aug 26, 2018

For searchability:

Caused by: java.lang.RuntimeException: unsupported Java version: 10
@rtrvrtg

This comment has been minimized.

Copy link

commented Oct 10, 2018

Got a colleague with the same problem except their runtime exception message is unsupported Java version: 11

Your build dependencies currently indicate that jRuby 1.7.11 is required. jRuby's Github indicates that the latest versions support up to v10: https://github.com/jruby/jruby/blob/ce15c9d63e7312c47c7d86c2852e93a406459c7b/core/src/main/java/org/jruby/RubyInstanceConfig.java

@losomo

This comment has been minimized.

Copy link

commented Dec 13, 2018

For my future self:
Problem:

Caused by: java.lang.RuntimeException: unsupported Java version: 11
	at org.jruby.RubyInstanceConfig.initGlobalJavaVersion(RubyInstanceConfig.java:1878)

Solution:

PATH=/usr/lib/jvm/java-8-openjdk-amd64/bin/:$PATH s3_website push
@xaviershay

This comment has been minimized.

Copy link
Contributor

commented Dec 31, 2018

Can confirm that @losomo's workaround worked for me on Ubuntu 18.04 with openjdk-8-jre-headless package installed.

> lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 18.04.1 LTS
Release:        18.04
Codename:       bionic
> dpkg -S /usr/lib/jvm/java-1.8.0-openjdk-amd64     
openjdk-8-jre-headless:amd64: /usr/lib/jvm/java-1.8.0-openjdk-amd64
@cpury

This comment has been minimized.

Copy link

commented Feb 7, 2019

So which Java versions are supported? Can we at least mention that in the Readme? I'd hate to download and install one after the other until I hit one that's supported...

@nadnoslen

This comment has been minimized.

Copy link

commented Feb 7, 2019

I ended up brewing down to adoptopenjdk8 (Java 8) in order to get this plugin to work.

Annoying because I had to completely uninstall adoptopenjdk11.

I'm stunned that there is a Java dependency locked at 8? I wonder if @alandipert upgrade of JRuby comment would fix this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.