Coder Social home page Coder Social logo

jenv's Introduction

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

jenv's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

jenv's Issues

Quiet cd

Don't print messages in cd() or __jenvtool_utils_echo_green when changing directories.

As a workaround, I put this in my ~/.bashrc:

[[ -s "/Users/andrew.pennebaker/.jenv/bin/jenv-init.sh" ]] && source "/Users/andrew.pennebaker/.jenv/bin/jenv-init.sh" && source "/Users/andrew.pennebaker/.jenv/commands/completion.sh"

# Silence successful jenv messages
function __jenvtool_utils_echo_green {
   echo $'\e[32m'"$1"$'\e[00m' >/dev/null
}
cd () {
  builtin cd "$@"
  if [[ -f "${PWD}/jenvrc" ]]; then
     echo "==============jenv load ======================" >/dev/null
     while read entry
     do
       if ! __jenvtool_utils_string_contains "$entry", "#" ; then
            candidate1=`echo ${entry} | sed 's/=.*//g'`
            version1=`echo ${entry} | sed 's/.*=//g'`
            if [ -d "${JENV_DIR}/candidates/${candidate1}/${version1}" ]; then
                __jenvtool_use "${candidate1}" "${version1}"
            else
                __jenvtool_install "${candidate1}" "${version1}"
            fi
            unset candidate1
            unset version1
       fi
     done < "${PWD}/jenvrc"
  fi
}

clojure 1.5.1 is not listed even it's in repo

$ jenv ls clojure
Available clojure Versions
=========================
   1.4.0
   1.3.0
   1.2.1

but

juven@juvens-mac mediate$ curl -s http://jenv.mvnsearch.org/candidate/clojure | grep  1.5.1
<td> 1.5.1</td>
<th>http://get.jvmtool.mvnsearch.org/download/clojure/clojure-1.5.1.zip</th>

使用source执行autorun.sh得到的$0不正确

在jenv-init.sh中使用了下面的代码来执行autorun.sh

source "${JENV_DIR}/candidates/${CANDIDATE}/current/autorun.sh"

但是使用source执行autorun.sh时,$0的值会是-bash

这样会造成一些项目的autorun.sh不能正常运行

例如maven中的autorun.sh

#!/bin/sh
app_dir=`dirname $0`
export M2_HOME="${app_dir}"

由于$0的值是-bash,所以每次登录就会提示这个错误

