• Stars
    star
    603
  • Rank 74,294 (Top 2 %)
  • Language
    Shell
  • License
    Apache License 2.0
  • Created almost 12 years ago
  • Updated over 4 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Java enVironment Manager

jenv: the Java enVironment Manager

Join the chat at https://gitter.im/linux-china/jenv jenv is a tool for managing parallel Versions of Java Development Kits on any system, such as Linux, Mac and Windows. It provides a convenient command line interface for installing, switching, removing and listing candidates. If you have any problem, please join gitter room: https://gitter.im/linux-china/jenv

Why jenv

  • Easy to manage Java versions, such as 1.6, 1.7 and 1.8
  • Easy to install Java related tools, such as ant, maven, tomcat etc.
  • Easy to manage candidate versions. It supports installing new version, reinstalling or uninstalling old ones
  • Directory is standard and friendly to IDE
  • Easy to be extended - you can setup your own jenv in your company to manage development environment
  • Easy to backup your env.
  • Bash completion support. Use TAB to complete command name, candidate name and version
  • Multi OS support, such as Mac, Linux and Windows(Cygwin)

Installat jenv

Open your favourite terminal and enter the following:

    $ curl -L -s get.jenv.mvnsearch.org | bash

If the environment needs tweaking for jenv to be installed, the installer will prompt you accordingly and ask you to restart.

Install Java

Because I cannot redistribute Java SDK, so you should download it from http://www.oracle.com/technetwork/java/javase/downloads/index.html and install by yourself. After installation, please execute the following command:

    $ mkdir -p $HOME/.jenv/candidates/java
    $ ln -s /Library/Java/JavaVirtualMachines/jdk1.8.0_112.jdk/Contents/home $HOME/.jenv/candidates/java/1.8.0_112
    $ jenv default java 1.8.0_112

for Mac user, after you install JDK from dmg file, please execute:

$ jenv install java 1.8.0_112 system

and jenv will link the Java version automatically.

You can also install Java by http url:

$ jenv install java 1.8.0_112 http://xxxx.com/java/java-1.8.0_112.zip

Install candidates

Firstly, view all available candidates:

$ jenv all

Secondly, list available versions for the candidate, such as maven candidate:

$ jenv ls maven

Finally, install the candidate with the specified version:

$ jenv install maven 3.5.3

In your terminal, type mvn --version to check the installation.

If you want to list all installed candidates, use the following command:

$ jenv ls

For Docker user, your can use silent mode in your Dockerfile as following:

$ JENV_AUTO=true; jenv install maven 3.5.3

Update repository

The candidate's versions are maintained in the central repository. To keep updated with central repository, please use:

$ jenv repo update

Clonable development environments with jenv

You can clone your jenv between multiple hosts.

  • clone your local jenv to remote host: jenv clone user@remote-host
  • clone your local candidate to remote host: jenv clone candidate version user@remote-host
  • clone candidate from remote host: jenv clone user@remote-host canidate version

Other Commands

  • uninstall: Uninstall the candidate with the version specified, such as jenv uninstall maven 3.0.4
  • reinstall: Reinstall the candidate with the version specified, such as jenv reinstall maven 3.0.5
  • use: Use the candidate with the version specified, such as jenv use maven 3.0.4
  • which: Check which version for candidate
  • pause: Pause candidate usage
  • exe: Execute script under candidate, such as jenv execute tomcat startup.sh or jenv execute tomee startup.sh
  • default: Make the version as default, such as jenv default maven 3.0.4
  • cd: Change directory to candidate install directory, such as jenv cd groovy
  • show: Display the candidate's detailed information
  • requirements: Display jenv requirements

jenvrc support

jenvrc is jenv setup file which contains candidate and the version as following:

java=1.8.0_112
maven=3.5.3

After you enter this directory, jenv will setup environment automatically. Now You can use jenvrc to setup Java environment for each of your individual projects. You can use jenv init to generate jenvrc file.

  $jenv init

Note: Line started with # means line comment.

Script Hook

All the scripts are under candidate home and invoked by jenv automatically.

  • autorun.sh: executed to load current candidate
  • post-install.sh: executed after install
  • uninstall.sh: executed before uninstall

Install local candidates

If you want to add custom candidate into jenv, please create candidates_local under $HOME/.jenv/db/ directory and input candidate name.

$jenv add spike 0.0.1
$jenv install spike 0.0.1 [email protected]:linux-china/groovy_scripts.git

Then you can install candidate from git repository, and you can update candidate by following command:

$jenv update spike

If the candidate is absent, jenv will update all git or svn based candidates.

$jenv update

Update all git or svn based candidates.

jenv with Docker Executable Images

If you want to integrate jenv with Docker Executable Images, you can use following steps:

  • create a repository in github
  • create autorun.sh file to create functions for commands in Docker images:
mvn() {
    docker run --rm \
              -v $(pwd):/project \
              -w /project \
              --entrypoint mvn \
              maven:3.5.0-jdk-8 $*
}
  • install candidate from github
  • execute shell functions in autorun.sh

