Russell, 

To develop and test against multiple versions of Java, I (and I’m aware other 
committers) use jenv [1] which is a version manager for Java. You can set a 
specific version for global/shell/local environments, and it allows switching 
very quickly. 

I generally run these two commands to switch:

$ jenv shell 1.8.0 # switch to JDK 8
$ jjh # alias defined below

# In my .zshrc (or whatever shell configuration file you use)
alias jjh='jenv version && jenv macos-javahome && jenv_set_java_home && jenv 
doctor’
alias jenv_set_java_home='export JAVA_HOME="$HOME/.jenv/versions/`jenv 
version-name`" && echo "JAVA_HOME=$JAVA_HOME”'

Setting the $JAVA_HOME ensures that mvn picks up the right Java version when it 
runs. 

[1] https://www.jenv.be/ <https://www.jenv.be/>



Andy LoPresto
[email protected]
[email protected]
He/Him
PGP Fingerprint: 70EC B3E5 98A6 5A3F D3C4  BACE 3C6E F65B 2F7D EF69

> On Aug 13, 2020, at 10:48 AM, Russell Bateman <[email protected]> wrote:
> 
> When installing NiFi in production, Ansible can be used to set up JAVA_HOME. 
> There is zero problem for users of NiFi.
> 
> However, from a development host, given the now rapid cadence of Java 
> releases, we sometimes run into problems launching a private installation of 
> NiFi in the course of testing or debugging our custom processors because 
> tools used minute-to-minute and all day long like IntelliJ IDEA (and others) 
> march on requiring later and later Java versions.
> 
> I found an old JIRA issue that suggests a solution for NiFi 0.1.0, that of 
> working around the problem by setting java=  in /conf/bootstrap.conf/ to 
> point to a valid Java 1.8 JRE/JDK. This sounds good to me, but the version is 
> very old.
> 
> Is this still best practice?
> 

Reply via email to