puniverse / capsule

Dead-Simple Packaging and Deployment for JVM Apps
http://capsule.io
Eclipse Public License 1.0
1.15k stars 100 forks source link

Fixed handling jdk-* and jre-* Java installation paths #105

Closed artnowo closed 8 years ago

artnowo commented 8 years ago

Without this change having paths starting with jdk- or jre- but without -openjdk nor -oracle at the end used to return version number like -1.7.0 which resulted in the following exception:

CAPSULE EXCEPTION: Could not parse version: -1.7.0 while processing system property java.home: /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.91.x86_64/jre
java.lang.IllegalArgumentException: Could not parse version: -1.7.0
       at Capsule.parseJavaVersion(Capsule.java:4241)
       at Capsule.getJavaHomes(Capsule.java:4067)
       at Capsule.getJavaHomes(Capsule.java:4032)
       at Capsule.findJavaHome(Capsule.java:2579)
       at Capsule.chooseJavaHome0(Capsule.java:2560)
       at Capsule.chooseJavaHome(Capsule.java:2548)
       at Capsule.getJavaHome(Capsule.java:2532)
       at Capsule.getJavaExecutable0(Capsule.java:2258)
       at Capsule.getJavaExecutable(Capsule.java:2250)
       at Capsule.buildJavaProcess(Capsule.java:2208)
       at Capsule.buildProcess0(Capsule.java:1524)
       at Capsule.buildProcess(Capsule.java:1515)
       at Capsule.prelaunch0(Capsule.java:1488)
       at Capsule.prelaunch(Capsule.java:1481)
       at Capsule.prepareForLaunch(Capsule.java:1334)
       at Capsule.launch(Capsule.java:1263)
       at Capsule.main0(Capsule.java:394)
       at Capsule.main(Capsule.java:374)

Workaround for this error at the moment is to explicitly set desired JDK installation path with the use of -Dcapsule.java.home.

coveralls commented 8 years ago

Coverage Status

Coverage increased (+0.02%) to 59.576% when pulling a275eb34b9fd9658179e2f606e57c37e64fe27d6 on artnowo:master into e2b5048e3b3eb4db0d859a4421e55739012d5bff on puniverse:master.

pron commented 8 years ago

Thank you!