Compare commits

...

4 Commits

Author SHA1 Message Date
Christopher Schultz
1a3d28205d Quote JAVA_HOME just in case it contains spaces. 2025-01-04 18:05:32 -05:00
Christopher Schultz
15dd265c54 Remove compile step for arch check 2025-01-04 17:40:35 -05:00
Christopher Schultz
5bc388f167 Use built-in method to determine JVM architecture
Use java -XshowSettings:properties instead of custom code
2025-01-04 17:38:11 -05:00
Christopher Schultz
6093ffba4c Be more coonsistent with language. 2025-01-04 17:26:18 -05:00
3 changed files with 3 additions and 31 deletions

Binary file not shown.

View File

@@ -1,18 +0,0 @@
public class PropertyPrint {
public static void main(String[] args) {
if(null == args || 0 == args.length) {
args = new String[] { "java.version" };
}
for(int i=0; i<args.length; ++i) {
String property = args[i];
if(i > 0) {
System.out.print(' ');
}
System.out.print(System.getProperty(property));
}
System.out.println();
}
}

View File

@@ -82,21 +82,11 @@ fi
echo "Using Java from $JAVA_HOME"
arch=$( arch )
if [ "$arch" = "x86_64" ] ; then
echo "Okay, using x86-64 platform."
echo "Using ${arch} platform."
elif [ "$arch" = "arm64" -o "$arch" = "aarch64" ] ; then
echo "Using aarm64 platform. Checking Java version..."
echo "Using ${arch} platform. Checking Java version..."
if [ -x "$JAVA_HOME/bin/javac" ] ; then
if [ ! -f PropertyPrint.class ] ; then
"$JAVA_HOME/bin/javac" -target 1.8 PropertyPrint.java
fi
else
echo "Cannot determine Java architecture because you do not have a JDK installed."
exit 1
fi
jarch=$( $JAVA_HOME/bin/java -classpath . PropertyPrint os.arch )
jarch=$( "${JAVA_HOME}/bin/java" -XshowSettings:properties -version 2>&1 | grep 'os.arch' | sed -e 's/.*=[ ]*//' )
if [ "x86_64" != "$jarch" ] ; then
echo "*"