How to update jenv

Please use selfupdate command to get last version and candidate repository.

   $ jenv selfupdate

jenv IntelliJ IDEA plugin

With jenv IDEA plugin, you don't need to setup Java SDK, Maven, and so on, and jenv IDEA plugin can scan jenv directory and setup the settings in IDEA automatically. Please visit http://plugins.jetbrains.com/plugin/?idea&pluginId=7229

Reference

TODO

  • jenv outdated: display outdated candidates
  • broadcast: broadcast message

More Repositories

1

chatgpt-spring-boot-starter

Spring Boot ChatGPT Starter
Java
481
star
2

spring-boot-dubbo

Spring Boot with Dubbo support
Java
278
star
3

dubbo3

Dubbo3: distributed RPC framework from Alibaba Dubbo2
Java
255
star
4

ddd-base

DDD(Domain Driven Design) base package for java
Java
255
star
5

awesome-rsocket

Awesome RSocket
190
star
6

mybatis-r2dbc

MyBatis R2DBC Adapter
Java
131
star
7

weixin-robot-java

微信公共平台机器人Java SDK
Java
119
star
8

plantuml-gist

PlantUML with Github Gist and Gitlab Support
Java
96
star
9

dx

A tool and task runner for writing better scripts with Deno
TypeScript
93
star
10

zookeeper-intellij

IntelliJ IDEA ZooKeeper Plugin
Java
62
star
11

spring-boot-starter-redisson

Spring Boot starter for Redisson
Java
58
star
12

h2-functions-4-mysql

H2 functions for MySQL
Java
57
star
13

spring-boot-starter-okhttp3

Spring Boot Starter for OkHttp3
Java
55
star
14

spring-boot-starter-httpclient

Spring Boot Starter for HttpClient
Java
54
star
15

vitest-jetbrains-plugin

Vitest JetBrains plugin
Kotlin
52
star
16

spring-boot-rsocket-demo

Spring Boot RSocket Demo with RPC style
Java
42
star
17

spring-boot-thymeleaf3-bootstrap4-angular4

Spring Boot Kotlin Application Template for Thymeleaf3, BootStrap4 and Angularjs 4
TypeScript
42
star
18

toolchains-maven-plugin

Toolchains Maven Plugin with JDK auto download
Java
36
star
19

xtermjs-spring-boot-starter

Web terminal to manage your Spring Boot app
Java
30
star
20

spring-cloud-function-demo

Spring cloud function with RSocket
Java
24
star
21

spring-boot-starter-wechatmp

Spring Boot with Wechat Support
Java
23
star
22

ngrok-spring-boot-starter

Easy to expose a local Spring Boot Application to the internet by ngrok
Java
23
star
23

smarty4j

Smarty Template Engine for Java
Java
22
star
24

spring-boot-starter-oss

Spring Boot Start with Aliyun OSS
Java
19
star
25

reactive-demo

Reactive Demo with Reactor, RxJava and reactive-stream
Java
19
star
26

jetbrains-just-plugin

JetBrains Just Command Runner Plugin
Kotlin
19
star
27

cli-completion

CLI completion for bash, zsh, fish and powershell
Rust
18
star
28

spring-boot-microservices

Spring Boot MicroServices
Java
18
star
29

spring-boot-starter-shell

Spring Shell with Spring Boot Driven
Java
17
star
30

chrome_js_api_stub

Chrome JavaScript API Stub to assistant extension development in IDE
JavaScript
16
star
31

rsocket-load-balancing

RSocket load balancing based on Spring Cloud Service Registry
Java
15
star
32

kotlin-wasm-demo

Kotlin WebAssembly Demo
Kotlin
15
star
33

spring-boot-kotlin-microservices

Spring Boot MicroServices with Kotlin
Kotlin
14
star
34

task-keeper

A cli to manage tasks from different task runners or package managers
Rust
13
star
35

open2internet-spring-boot-starter

Expose local Spring Boot Application to internet for demonstration, testing and debuging
Java
13
star
36

ali-oss-shell

Aliyun OSS Shell
Java
12
star
37

easy-random-junit5-extension

JUnit 5 extension for easy-random
Java
12
star
38

rocker-template-demo

Rocker template demo with Spring Boot
Java
12
star
39

mail-catcher

MailCatcher runs a super simple SMTP server which catches any message sent to it to display in a web interface
Java
12
star
40

kotlin-platform-bom

Kotlin Platform BOM
Just
11
star
41

axum-demo

Axum demo
Rust
11
star
42

rsocket-deno

🦕RSocket Deno module
TypeScript
11
star
43

r2dbc-demo

R2DBC demo
Java
11
star
44

oh-my-zsh-spring-boot-plugin

oh-my-zsh Spring Boot plugin
10
star
45

team

Team Instruction
10
star
46

java-error-messages-wizard

