docs.sheetjs.com/tests/engines-nashorn.sh

51 lines
2.2 KiB
Bash
Executable File

#!/bin/bash
# https://docs.sheetjs.com/docs/demos/engines/nashorn
cd /tmp
rm -rf sheetjs-nashorn
mkdir -p sheetjs-nashorn
cd sheetjs-nashorn
curl -LO https://cdn.sheetjs.com/xlsx-latest/package/dist/xlsx.full.min.js
curl -LO https://cdn.sheetjs.com/xlsx-latest/package/dist/shim.min.js
curl -LO https://sheetjs.com/pres.xlsx
curl -LO https://docs.sheetjs.com/nashorn/SheetJSNashorn.java
curl -L -o nashorn-core-15.4.jar "https://search.maven.org/remotecontent?filepath=org/openjdk/nashorn/nashorn-core/15.4/nashorn-core-15.4.jar"
curl -L -o asm-9.5.jar "https://search.maven.org/remotecontent?filepath=org/ow2/asm/asm/9.5/asm-9.5.jar"
curl -L -o asm-tree-9.5.jar "https://search.maven.org/remotecontent?filepath=org/ow2/asm/asm-tree/9.5/asm-tree-9.5.jar"
curl -L -o asm-commons-9.5.jar "https://search.maven.org/remotecontent?filepath=org/ow2/asm/asm-commons/9.5/asm-commons-9.5.jar"
curl -L -o asm-analysis-9.5.jar "https://search.maven.org/remotecontent?filepath=org/ow2/asm/asm-analysis/9.5/asm-analysis-9.5.jar"
curl -L -o asm-util-9.5.jar "https://search.maven.org/remotecontent?filepath=org/ow2/asm/asm-util/9.5/asm-util-9.5.jar"
# Standalone Nashorn
for n in {15..22}; do
echo $n
export JAVA_HOME=`/usr/libexec/java_home -v $n`
echo $JAVA_HOME
java -version
rm -fr SheetJSNashorn.class SheetJSNashorn.jar sheethorn
javac SheetJSNashorn.java
java -cp .:asm-9.5.jar:asm-tree-9.5.jar:asm-commons-9.5.jar:asm-analysis-9.5.jar:asm-util-9.5.jar:nashorn-core-15.4.jar SheetJSNashorn pres.xlsx
jar -cf SheetJSNashorn.jar SheetJSNashorn.class xlsx.full.min.js shim.min.js
mkdir -p sheethorn
cp *.jar pres.xlsx sheethorn
cd sheethorn
java -cp .:asm-9.5.jar:asm-tree-9.5.jar:asm-commons-9.5.jar:asm-analysis-9.5.jar:asm-util-9.5.jar:nashorn-core-15.4.jar:SheetJSNashorn.jar SheetJSNashorn pres.xlsx
cd -
done
# Built-in Nashorn
for n in 1.8 {9..14}; do
export JAVA_HOME=`/usr/libexec/java_home -v $n`
java -version
rm -fr SheetJSNashorn.class SheetJSNashorn.jar sheethorn
javac SheetJSNashorn.java
java SheetJSNashorn pres.xlsx
jar -cf SheetJSNashorn.jar SheetJSNashorn.class xlsx.full.min.js shim.min.js
mkdir -p sheethorn
cp *.jar pres.xlsx sheethorn
cd sheethorn
java -cp .:SheetJSNashorn.jar SheetJSNashorn pres.xlsx
cd -
done