2024-03-24 08:06:44 +00:00
|
|
|
#!/bin/bash
|
2024-04-14 07:05:36 +00:00
|
|
|
# https://docs.sheetjs.com/docs/demos/engines/nashorn
|
2024-03-24 08:06:44 +00:00
|
|
|
cd /tmp
|
2024-04-14 07:05:36 +00:00
|
|
|
rm -rf sheetjs-nashorn
|
|
|
|
mkdir -p sheetjs-nashorn
|
|
|
|
cd sheetjs-nashorn
|
2024-03-24 08:06:44 +00:00
|
|
|
|
|
|
|
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
|
2024-06-25 07:16:41 +00:00
|
|
|
echo $n
|
2024-06-03 00:59:49 +00:00
|
|
|
export JAVA_HOME=`/usr/libexec/java_home -v $n`
|
2024-06-25 07:16:41 +00:00
|
|
|
echo $JAVA_HOME
|
2024-06-03 00:59:49 +00:00
|
|
|
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 -
|
2024-03-24 08:06:44 +00:00
|
|
|
done
|
|
|
|
|
|
|
|
# Built-in Nashorn
|
|
|
|
for n in 1.8 {9..14}; do
|
2024-06-03 00:59:49 +00:00
|
|
|
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 -
|
2024-03-24 08:06:44 +00:00
|
|
|
done
|