Merge lp:~matt-goodall/emusicj/fix-java-version-detection into lp:emusicj

Proposed by Matt Goodall
Status: Merged
Approved by: Robin Sheat
Approved revision: 312
Merged at revision: 312
Proposed branch: lp:~matt-goodall/emusicj/fix-java-version-detection
Merge into: lp:emusicj
Diff against target: 15 lines (+2/-2)
1 file modified
emusicj (+2/-2)
To merge this branch: bzr merge lp:~matt-goodall/emusicj/fix-java-version-detection
Reviewer Review Type Date Requested Status
Robin Sheat Approve
Review via email: mp+294727@code.launchpad.net

Commit message

Update startup script to also handle openjdk.

Description of the change

Tested IRL on xenial with the default-jre package installed:

$ java -version
openjdk version "1.8.0_91"
OpenJDK Runtime Environment (build 1.8.0_91-8u91-b14-0ubuntu4~16.04.1-b14)
OpenJDK 64-Bit Server VM (build 25.91-b14, mixed mode)

Also tested just enough of the script (script copied to a vm) to know the version check still works on trusty with default-jre:

$ java -version
java version "1.7.0_101"
OpenJDK Runtime Environment (IcedTea 2.6.6) (7u101-2.6.6-0ubuntu0.14.04.1)
OpenJDK 64-Bit Server VM (build 24.95-b01, mixed mode)

$ /tmp/emusicj
Using emusicj at /tmp
Couldn't find the compiled Java program.

To post a comment you must log in.
Revision history for this message
Robin Sheat (eythian) wrote :

Looks good, thanks. Will merge this in and release when I'm back home in a few days.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'emusicj'
2--- emusicj 2015-05-16 08:39:38 +0000
3+++ emusicj 2016-05-15 12:17:52 +0000
4@@ -7,9 +7,9 @@
5 # This function taken from Azureus, and modified
6 check_version()
7 {
8- JAVA_HEADER=`java -version 2>&1 | grep -i 'java version' | head -n 1`
9+ JAVA_HEADER=`java -version 2>&1 | grep -i -E '(java|openjdk) version' | head -n 1`
10 JAVA_IMPL=`echo ${JAVA_HEADER} | cut -f1 -d' '`
11- if [ "$JAVA_IMPL" = "java" ] ; then
12+ if [ "$JAVA_IMPL" = "java" -o "$JAVA_IMPL" = "openjdk" ] ; then
13 VERSION=`echo ${JAVA_HEADER} | sed "s/java version \"\(.*\)\"/\1/"`
14 if echo $VERSION | grep "^1.[0-4]" ; then
15 echo Your Java version is too old "[java = ${VERSION}]"

Subscribers

People subscribed via source and target branches

to all changes: