Locates path to Java executable. @return path to Java executable. @throws IllegalArgumentException When Recaf can't detect a path.
()
| 197 | * When Recaf can't detect a path. |
| 198 | */ |
| 199 | public static Path getJavaPath() { |
| 200 | Path javaHome = Paths.get(System.getProperty("java.home")); |
| 201 | Path bin = javaHome.resolve("bin"); |
| 202 | OSUtil os = OSUtil.getOSType(); |
| 203 | switch (os) { |
| 204 | case WINDOWS: |
| 205 | return bin.resolve("java.exe"); |
| 206 | case LINUX: |
| 207 | case MAC: |
| 208 | return bin.resolve("java"); |
| 209 | default: |
| 210 | throw new IllegalArgumentException("Don't know how to find Java path for: " + os.getMvnName()); |
| 211 | } |
| 212 | } |
| 213 | |
| 214 | /** |
| 215 | * Patches JDK stuff. |
no test coverage detected