Use jenv to enable multiple versions of Java

jenv In the field development, I got the opportunity to use multiple versions of Java, so I organized the method to use while switching.

Installation and configuration

Since it is published on GitHub, bring it and set it.

$ git clone https://github.com/gcuisinier/jenv.git ~/.jenv
$ echo 'export PATH="$HOME/.jenv/bin:$PATH"' >> ~/.bash_profile
$ echo 'eval "$(jenv init -)"' >> ~/.bash_profile

Java home registration

Please install Java in advance. Register the Java home directory with add.

$ jenv add /usr/lib/jvm/java-11-openjdk-amd64
$ jenv add /opt/jdk1.7.0_80/

Check version

$ jenv versions
  system
* 1.7 (set by /home/hogehoge/.jenv/version)
  1.7.0.80
  11.0
  11.0.3
  openjdk64-11.0.3
  oracle64-1.7.0.80

Switching the environment Switching the entire Java version

$ jenv global oracle64-1.7.0.80

Switch the Java version under the specified directory

$ mkdir java7
$ cd java7
$ jenv local oracle64-1.7.0.80

This will change the Java version only under java7

Recommended Posts

Use jenv to enable multiple versions of Java
Using multiple versions of Java with Brew on Mac + jEnv
[Java] [Maven3] Summary of how to use Maven3
How to switch between multiple Java versions
Switch between multiple versions of Java on Mac
[Java] How to use compareTo method of Date class
Summary of Java communication API (1) How to use Socket
Summary of Java communication API (3) How to use SocketChannel
Summary of Java communication API (2) How to use HttpUrlConnection
Java: Use Stream to sort the contents of the collection
[Java] How to use Map
[Java] How to use Map
How to use java Optional
How to use java class
[Java] How to use Optional ②
[Java] How to use removeAll ()
[Java] How to use string.format
How to use Java Map
[java] Reasons to use static
How to use Java variables
[Java] How to use Optional ①
How to use trained model of tensorflow2.0 with Kotlin / Java
How to use Java HttpClient (Get)
Operation to connect multiple Streams @Java
How to use Java HttpClient (Post)
[Java] How to use join method
[Java] Input to stdin of Process
How to use setDefaultCloseOperation () of JFrame
[Processing × Java] How to use variables
[Java] How to use LinkedHashMap class
From introduction to use of ActiveHash
[JavaFX] [Java8] How to use GridPane
How to use class methods [Java]
[Java] How to use List [ArrayList]
How to use classes in Java?
[Processing × Java] How to use arrays
How to use Java lambda expressions
[Java] How to use Math class
How to use Java enum type
Multilingual Locale in Java How to use Locale
Whether to use Java Comparable or Comparator
[Java] How to use the File class
Use TMDA to parse IBM Java javacore
[Java] How to use the hasNext function
[java] Summary of how to handle char
Java Artery-Easy to use unit test library
How to use submit method (Java Silver)
[Java] How to use the HashMap class
Use static initialization block to initialize List / Set of static fields in Java
[Easy-to-understand explanation! ] How to use Java instance
[Java] How to use the toString () method
Studying how to use the constructor (java)
[Processing × Java] How to use the loop
How to switch Java versions on Mac
[Java] How to use substring to cut out a part of a character string
How to use Java classes, definitions, import
[Easy-to-understand explanation! ] How to use Java polymorphism
[Processing × Java] How to use the class
How to use Java Scanner class (Note)
[Java] Note how to use RecyclerView and implementation of animated swipe processing.
Output of the book "Introduction to Java"