Giter Site home page Giter Site logo

Comments (7)

benty-amzn avatar benty-amzn commented on August 14, 2024

Can you share which Corretto package(s) you currently have installed?

The value /usr/lib/jvm/java-1.8.0-amazon-corretto should work if you have a full jdk installed (package may have, for exmaple, -devel suffix, depending on your distribution), while /usr/lib/jvm/java-1.8.0-amazon-corretto/jre is just a runtime environment.

You'll notice in the error message that a full jdk is needed:

NB: JAVA_HOME should point to a JDK not a JRE

from corretto-8.

dss010101 avatar dss010101 commented on August 14, 2024

kage(s) you currently have installed?

in my docker file i have the below

FROM amazonlinux:2023
...
RUN dnf -y install java-1.8.0-amazon-corretto
ENV JAVA_HOME=/usr/lib/jvm/java-1.8.0-amazon-corretto
...

Note im setting the JAVA_HOME env based on what i saw here: corretto/corretto-8-docker@055b9f3

Based on what you state, is the above just the JRE install then?

from corretto-8.

dss010101 avatar dss010101 commented on August 14, 2024

rebuilding the container with java-1.8.0-amazon-corretto-devel seems to have resolved the issue. Curious, do i need to explicitly set JAVA_HOME in the case of the *-devel package?

from corretto-8.

dss010101 avatar dss010101 commented on August 14, 2024

rebuilding the container with java-1.8.0-amazon-corretto-devel seems to have resolved the issue. Curious, do i need to explicitly set JAVA_HOME in the case of the *-devel package?

I take this back...it doesnt work with java-1.8.0-amazon-corretto-devel install either.
I had to export JAVA_HOME=/usr/lib/jvm/java

`java-1.8.0-amazon-corretto-devel also seem to install java 17

from corretto-8.

lutkerd avatar lutkerd commented on August 14, 2024

java-1.8.0-amazon-corretto-devel should not be installing Java 17, I was not able to reproduce that on a fresh docker.

Are you also installing Maven from the AL2023 yum repositories? If so, that is what is pulling in Java 17. The reason is that Java 17 is the "system Java" for Amazon Linux 2023 and most packages that require Java are built against that version.

You can run dnf repoquery --installed --whatrequires java-17-amazon-corretto-headless to see why java 17 is getting installed. /usr/lib/jvm/java is an alternative setup by the RPMs being installed and should be pointing to the latest installed version. You can run realpath /usr/lib/jvm/java and you should see it pointing to /usr/lib/jvm/java-17-amazon-corretto.x86_64

On a docker I started if I install java-1.8.0-amazon-corretto-devel and maven, I can then switch the Java version that mvn picks up with setting JAVA_HOME

# mvn -v
Apache Maven 3.8.4 (Red Hat 3.8.4-3.amzn2023.0.5)
Maven home: /usr/share/maven
Java version: 17.0.9, vendor: Amazon.com Inc., runtime: /usr/lib/jvm/java-17-amazon-corretto.x86_64
Default locale: en_US, platform encoding: ANSI_X3.4-1968
OS name: "linux", version: "5.4.257-177.360.amzn2int.x86_64", arch: "amd64", family: "unix"

bash-5.2# export JAVA_HOME=/usr/lib/jvm/java-1.8.0-amazon-corretto.x86_64/
bash-5.2# mvn -v
Apache Maven 3.8.4 (Red Hat 3.8.4-3.amzn2023.0.5)
Maven home: /usr/share/maven
Java version: 1.8.0_392, vendor: Amazon.com Inc., runtime: /usr/lib/jvm/java-1.8.0-amazon-corretto.x86_64/jre
Default locale: en_US, platform encoding: ANSI_X3.4-1968
OS name: "linux", version: "5.4.257-177.360.amzn2int.x86_64", arch: "amd64", family: "unix"

from corretto-8.

dss010101 avatar dss010101 commented on August 14, 2024

ah..yes, i am installing maven - that answers that bit of confusion.

On the jdk (devel) vs jre - what are the JAVA_HOME supposed to be they seem different. In order to get Maven to find java,

for the JRE, i needed /usr/lib/jvm/java-1.8.0-amazon-corretto/jre
for the JDK, i needed to set /usr/lib/jvm/java

from corretto-8.

lutkerd avatar lutkerd commented on August 14, 2024

Maven is looking for $JAVA_HOME/bin/java, see code snippet below, if you are building code you will need javac which is in the java-1.8.0-amazon-corretto-devel package anyway.

if [ -z "$JAVA_HOME" ] ; then
  JAVACMD="`\\unset -f command; \\command -v java`"
else
  JAVACMD="$JAVA_HOME/bin/java"
fi

if [ ! -x "$JAVACMD" ] ; then
  echo "The JAVA_HOME environment variable is not defined correctly," >&2
  echo "this environment variable is needed to run this program." >&2
  exit 1
fi

from corretto-8.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.