aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--setup/java-test/README.txt4
-rw-r--r--setup/java-test/Test.java5
-rw-r--r--setup/java-test/test.jarbin0 -> 846 bytes
-rwxr-xr-xsetup/package.sh1
-rwxr-xr-xsetup/setup.sh6
5 files changed, 13 insertions, 3 deletions
diff --git a/setup/java-test/README.txt b/setup/java-test/README.txt
new file mode 100644
index 000000000..b8ca72a7a
--- /dev/null
+++ b/setup/java-test/README.txt
@@ -0,0 +1,4 @@
+Create Java version test:
+
+javac -target 6 -source 6 Test.java
+jar cfe test.jar Test Test.class
diff --git a/setup/java-test/Test.java b/setup/java-test/Test.java
new file mode 100644
index 000000000..363d6953e
--- /dev/null
+++ b/setup/java-test/Test.java
@@ -0,0 +1,5 @@
+public class Test {
+ public static void main(String[] a) {
+ System.exit(Integer.parseInt(System.getProperty("java.version").split("\\.")[1]) >= 7 ? 0 : 1);
+ }
+}
diff --git a/setup/java-test/test.jar b/setup/java-test/test.jar
new file mode 100644
index 000000000..9bb41b3a0
--- /dev/null
+++ b/setup/java-test/test.jar
Binary files differ
diff --git a/setup/package.sh b/setup/package.sh
index 1070dbeba..b38371dda 100755
--- a/setup/package.sh
+++ b/setup/package.sh
@@ -118,6 +118,7 @@ package_unix () {
find out -type f \( -name \*.sh -o -name \*.vm \) -print0 | xargs -0 dos2unix
copy_files
+ cp java-test/test.jar out
cp setup.sh out
makeself --notemp out traccar.run "traccar" ./setup.sh
diff --git a/setup/setup.sh b/setup/setup.sh
index 43e183eea..2b0ad1e7e 100755
--- a/setup/setup.sh
+++ b/setup/setup.sh
@@ -2,16 +2,16 @@
if which java &>/dev/null
then
- if [ $(java -version 2>&1 | grep -i version | sed 's/.*version \"\(.*\)\.\(.*\)\..*\"/\1\2/; 1q') -lt 17 ]
+ if java -jar test.jar
then
- echo 'Java 7 or higher required'
- else
mkdir -p /opt/traccar
cp -r * /opt/traccar
rm -r ../out
rm /opt/traccar/setup.sh
chmod -r go+rX /opt/traccar
/opt/traccar/bin/installDaemon.sh
+ else
+ echo 'Java 7 or higher is required'
fi
else
echo 'Java runtime is required'