Finds all jre directories on the current machine. Win: typical bundled jre: {TRACKER_HOME}\jre\bin\java.exe typical jdk: Program Files\Java\jdkX.X.X_XX\jre\bin\java.exe typical jre: Program Files\Java\jreX.X.X_XX\bin\java.exe or Program Files\Java\jreX\bin\java.exe or Program Files\Java\jre-X\bin\j
()
| 233 | * @return a set of jre files |
| 234 | */ |
| 235 | private TreeSet<File> findJREs() { |
| 236 | while (isSearching) { |
| 237 | try { |
| 238 | Thread.sleep(200); |
| 239 | } catch (InterruptedException e) { |
| 240 | } |
| 241 | } |
| 242 | if (!isReady) { |
| 243 | allJREs.clear(); |
| 244 | isSearching = true; |
| 245 | // set of "Java level" directories to search |
| 246 | Set<File> searchPaths = new TreeSet<File>(); |
| 247 | |
| 248 | try { |
| 249 | // search for bundled jre |
| 250 | String trackerhome = System.getenv("TRACKER_HOME"); //$NON-NLS-1$ |
| 251 | if (trackerhome == null) { |
| 252 | trackerhome = (String)OSPRuntime.getPreference("TRACKER_HOME"); |
| 253 | } |
| 254 | if (trackerhome != null) { |
| 255 | File file = new File(trackerhome); |
| 256 | if (file.exists()) { |
| 257 | if (OSPRuntime.isMac()) { |
| 258 | String path = file.getParent() + "/runtime"; //$NON-NLS-1$ |
| 259 | searchPaths.add(new File(path)); |
| 260 | } else { |
| 261 | searchPaths.add(file); |
| 262 | } |
| 263 | } |
| 264 | } |
| 265 | if (OSPRuntime.isWindows()) { |
| 266 | String progfiles = System.getenv("ProgramFiles"); //$NON-NLS-1$ |
| 267 | String w6432 = System.getenv("ProgramW6432"); //$NON-NLS-1$ |
| 268 | String x86 = System.getenv("ProgramFiles(x86)"); //$NON-NLS-1$ |
| 269 | // add Program Files (may or may not be x86) Java directory to search path if it |
| 270 | // exists |
| 271 | if (progfiles != null) { |
| 272 | File file = new File(progfiles, "Java"); //$NON-NLS-1$ |
| 273 | if (file.exists()) |
| 274 | searchPaths.add(file); |
| 275 | } |
| 276 | // add "Program Files" Java directory to search path if it exists |
| 277 | if (w6432 != null) { // 64-bit Windows |
| 278 | File file = new File(w6432, "Java"); //$NON-NLS-1$ |
| 279 | if (file.exists()) |
| 280 | searchPaths.add(file); |
| 281 | } |
| 282 | // add "Program Files (x86)" Java directory to search path if it exists |
| 283 | if (x86 != null) { // 64-bit Windows |
| 284 | // add x86 Java directory to search path if it exists |
| 285 | File file = new File(x86, "Java"); //$NON-NLS-1$ |
| 286 | if (file.exists()) |
| 287 | searchPaths.add(file); |
| 288 | } |
| 289 | } else if (OSPRuntime.isMac()) { |
| 290 | if (trackerhome != null) { |
| 291 | File file = new File(trackerhome); |
| 292 | if (file.exists()) |
no test coverage detected