summaryrefslogtreecommitdiff
path: root/scripts/patch_gson.sh
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/patch_gson.sh')
-rwxr-xr-xscripts/patch_gson.sh13
1 files changed, 8 insertions, 5 deletions
diff --git a/scripts/patch_gson.sh b/scripts/patch_gson.sh
index d2981ea..348f01f 100755
--- a/scripts/patch_gson.sh
+++ b/scripts/patch_gson.sh
@@ -6,7 +6,10 @@
set -e
# Needed if you have a java version other than 11 as default
-JAVA_HOME=$(/usr/libexec/java_home -v 11)
+# and used if java_home is available
+if [ -f /usr/libexec/java_home ] ; then
+ JAVA_HOME=$(/usr/libexec/java_home -v 11)
+fi
# Download Gson jar
cd modules
@@ -15,15 +18,15 @@ curl https://repo1.maven.org/maven2/com/google/code/gson/gson/2.8.5/gson-2.8.5.j
# Unpack jar into modules/classes
mkdir classes
cd classes
-jar xf ../gson.jar
+$JAVA_HOME/bin/jar xf ../gson.jar
cd ..
# Compile module-info.java to module-info.class
-javac -p com.google.gson -d classes module-info.java
+$JAVA_HOME/bin/javac -p com.google.gson -d classes module-info.java
# Update gson.jar with module-info.class
-jar uf gson.jar -C classes module-info.class
+$JAVA_HOME/bin/jar uf gson.jar -C classes module-info.class
# Clean up
rm -rf classes
-cd .. \ No newline at end of file
+cd ..