Giter Club home page Giter Club logo

Comments (11)

robertdebock avatar robertdebock commented on June 3, 2024 1

Hm, it's not easy to test if an environment variable is set using the Ansible assert module; Ansible logs in non-interactively, so not all variables are loaded.

I have tested it manually, the java_path is set correctly.

Closing this issue due to inactivity.

from ansible-role-java.

robertdebock avatar robertdebock commented on June 3, 2024

Hi @till, thanks for your feedback again! I have a few questions;

Environment variables are typically set per user, how do you normally set them? (in what file)
I'm hardly aware of the JAVA_HOME variable, what does not work when you don't set it?

from ansible-role-java.

till avatar till commented on June 3, 2024

Hey @robertdebock!

JAVA_HOME typically points to where the JRE or JDK are installed on the system. I think at this point it's an "odd standard" used by Java-based software and frameworks to start the JVM — I am not really sure why, but that's the way it is.

I would probably set them in /etc/environment for the entire server/VM?

from ansible-role-java.

robertdebock avatar robertdebock commented on June 3, 2024

A release need to be done in order to allow you to use this role, that wil be either tonight or tomorrow.

from ansible-role-java.

till avatar till commented on June 3, 2024

@robertdebock wow, that was quick! 🙇 🚀

from ansible-role-java.

till avatar till commented on June 3, 2024

@robertdebock I tried master of the role, didn't seem to work. Also didn't get the java_home.sh script.

from ansible-role-java.

till avatar till commented on June 3, 2024

(Code you used in shell: works though, ran that, gave me the correct output.)

from ansible-role-java.

robertdebock avatar robertdebock commented on June 3, 2024

What shell do you use? (echo $SHELL) I've tested with boune shell (/bin/sh) and bourne again shell (/bin/bash).

And be aware you do need to login after applying this role to allow the environment settings to be loaded.

I've tested like this:

molecule test --scenario-name fedora-latest --destroy=never
molecule login --scenario-name fedora-latest
echo $JAVA_HOME
/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.212.b04-0.fc30.x86_64/jre

from ansible-role-java.

till avatar till commented on June 3, 2024
# echo $SHELL
/bin/bash
# echo $JAVA_HOME

from ansible-role-java.

till avatar till commented on June 3, 2024

@robertdebock This ended up working, semi...

I am trying to figure out what I did, but I basically see /etc/profile.d/java_home.sh on one system, and not on the other. (This is a PICNIC.)

Another "issue" I found is that since I switched my playbook to install JDK instead of JRE, the variable/shell script is not updated. It still points to the JRE, not to the JDK.

from ansible-role-java.

till avatar till commented on June 3, 2024

I found this in addition:

cat /etc/java/java.conf 
# System-wide Java configuration file  -*- sh -*-

# Location of jar files on the system
JAVA_LIBDIR=/usr/share/java

# Location of arch-specific jar files on the system
JNI_LIBDIR=/usr/lib/java

# Root of all JVM installations
JVM_ROOT=/usr/lib/jvm

# You can define a system-wide JVM root here if you're not using the
# default one.
#
# If you have a base JRE package installed
# (e.g. java-1.6.0-openjdk):
#JAVA_HOME=$JVM_ROOT/jre
#
# If you have a devel JDK package installed
# (e.g. java-1.6.0-openjdk-devel):
#JAVA_HOME=$JVM_ROOT/java

# Options to pass to the java interpreter
#JAVACMD_OPTS=

# You can disable ABRT Java Connector by setting JAVA_ABRT to "off".
# See: https://github.com/jfilak/abrt-java-connector/
#JAVA_ABRT=off

I wish I had any idea how to test this exactly (e.g. how to invoke Java to test if the path is correctly set). But it also looks like if we used this configuration, it could be simplified heavily?

from ansible-role-java.

Related Issues (9)

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.