Skip to content

Commit

Permalink
javax.script.ScriptEngine 8 11 15 17
Browse files Browse the repository at this point in the history
  • Loading branch information
s50600822 committed Sep 20, 2023
1 parent b50bf41 commit 858d306
Show file tree
Hide file tree
Showing 6 changed files with 102 additions and 0 deletions.
12 changes: 12 additions & 0 deletions vs/java/ScriptEngine/Test.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import javax.script.ScriptEngineManager;
import javax.script.ScriptEngineFactory;

public class Test{
public static void main(String[] args){
// ScriptEngine engine = new ScriptEngineManager().getEngineByName("Nashorn");
// System.out.println(engine);
java.util.List<ScriptEngineFactory> eF = new ScriptEngineManager().getEngineFactories();
System.out.println(eF.size());
eF.forEach(f -> System.out.println(String.format("[%s] [%s]", f.getEngineName(), f.getClass())));
}
}
Binary file added vs/java/ScriptEngine/asm-9.1.jar
Binary file not shown.
9 changes: 9 additions & 0 deletions vs/java/ScriptEngine/b11r17.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
BUILD_JDK='11.0.14.10.1-amzn'
RUN_JDK='17.0.2.8.1-amzn'

sdk use java $BUILD_JDK && javac Test.java
sdk use java $RUN_JDK && java -cp nashorn-core-15.4.jar:asm-9.1.jar:. Test

# eg
# sdk use java 11.0.14.10.1-amzn && javac Test.java
# sdk use java 17.0.2.8.1-amzn && java -cp nashorn-core-15.4.jar:asm-9.1.jar:. Test
Binary file added vs/java/ScriptEngine/nashorn-core-15.4.jar
Binary file not shown.
80 changes: 80 additions & 0 deletions vs/java/ScriptEngine/sdk
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
sdk () {
COMMAND="$1"
QUALIFIER="$2"
case "$COMMAND" in
(l) COMMAND="list" ;;
(ls) COMMAND="list" ;;
(v) COMMAND="version" ;;
(u) COMMAND="use" ;;
(i) COMMAND="install" ;;
(rm) COMMAND="uninstall" ;;
(c) COMMAND="current" ;;
(ug) COMMAND="upgrade" ;;
(d) COMMAND="default" ;;
(h) COMMAND="home" ;;
(e) COMMAND="env" ;;
esac
if [[ "$COMMAND" != "update" ]]
then
___sdkman_check_candidates_cache "$SDKMAN_CANDIDATES_CACHE" || return 1
fi
SDKMAN_AVAILABLE="true"
if [ -z "$SDKMAN_OFFLINE_MODE" ]
then
SDKMAN_OFFLINE_MODE="false"
fi
__sdkman_update_service_availability
if [ -f "${SDKMAN_DIR}/etc/config" ]
then
source "${SDKMAN_DIR}/etc/config"
fi
if [[ -z "$COMMAND" ]]
then
___sdkman_help
return 1
fi
CMD_FOUND=""
if [[ "$COMMAND" != "selfupdate" || "$sdkman_selfupdate_feature" == "true" ]]
then
CMD_TARGET="${SDKMAN_DIR}/src/sdkman-${COMMAND}.sh"
if [[ -f "$CMD_TARGET" ]]
then
CMD_FOUND="$CMD_TARGET"
fi
fi
CMD_TARGET="${SDKMAN_DIR}/ext/sdkman-${COMMAND}.sh"
if [[ -f "$CMD_TARGET" ]]
then
CMD_FOUND="$CMD_TARGET"
fi
if [[ -z "$CMD_FOUND" ]]
then
echo ""
__sdkman_echo_red "Invalid command: $COMMAND"
echo ""
___sdkman_help
fi
if [[ -n "$QUALIFIER" && "$COMMAND" != "help" && "$COMMAND" != "offline" && "$COMMAND" != "flush" && "$COMMAND" != "selfupdate" && "$COMMAND" != "env" && "$COMMAND" != "completion" && "$COMMAND" != "edit" && "$COMMAND" != "home" && -z $(echo ${SDKMAN_CANDIDATES[@]} | grep -w "$QUALIFIER") ]]
then
echo ""
__sdkman_echo_red "Stop! $QUALIFIER is not a valid candidate."
return 1
fi
if [[ "$COMMAND" == "offline" && -n "$QUALIFIER" && -z $(echo "enable disable" | grep -w "$QUALIFIER") ]]
then
echo ""
__sdkman_echo_red "Stop! $QUALIFIER is not a valid offline mode."
fi
local final_rc=0
local native_command="${SDKMAN_DIR}/libexec/${COMMAND}"
if [ -f "$native_command" ]
then
"$native_command" "${@:2}"
elif [ -n "$CMD_FOUND" ]
then
local converted_command_name=$(echo "$COMMAND" | tr '-' '_')
__sdk_"$converted_command_name" "${@:2}"
fi
final_rc=$?
return $final_rc
}
1 change: 1 addition & 0 deletions vs/java/ScriptEngine/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
java -cp nashorn-core-15.4.jar:asm-9.1.jar:. Test

0 comments on commit 858d306

Please sign in to comment.