Solve the problem that every time you enter the container command, you need to re-source /etc/profile to take effect

#编辑JDK8
export JAVA_HOME="/usr/java/java8"

#编辑maven
export M2_HOME="/opt/idea-IU-162.1121.32/plugins/maven/lib/maven3"

#编辑PATH
export PATH="$JAVA_HOME/bin:$M2_HOME/bin:$PATH"

This is the configuration at the end of my /etc/profile. There is no problem with JDK, no source is needed, and echo $JAVA_HOME can come out. The problem is that if you want to use mvn, you need to source it every time. I use IDEA for maven. with.

Answer 1. It can also be placed in ~/.bashrc. Or add a source /etc/profile to ~/.bashrc

( This method has been used successfully )

Answer 2. You can write these commands in /etc/bash and they will be executed automatically

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325807942&siteId=291194637