Skip to content

Commit e33b9bb

Browse files
committed
Move java runtime to installer script
1 parent 97de044 commit e33b9bb

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

resources/tools/java-runtime.sh

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#!/bin/sh
2+
3+
# Stops script execution if a command has an error
4+
set -e
5+
6+
INSTALL_ONLY=0
7+
# Loop through arguments and process them: https://pretzelhands.com/posts/command-line-flags
8+
for arg in "$@"; do
9+
case $arg in
10+
-i|--install) INSTALL_ONLY=1 ; shift ;;
11+
*) break ;;
12+
esac
13+
done
14+
15+
if ! hash java 2>/dev/null; then
16+
echo "Installing Java Runtime. Please wait..."
17+
apt-get update
18+
apt-get install -y --no-install-recommends openjdk-11-jdk maven scala && \
19+
else
20+
echo "Java Runtime is already installed"
21+
fi
22+
23+
# Install vscode go extension
24+
if hash code 2>/dev/null; then
25+
LD_LIBRARY_PATH="" LD_PRELOAD="" code --user-data-dir=$HOME/.config/Code/ --extensions-dir=$HOME/.vscode/extensions/ --install-extension redhat.java
26+
else
27+
echo "Please install the desktop version of vscode via the vs-code-desktop.sh script to install go vscode extensions."
28+
fi
29+
30+
# Run
31+
if [ $INSTALL_ONLY = 0 ] ; then
32+
echo "Use java via command-line:"
33+
java --help
34+
sleep 20
35+
fi
36+

0 commit comments

Comments
 (0)