What’s your favourite DLT product?
Me? R3 Corda, and v2.0 was released recently!
I had some trouble when I developed on IntelliJ IDEA.
Although I exported JAVA_HOME in .bashrc, it wasn’t reflected to GUI app(IDEA).
Please see the following steps.
Step1. set JAVA_HOME in your .bash_profile
1 2 3 |
# Your other settings export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_111.jdk/Contents/Home |
- run: source ~/.bash_profile
Step2. make .osx-env-sync.sh
~/.osx-env-sync.sh
1 2 3 |
grep export $HOME/.bash_profile | while IFS=' =' read ignoreexport envvar ignorevalue; do launchctl setenv ${envvar} ${!envvar} done |
Step3. make osx-env-sync.plist
~/Library/LaunchAgents/osx-env-sync.plist
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
<span class="cp"><?xml version="1.0" encoding="UTF-8"?></span> <span class="cp"><!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"></span> <span class="nt"><plist</span> <span class="na">version=</span><span class="s">"1.0"</span><span class="nt">></span> <span class="nt"><dict></span> <span class="nt"><key></span>Label<span class="nt"></key></span> <span class="nt"><string></span>osx-env-sync<span class="nt"></string></span> <span class="nt"><key></span>ProgramArguments<span class="nt"></key></span> <span class="nt"><array></span> <span class="nt"><string></span>bash<span class="nt"></string></span> <span class="nt"><string></span>-l<span class="nt"></string></span> <span class="nt"><string></span>-c<span class="nt"></string></span> <span class="nt"><string></span> $HOME/.osx-env-sync.sh <span class="nt"></string></span> <span class="nt"></array></span> <span class="nt"><key></span>RunAtLoad<span class="nt"></key></span> <span class="nt"><true/></span> <span class="nt"></dict></span> <span class="nt"></plist></span> |
Step4. change mode the file to executable
1 |
chmod +x ~/.osx-env-sync.sh |
Step5. make these preference valid
1 2 |
launchctl unload ~/Library/LaunchAgents/osx-env-sync.plist launchctl load ~/Library/LaunchAgents/osx-env-sync.plist |
Done! Please check if your GUI apps can read JAVA_HOME!!
I hope this article could be useful.