forked from cj0ne5/robocode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathset_java_options.sh
More file actions
executable file
·38 lines (31 loc) · 1.18 KB
/
Copy pathset_java_options.sh
File metadata and controls
executable file
·38 lines (31 loc) · 1.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/bin/sh
#
# Copyright (c) 2001-2023 Mathew A. Nelson and Robocode contributors
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0
# which accompanies this distribution, and is available at
# https://robocode.sourceforge.io/license/epl-v10.html
#
# ---------------------------------------------------------
# Extract Java version
# ---------------------------------------------------------
# Extract Java version
JAVA_VERSION=$(java -version 2>&1 | awk -F '"' '/version/ {print $2}')
JAVA_MAJOR_VERSION=$(echo "$JAVA_VERSION" | cut -d "." -f 1)
# Extract Java major version
if [ "$JAVA_MAJOR_VERSION" = 1 ]
then
JAVA_MAJOR_VERSION=$(echo "$JAVA_VERSION" | cut -d "." -f 2)
fi
export JAVA_VERSION
export JAVA_MAJOR_VERSION
# Print out Java version being used
echo Robocode is running on Java $JAVA_MAJOR_VERSION
# ---------------------------------------------------------
# Set Java options
# ---------------------------------------------------------
# Only set 'java.security.manager=allow' for Java version > 11
if [ "$JAVA_MAJOR_VERSION" -gt 11 ]
then
export _JAVA_OPTIONS="-Djava.security.manager=allow"
fi