Skip to content

Commit

Permalink
Merge pull request #105 from artnowo/master
Browse files Browse the repository at this point in the history
Fixed handling jdk-* and jre-* Java installation paths
  • Loading branch information
pron authored Jun 28, 2016
2 parents e2b5048 + a275eb3 commit 2b9a20c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 4 additions & 1 deletion capsule/src/main/java/Capsule.java
Original file line number Diff line number Diff line change
Expand Up @@ -4103,8 +4103,11 @@ static String isJavaDir(String fileName) {
m.find();
return shortJavaVersion(m.group(1));
} else if (fileName.startsWith("jdk") || fileName.startsWith("jre") || fileName.endsWith(".jdk") || fileName.endsWith(".jre")) {
if (fileName.startsWith("jdk") || fileName.startsWith("jre"))
if (fileName.startsWith("jdk-") || fileName.startsWith("jre-"))
fileName = fileName.substring(4);
else if (fileName.startsWith("jdk") || fileName.startsWith("jre"))
fileName = fileName.substring(3);

if (fileName.endsWith(".jdk") || fileName.endsWith(".jre"))
fileName = fileName.substring(0, fileName.length() - 4);
return shortJavaVersion(fileName);
Expand Down
2 changes: 2 additions & 0 deletions capsule/src/test/java/CapsuleTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -1300,6 +1300,8 @@ public void isJavaDir() {
assertEquals("1.8.0", Capsule.isJavaDir("jdk-8-oracle"));
assertEquals("1.8.0", Capsule.isJavaDir("jre-8-oracle"));
assertEquals("1.8.0", Capsule.isJavaDir("jdk-8-oracle-x64"));
assertEquals("1.8.0", Capsule.isJavaDir("jdk-1.8.0"));
assertEquals("1.8.0", Capsule.isJavaDir("jre-1.8.0"));
}

@Test
Expand Down

0 comments on commit 2b9a20c

Please sign in to comment.