Java Error Message Wizard
Java
10
star
47

ddd-demo

DDD demo with Java 8 and Spring Boot
Java
9
star
48

jenv-ps

jenv Power Shell Edition
PowerShell
9
star
49

nats-spring-boot-starter

Spring Boot starter for NATS
Java
9
star
50

struts2-spring-boot-integration

Spring Boot with Struts 2.5.x Integration
Java
8
star
51

kafka-demo

Kafka Demo with Spring Boot, Docker and Terraform
Java
8
star
52

rest-editor-client-contrib

REST Editor Client Contrib plugin for IntelliJ IDEA
Java
8
star
53

jenv-idea-plugin

jenv IntelliJ IDEA plugin
Java
8
star
54

mybatis-demo

MyBatis Demo with spring-boot-starter-mybatis integration
Java
8
star
55

platform-bom-contrib

Spring Platform IO BOM Contrib
Java
8
star
56

java9-in-action

Java 9 in Action
Java
7
star
57

aliyun-openapi-rust-sdk

Aliyun OpenAPI SDK for Rust
Rust
7
star
58

tgm

Template generator management
Rust
7
star
59

npm-export-spring-boot-starter

Spring Boot Starter to generate npm package to call REST API
Java
7
star
60

xterm-demo

Xterm.js with RSocket
JavaScript
7
star
61

apache-pulsar-demo

Apache Pulsar demo
Java
7
star
62

http2-java-demo

Spring Boot with HTTP/2
Java
7
star
63

spring-boot-apache-dubbo

Spring Boot 2.0 with Apache Dubbo
Java
7
star
64

markdown-chatgpt

Talk to ChatGPT from Markdown
Kotlin
7
star
65

trpc-spring-boot-starter

Spring Boot Starter for tRPC
Java
7
star
66

reactive-grpc-demo

gRPC with reactive Reactor
Java
6
star
67

unitTest_templates

unitTest IntelliJ IDEA plugin templates
6
star
68

proto-rsocket-plugin

Protobuf to RSocket service interface
Java
6
star
69

grpc-kotlin-demo

gRPC with Kotlin Demo
Kotlin
6
star
70

java11_in_action

Java 11 in Action
Java
6
star
71

markdown-wasm

Markdown wasm based on md4c for Deno 🦕
TypeScript
6
star
72

kotlin-deno-example

🦕Deno app development with Kotlin
Kotlin
6
star
73

zshmarks

zsh marks for oh-my-zsh
6
star
74

trunk-demo

WebAssembly development with Trunk & Vite.js
Rust
6
star
75

reactive-grpc-spring-boot-starter

Spring Boot Starter for Reactive gRPC
Java
6
star
76

hessian-spring-boot-starter

Spring Boot Start for Hessian
Java
6
star
77

alibaba-broker-example-parent

Alibaba RSocket Broker Example
Java
6
star
78

akka-demo

Akka Demo with Kotlin, Spring Integration
Java
5
star
79

intellij-templates

IntelliJ IDEA live templates
5
star
80

zookeeper-shell

New ZooKeeper shell just like bash
Java
5
star
81

embind_demo

Emscripten embind demo
C++
5
star
82

graal-native-image-demo

Graal native image demo with RSocket and Netty
Java
5
star
83

dkim-spring-boot-starter

DKIM for spring-boot-starter-mail
Java
5
star
84

akka-spring-boot-starter

akka-spring-boot-starter
Java
5
star
85

rsocket-dart

RSocket Dart SDK
Dart
4
star
86

deno-rust-wasm-demo

Deno with Rust Wasm
TypeScript
4
star
87

rest-graphql-rsocket-demo

One controller to combine HTTP REST, GraphQL and RSocket
Java
4
star
88

aria2-shell

Aria2 Shell
Java
4
star
89

spring-boot-starter-job-controller

Spring Boot with Job Controller
Java
4
star
90

aeron-demo

Aeron Spring Reactive Demo
Java
4
star
91

rsocket-transport-quic

RSocket QUIC transport
Java
4
star
92

spring-cloud-aliyun

Integration for Aliyun Cloud Services APIs with Spring Cloud
Shell
4
star
93

jvmtop

Clone from https://code.google.com/p/jvmtop
Java
4
star
94

kotlin-wasm-browser-demo

Kotlin WebAssembly demo for Browser
Kotlin
4
star
95

deno-httpx

httpx: cli to run requests from http file
TypeScript
4
star
96

kotlin-coroutine-demo

Kotlin Coroutines demo
Kotlin
4
star
97

spring-boot-polyglot-demo

Spring Boot Polyglot with Kotlin, Java + Lombok + Groovy
Kotlin
4
star
98

esnippet_idea_plugin

eSnippet IntelliJ IDEA plugin
Java
4
star
99

microservices-annotator

Java Annotations for Microservices annotator to mark your code
Java
3
star
100

logback-fluentd-appender

Logback Fluentd Appender
Java
3
star