dirname: invalid option -- 'b'
Try `dirname --help' for more information.

可以考虑将autorun.sh中的$0都改为$BASH_SOURCE[0]

测试的Bash的版本是GNU bash, version 4.2.24(1)-release (x86_64-pc-linux-gnu)
#19 提到的应该是同一个问题

more candidates...

能否加入python, ruby&nodejs的支持,不知道这个能不能和rbenv一样支持插件rbenv(pyenv/nodenv)-build.
这样就不是jenv了,是allenv.

install local java should account for symlinks

When jenv copies a local java install into its directory, it is not properly copying symlinks. It copies the symlink verbatim as opposed to creating a symlink keeping relative paths intact.

Below shows this for the file cacerts

➜  locate cacerts | xargs ls -l
-r--r--r-- 1 root root 188473 Jul  9 21:50 /etc/pki/ca-trust/extracted/java/cacerts
lrwxrwxrwx 1 root root     40 Mar 16 19:46 /etc/pki/java/cacerts -> /etc/pki/ca-trust/extracted/java/cacerts
lrwxrwxrwx 1 phil phil     41 Jul  9 20:26 /home/phil/.jenv/candidates/java/1.7.0_101/jre/lib/security/cacerts -> ../../../../../../../etc/pki/java/cacerts
lrwxrwxrwx 1 phil phil     41 Jul  9 20:25 /home/phil/.jenv/candidates/java/1.8.0_92/jre/lib/security/cacerts -> ../../../../../../../etc/pki/java/cacerts
lrwxrwxrwx 1 root root     41 Jun 22 19:39 /usr/lib/jvm/java-1.7.0-openjdk-legacy-1.7.0.101-2.6.6.1.fc24.x86_64/jre/lib/security/cacerts -> ../../../../../../../etc/pki/java/cacerts
lrwxrwxrwx 1 root root     41 Jun 23 10:39 /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.92-3.b14.fc24.x86_64/jre/lib/security/cacerts -> ../../../../../../../etc/pki/java/cacerts

Add OpenJDK

I think it would be beneficial to add openJDK to the list of items that can be downloaded and installed.

jenv 自动提示出错

敲入 jenv <TAB> canidates
然后会出现:

Invalid command: canidates

Usage: jenv <command> <candidate> [version
...

这里应该有两个 typo:

  1. 自动补全candidates,但变成了canidates
  2. usage 中的 canidates

exporting bash functions causes jenv to emit spammy error messages

If I export -f a bash function, even something trivial and not having anything to do with jenv, subsequent runs of jenv produce a bunch of errors.

I have this block of code in my .bash_profile:

# dummy function whose existence / exported-ness shouldn't affect anything
foo() {
  echo "bar"
}

# Initialize jenv
eval "$(jenv init -)"

# This works without error.
jenv version

# Necessary if I want to be able to call foo from other scripts
export -f foo

# This now emits a bunch of errors in addition to apparently doing what it's supposed to do.
jenv version

Here is the output when I start a new shell, or source .bash_profile:

Last login: Wed Nov 19 18:12:27 on ttys010
oracle64-1.8.0.05 (set by /Users/ryan/.jenv/version)
bash: __BASH_FUNC<foo>(): line 0: syntax error near unexpected token `('
bash: __BASH_FUNC<foo>(): line 0: `__BASH_FUNC<foo>() () {  echo "bar"'
bash: error importing function definition for `__BASH_FUNC<foo>'
bash: __BASH_FUNC<foo>(): line 0: syntax error near unexpected token `('
bash: __BASH_FUNC<foo>(): line 0: `__BASH_FUNC<foo>() () {  echo "bar"'
bash: error importing function definition for `__BASH_FUNC<foo>'
bash: __BASH_FUNC<foo>(): line 0: syntax error near unexpected token `('
bash: __BASH_FUNC<foo>(): line 0: `__BASH_FUNC<foo>() () {  echo "bar"'
bash: error importing function definition for `__BASH_FUNC<foo>'
bash: __BASH_FUNC<foo>(): line 0: syntax error near unexpected token `('
bash: __BASH_FUNC<foo>(): line 0: `__BASH_FUNC<foo>() () {  echo "bar"'
bash: error importing function definition for `__BASH_FUNC<foo>'
bash: __BASH_FUNC<foo>(): line 0: syntax error near unexpected token `('
bash: __BASH_FUNC<foo>(): line 0: `__BASH_FUNC<foo>() () {  echo "bar"'
bash: error importing function definition for `__BASH_FUNC<foo>'
bash: __BASH_FUNC<foo>(): line 0: syntax error near unexpected token `('
bash: __BASH_FUNC<foo>(): line 0: `__BASH_FUNC<foo>() () {  echo "bar"'
bash: error importing function definition for `__BASH_FUNC<foo>'
bash: __BASH_FUNC<foo>(): line 0: syntax error near unexpected token `('
bash: __BASH_FUNC<foo>(): line 0: `__BASH_FUNC<foo>() () {  echo "bar"'
bash: error importing function definition for `__BASH_FUNC<foo>'
oracle64-1.8.0.05 (set by /Users/ryan/.jenv/version)

The first oracle64-1.8.0.05 line is the first call to jenv version; the second one produces all of that error output (it does produce the correct result though, at the bottom).

Anyone else seen this? I have no clue how/why such a thing could happen.

zsh 支持

试着在 zsh 下安装,发现有比较多的错误,比如:

__jenvtool_init:52: no matches found: JENV_CANDIDATES[@]

zsh 相对 bash 还是有很多优势的,不知可否支持下 zsh

Fix casing in documentation

In Unix environments, case often matters. For example, Java is not installed in .../home, but rather .../Home

Getting dirname error after installing on Mac OS X 10.9

After installing jenv on Mac OS X 10.9 Mavericks, I'm now getting error messages when sourcing ~/.jenv/bin/jenv-init.sh:

matthew@newt:~  
$  . .profile
dirname: illegal option -- b
usage: dirname path
matthew@newt:~ 

If I comment the sourcing of ~/.jenv/bin/jenv-init.sh in ~/.profile, the error message goes away. It doesn't seem to affect the operation of jenv, but it is annoying.

I grepped the shell scripts in ~.jenv/commands but couldn't find where dirname is getting called.

What gives?

Create more flexible candidate versions

For example, if I jenv install gradle 2.7, then jenv should create ~/.jenv/candidates/gradle/2, not just ~/.jenv/candidates/gradle/2.7.

This way, if my jenvrc says:

gradle=2

Then jenv is able to load Gradle 2.x as Gradle "2".

fabric8 install issue

{14-08-18 20:38}[ruby-2.1.2]~ % jenv install fabric8
Installing: fabric8 1.0.0
Parsing http://jenv.mvnsearch.org/candidate/fabric8/download/1.0.0/Darwin/x86_64

Downloading: fabric8 1.0.0

Downloading http://get.jenv.mvnsearch.org/download/fabric/fabric8-1.0.0.zip
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 319 100 319 0 0 202 0 0:00:01 0:00:01 --:--:-- 202
End-of-central-directory signature not found. Either this file is not
a zipfile, or it constitutes one disk of a multi-part archive. In the
latter case the central directory and zipfile comment will be found on
the last disk(s) of this archive.
unzip: cannot find zipfile directory in one of /Users/ashmit/.jenv/archives/fabric8-1.0.0.zip or
/Users/ashmit/.jenv/archives/fabric8-1.0.0.zip.zip, and cannot find /Users/ashmit/.jenv/archives/fabric8-1.0.0.zip.ZIP, period.

Stop! The archive was corrupt and has been removed! Please try installing again.

incorrect permission of clojure 1.5.1

uven@juvens-mac clojure$ ll
total 8
drw-r--r--  13 juven  staff  442 Mar 10 13:27 1.5.1
lrwxr-xr-x   1 juven  staff   43 Apr 27 13:54 current -> /Users/juven/.jenv/candidates/clojure/1.5.1
juven@juvens-mac clojure$ ls 1.5.1
ls: build.xml: Permission denied
ls: changes.md: Permission denied
ls: clojure-1.5.1-slim.jar: Permission denied
ls: clojure-1.5.1.jar: Permission denied
ls: clojure.iml: Permission denied
ls: doc: Permission denied
ls: epl-v10.html: Permission denied
ls: pom.xml: Permission denied
ls: readme.txt: Permission denied
ls: src: Permission denied
ls: test: Permission denied
juven@juvens-mac clojure$ chmod +x 1.5.1
juven@juvens-mac clojure$ ll 1.5.1
total 8976
-rw-r-----  1 juven  staff     5649 Mar 10 13:25 build.xml
-rw-r-----  1 juven  staff    49264 Mar 10 13:25 changes.md
-rw-r-----  1 juven  staff   913254 Mar 10 13:27 clojure-1.5.1-slim.jar
-rw-r-----  1 juven  staff  3585371 Mar 10 13:27 clojure-1.5.1.jar
-rw-r-----  1 juven  staff     1542 Mar 10 13:25 clojure.iml
drwxr-x---  3 juven  staff      102 Mar 10 13:25 doc
-rw-r-----  1 juven  staff    12917 Mar 10 13:25 epl-v10.html
-rw-r-----  1 juven  staff     6161 Mar 10 13:25 pom.xml
-rw-r-----  1 juven  staff     2783 Mar 10 13:27 readme.txt
drwxr-x---  7 juven  staff      238 Mar 10 13:25 src
drwxr-x---  4 juven  staff      136 Mar 10 13:25 test

Skip attempting to download 'java' candidates

When jenv fails to find a java candidate installed, it should skip searching the jenv candidate repository, since Java is not available there.

Instead, jenv should display example steps for getting that Java version setup with jenv, like:

JDK <version> not found. Try:

1. Installing Java <version>, such as from Oracle:

http://www.oracle.com/technetwork/java/javase/downloads/index.html

2. Linking java home into jenv candidates, e.g.:

ln -sf <java home> ~/.jenv/candidates/java/<version>

软件源更新&gitter

好多软件源都该更新了!!
另建议开通gitter房间便于交流,也便于大家给作者提交不定。

最后要谢谢的你的作品!!

Allow jenv to operate on a specific directory

Currently, it is a hard coded value:

JENV_DIR="$HOME/.jenv"

I think it's more useful to take it possibly from a parameter if present. The use case is that in operational environments, the HOME directory is not usually the place for such purposes. In the end you may call the installation script such as:

curl -L -s get.jenv.io | bash /opt/jenv

Install as default parameter option

Great work jenv team!

As docker gaining momentum on our workflow, is there already a way similar to non-interactively install candidate as default? Such as jenv install --default=no java 1.7 jdk-1.7 instead of creating auto=true on ${JENV}/conf/settings file. Although we can do it using symlink in two step or more. This feature would be Dockerfile friendly.

Thank you.

如何自建软件源?

现在每次都是从mvnsearch.org上来获取资源包,是否可以自定义来源,在内网环境就用不了。

谢谢你提供这么好用的管理工具!

git autocomplete in zsh stop working after install jenv

When using git alias provided by oh-my-zsh, the git autocomplete doesn't work.

Before install jenv:

$ gco <tab>
FETCH_HEAD                    origin/dylib                  origin/remove-prefix-warning  v0.1.2                      
HEAD                          origin/gh-pages               origin/user-gems              v0.2.0                      
master                        origin/HEAD                   origin/version-aliases        v0.2.1                      
ORIG_HEAD                     origin/master                 v0.1.0                        v0.3.0                      
origin/bundle-rehash          origin/readme-no-history      v0.1.1                        v0.4.0                      

After install jenv

$ gco <tab>
bin/          libexec/      plugins/      README.md     src/          version                                           
completions/  LICENSE       rbenv.d/      shims/        test/         versions/ 

Related info: ohmyzsh/ohmyzsh#4407

Apparently, removing/commenting setopt completealiases will fix the issue, and won't impart jenv's autocomplete feature.

logstash版本号不对应

安装logstash 1.4,但是下载的是1.4.0.zip,会导致错误:

mv: cannot stat `/home/tangxi/.jenv/tmp/*-1.4': No such file or directory

修改logstash.version中的1.4为1.4.0,又会出现

Parsing http://jenv.mvnsearch.org/candidate/logstash/download/1.4.0/Linux/x86_64
Candidate not foud!

expose load command with parameters

I would like to be able to use the load command with a candidate and version as parameters, so I could write my build script like ...

source ~/.profile &>/dev/null
curl -L -s get.jenv.io | bash
source ~/.jenv/bin/jenv-init.sh &>/dev/null
javaVersion=1.8.0_40
mavenVersion=3.0.5
jenv load java $javaVersion
jenv load maven $mavenVersion
export JAVA_HOME=~/.jenv/candidates/java/$javaVersion
export M2_HOME=~/.jenv/candidates/maven/$mavenVersion
$M2_HOME/bin/mvn -version

and I would expect output like

...
Apache Maven 3.0.5 (r01de14724cdef164cd33c7c8c2fe155faf9602da; 2013-02-19 14:51:28+0100)
Maven home: /home/cvsuser/.jenv/candidates/maven/3.0.5
Java version: 1.8.0_40, vendor: Oracle Corporation
Java home: /home/cvsuser/.jenv/candidates/java/1.8.0_40/jre
...

An alternate solution would be to not make the install more robust so it would first check for existing installation and not fail.

PowerShell 安装 Java 失败

PS C:\Users\peng> jenv list java
Avaliable java Versions
=====================================
   1.8.0_40
   1.8.0_31
   1.8.0_25
>* 1.8.0_20
   1.8.0_11
   1.8.0_05
   1.8.0
   1.7.0_75
   1.7.0_67
   1.7.0_65
   1.7.0_60
   1.7.0_55
   1.7.0_51
   1.7.0_45
   1.7.0_40
   1.7.0_25
   1.6.0_45
PS C:\Users\peng> jenv current java
c:\jenv\candidates\java\1.8.0_20
PS C:\Users\peng> java -version
java : 无法将“java”项识别为 cmdlet、函数、脚本文件或可运行程序的名称。请检查名称的拼写,如果包括路径,请确保路径正确
,然后再试一次。
所在位置 行:1 字符: 1
+ java -version
+ ~~~~
    + CategoryInfo          : ObjectNotFound: (java:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

Too slow

jenv is the slowest part of my bash configuration, often taking longer than a second to load. Please make jenv load faster, like chruby, nvm, and pyenv.

Getting more done in GitHub with ZenHub

Hola! @linux-china has created a ZenHub account for the linux-china organization. ZenHub is the leading team collaboration and project management solution built for GitHub.


How do I use ZenHub?

To get set up with ZenHub, all you have to do is download the browser extension and log in with your GitHub account. Once you do, you’ll get access to ZenHub’s complete feature-set immediately.

What can ZenHub do?

ZenHub adds a series of enhancements directly inside the GitHub UI:

  • Real-time, customizable task boards for GitHub issues;
  • Burndown charts, estimates, and velocity tracking based on GitHub Milestones;
  • Personal to-do lists and task prioritization;
  • “+1” button for GitHub issues and comments;
  • Drag-and-drop file sharing;
  • Time-saving shortcuts like a quick repo switcher.

Add ZenHub to GitHub

Still curious? See more ZenHub features or read user reviews. This issue was written by your friendly ZenHub bot, posted by request from @linux-china.

ZenHub Board

jenv repo update命令执行失败

zsh下面执行失败,打印如下信息

Updating all repositories
Beiging to update central/
__jenv_update_repository:5: no such file or directory: /Users/xxx/.jenv/tmp/repo-central/.zip
unzip:  cannot find or open /Users/xxx/.jenv/tmp/repo-central/.zip, /Users/xxx/.jenv/tmp/repo-central/.zip.zip or /Users/xxx/.jenv/tmp/repo-central/.zip.ZIP.
central/ updated!
Update done!

Uninstall JENV

How to install jenv? There no instructions in read me

no matches found: INSTALLED_VERSIONS

输入jenv list maven
得到了如下的错误:

Available maven Versions
=========================
__jenvtool_list:20: no matches found: INSTALLED_VERSIONS[@]

echo: write error: Bad file descriptor

When using jenvrc and running gradlew from inside the directory, getting the following error messages printed out to the console:

/home/<name>/.jenv/bin/jenv-init.sh: line 194: echo: write error: Bad file descriptor
/home/<name>/.jenv/commands/jenv-utils.sh: line 12: echo: write error: Bad file descriptor
/home/<name>/.jenv/bin/jenv-init.sh: line 194: echo: write error: Bad file descriptor
/home/<name>/.jenv/commands/jenv-utils.sh: line 12: echo: write error: Bad file descriptor

Running CentOS 6.7 - Kernel 2.6.32... 64-bit
Jenv version 0.1.0
GradleWrapper version: 2.4

Upon entering into the directory, no errors of this kind show, only when running a gradlew command, for example gradlew test

sdk man

发现jenv和sdkman一样一样的。。

Windows version?

Hi,

Any chance of getting this for Windows too? (without Cygwin)?

tnx.

go版本

建议加入go语言1.4 1.5 1.6版本

sed error when execute jenv list

rhel 5.7
jenv list java

sed: invalid option -- E
Usage: sed [OPTION]... {script-only-if-no-other-script} [input-file]...

-n, --quiet, --silent
suppress automatic printing of pattern space
-e script, --expression=script
add the script to the commands to be executed
-f script-file, --file=script-file
add the contents of script-file to the commands to be executed
-i[SUFFIX], --in-place[=SUFFIX]
edit files in place (makes backup if extension supplied)
-c, --copy
use copy instead of rename when shuffling files in -i mode
(avoids change of input file ownership)
-l N, --line-length=N
specify the desired line-wrap length for the `l' command
--posix
disable all GNU extensions.
-r, --regexp-extended
use extended regular expressions in the script.
-s, --separate
consider files as separate rather than as a single continuous
long stream.
-u, --unbuffered
load minimal amounts of data from the input files and flush
the output buffers more often
--help display this help and exit
--version output version information and exit

If no -e, --expression, -f, or --file option is given, then the first
non-option argument is taken as the sed script to interpret. All
remaining arguments are names of input files; if no input files are
specified, then the standard input is read.

E-mail bug reports to: [email protected] .
Be sure to include the word sed'' somewhere in theSubject:'' field.
sed: invalid option -- E
Usage: sed [OPTION]... {script-only-if-no-other-script} [input-file]...

-n, --quiet, --silent
suppress automatic printing of pattern space
-e script, --expression=script
add the script to the commands to be executed
-f script-file, --file=script-file
add the contents of script-file to the commands to be executed
-i[SUFFIX], --in-place[=SUFFIX]
edit files in place (makes backup if extension supplied)
-c, --copy
use copy instead of rename when shuffling files in -i mode
(avoids change of input file ownership)
-l N, --line-length=N
specify the desired line-wrap length for the `l' command
--posix
disable all GNU extensions.
-r, --regexp-extended
use extended regular expressions in the script.
-s, --separate
consider files as separate rather than as a single continuous
long stream.
-u, --unbuffered
load minimal amounts of data from the input files and flush
the output buffers more often
--help display this help and exit
--version output version information and exit

If no -e, --expression, -f, or --file option is given, then the first
non-option argument is taken as the sed script to interpret. All
remaining arguments are names of input files; if no input files are
specified, then the standard input is read.

E-mail bug reports to: [email protected] .
Be sure to include the word sed'' somewhere in theSubject:'' field.

Available java Versions

1.8.0-M7
1.7.0_25
1.7.0_21
1.7.0_17
1.6.0_45
1.6.0_43

  • 1.6.0_32

Not supported in cygwin 1.7.5 with win7_x64_en

#1.'jenv default java' cann't find installed jdk

by following your instructions to install java, the last step jenv default java 1.7.0_21 works well in linux, but failed in win7_x64_en with cygwin 1.7.5, here are cygwin's outputs:

daijun@daijun-x64 ~/.jenv/candidates/java 
$ pwd
/home/daijun/.jenv/candidates/java

daijun@daijun-x64 ~/.jenv/candidates/java 
$ ls -l
total 1
lrwxrwxrwx 1 daijun None 43 May 15 19:57 1.7.0_21 -> /cygdrive/c/Program Files/Java/jdk1.7.0_21/

daijun@daijun-x64 ~/.jenv/candidates/java 
$ jenv default java 1.7.0_21
Stop! java 1.7.0_21 is not installed.

#2.'jenv install' cann't get any zip from jenv.mvnsearch.org

After skipping the 'install java' step, I try to install maven and other tools. But it alaways return a 404 code. Could you make the download url of cygwin with x64 refer to 32bit's?

daijun@daijun-x64 /cygdrive/d/codes/lottery-queue
$ jenv install maven
Installing: maven 3.0.5
Parsing http://jenv.mvnsearch.org/candidate/maven/download/3.0.5/CYGWIN_NT-6.1-WOW64/i686
<html><head><title>Apache Tomcat/7.0.33 - Error report</title><style><!--H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A {color : black;}A.name {color : black;}HR {color : #525D76;}--></style> </head><body><h1>HTTP Status 404 - /candidate/maven/download/3.0.5/CYGWIN_NT-6.1-WOW64/i686</h1><HR size="1" noshade="noshade"><p><b>type</b> Status report</p><p><b>message</b> <u>/candidate/maven/download/3.0.5/CYGWIN_NT-6.1-WOW64/i686</u></p><p><b>description</b> <u>The requested resource is not available.</u></p><HR size="1" noshade="noshade"><h3>Apache Tomcat/7.0.33</h3></body></html>

selfupdate 提示 uname: illegal option -- o

zhongl-RMBP:stompize zhongl$ jenv version
Java enVironment Manager 0.0.1
zhongl-RMBP:stompize zhongl$ jenv selfupdate 

Updating jenv...
uname: illegal option -- o
usage: uname [-amnprsv]
Purge existing scripts...
Download new scripts to: /Users/zhongl/.jenv/tmp/jenv-0.0.1.zip
Extract script archive...


Successfully upgraded JENV.

VERY IMPORTANT!!!

JENV will stop working in the current shell when upgrading from 0.0.1 to 0.0.x

Please open a new terminal, or run the following in the existing one:

    source "/Users/zhongl/.jenv/bin/jenv-init.sh"


zhongl-RMBP:stompize zhongl$ uname -a
Darwin zhongl-RMBP.local 12.2.1 Darwin Kernel Version 12.2.1: Thu Oct 18 16:32:48 PDT 2012; root:xnu-2050.20.9~2/RELEASE_X86_64 x86_64
zhongl-RMBP:stompize zhongl$ uname -h
uname: illegal option -- h
usage: uname [-amnprsv]

我用的是Mac OX S 10.8.2

jenv repo update时出错

$ jenv repo update Updating all repositories Begin to update central/ -bash: /Users/XXX/.jenv/tmp/repo-central/.zip: No such file or directory unzip: cannot find or open /Users/XXX/.jenv/tmp/repo-central/.zip, /Users/XXX/.jenv/tmp/repo-central/.zip.zip or /Users/XXX.jenv/tmp/repo-central/.zip.ZIP.

ISSUE #26 的回答中提到fixed,但我还是遇到了这个问题。

config auto not work

I set jenv config auto to true,

jenv config auto true

but when I install java or tomcat , it still notice me

Do you want tomcat 7.0.68 to be set as default? (Y/n):

This is aweful when I want to batch install java or others software on many servers.

could you fix this?

Automatically detect and populate java candidates

Offer a command like jenv detect, that automatically finds all installed Java versions, and creates the appropriate candidate links.

For example, if Java 1.8.0_51 and 1.7.0_79 are installed, then jenv detect would create:

  • $HOME/.jenv/candidates/java
  • $HOME/.jenv/candidates/java/1.8
  • $HOME/.jenv/candidates/java/1.8.0
  • $HOME/.jenv/candidates/java/1.8.0_51
  • $HOME/.jenv/candidates/java/1.7
  • $HOME/.jenv/candidates/java/1.7.0
  • $HOME/.jenv/candidates/java/1.7.0_51

Stop! XXX is not a valid candidate. When jenv ls

Here is the log. It looks like missing some line for jenv repo update output. And jenv works well in some machine havenot upgrade...

$ jenv selfupdate

Updating jenv...
Purge existing scripts...
Download new scripts to: /home/chao/.jenv/tmp/jenv-0.1.0.zip
Extract script archive...

jenv upgraded successfully!
$ jenv repo update
Updating all repositories
Update done!
$ jenv ls java
Stop! java is not a valid candidate.
$ jenv ls gradle
Stop! gradle is not a valid candidate.
$ ls .jenv/repo/central/
candidates  candidates.txt  name.txt  url.txt  version
$ cat .jenv/repo/central/candidates
accumulo activator activemq ahc akka android ant antlr apacheds archiva artifactory avatar baratine bazel blur bookkeeper boot brooklyn btrace buildr bukkit burp byteman cassandra ceylon checker clojure crash csrf_tester ctakes datastaxdev dcsdk derby drill druid duke eclipselink elasticmq elasticsearch equinox exhibitor fabric8 felix flink flume flyway forge frege gae gaiden gant gatling gcviewer geronimo giraph gitbucket glassfish glide glu go go-agent go-server golo gora gosu gradle grails greys gridgain griffon groovy groovyhelp groovyserv gwt h2 hadoop hama hawt hazelcast hbase hedwig hive hornetq housemd immutant infinispan ireport jad jarinfo java javadoc jbake jboss jconvert jdsdk jena jenkins jetty jflex jhiccup jmeter jppfadmin jppfdriver jppfnode jrockit jruby jspwiki juddi jvmtop jython kaazing kafka karaf kibana knox kotlin kv lazybones lein liquibase logstash luke mahout mail_catcher marmotta mat maven mongodb mrql nailgun neo4j nexus nutch ofbiz openfire opensearch orientdb pgstudio pig play plugproxy presto proguard qpidbroker quercus redline relproxy resin restclient riak robovm roo rundeck s3cmd s4 sbt sbuild scala scribble seam shark simpleci sockettest solr sonar spark sqoop squirrelsql storm tair tajo tika tomcat tomee torquebox ttorent uima ultraesb vark vertx vfs virgo voldemort weblogic weka wildfly wlp wookie xd xwiki zico zookeeper zorka%

command 'cd' conflict after jenv installed

  1. Install on my Mac with:
    $ curl -L -s get.jenv.io | bash
  2. Try "cd ..", and jenv start downloading maven

➜ tasks cd ..
Installing: maven 3.0.5
Parsing http://jenv.mvnsearch.org/candidate/maven/download/3.0.5/Darwin/x86_64

Downloading: maven 3.0.5

Downloading http://get.jenv.mvnsearch.org/download/maven/maven-3.0.5.zip
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
21 5036k 21 1072k 0 0 605k 0 0:00:08 0:00:01 0:00:07 605k^Z[5] + 15237 suspended cd ..
(pwd now: ~)

  1. Try "which cd", shows:

➜ ~ which cd
cd () {
builtin cd "$@"
if [[ -f "${PWD}/jenvrc" ]]
then
while read entry
do
if ! __jenvtool_utils_string_contains "$entry", "#"
then
candidate1=echo ${entry} | sed 's/=.*//g'
version1=echo ${entry} | sed 's/.*=//g'
if [ -d "${JENV_DIR}/candidates/${candidate1}/${version1}" ]
then
__jenvtool_use "${candidate1}" "${version1}"
else
__jenvtool_install "${candidate1}" "${version1}"
fi
unset candidate1
unset version1
fi
done < "${PWD}/jenvrc"
fi
}

zsh support

Add zsh support for jenv.

  1. bash completion disabled
  2. compatible.

The issue switch java back and forth

I installed java 1.8.0 and 1.7.0_55 on my MAC, and followed the steps to install them in to jenv, but it could accept switching version only once. Then I checked the environment PATH and I found that both path of 1.8.0 and 1.7.0 were set in it . And I noticed that the PATH was set in script jenv_use.sh, I think it is unnecessary because we have $HOME/.jenv/candidates/java/current in PATH environment, we just need re-link current .

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.