JavaFilter class identifies java executable files.
| 428 | * JavaFilter class identifies java executable files. |
| 429 | */ |
| 430 | private static class JavaFilter implements FilenameFilter { |
| 431 | @Override |
| 432 | public boolean accept(File dir, String name) { |
| 433 | if (!dir.getPath().endsWith("bin")) //$NON-NLS-1$ |
| 434 | return false; |
| 435 | if (!OSPRuntime.isMac() && !dir.getParent().contains("jre")) //$NON-NLS-1$ |
| 436 | return false; |
| 437 | // reject older versions |
| 438 | if (dir.getPath().contains("1.7.") || dir.getPath().contains("jre7") //$NON-NLS-1$ //$NON-NLS-2$ |
| 439 | || dir.getPath().contains("1.6.") |
| 440 | || dir.getPath().contains("jre6") //$NON-NLS-1$ //$NON-NLS-2$ |
| 441 | || dir.getPath().contains("1.5.") || dir.getPath().contains("-5-") //$NON-NLS-1$ //$NON-NLS-2$ |
| 442 | || dir.getPath().contains("1.4.") || dir.getPath().contains("1.3.") //$NON-NLS-1$ //$NON-NLS-2$ |
| 443 | || dir.getPath().contains("1.2.")) //$NON-NLS-1$ |
| 444 | return false; |
| 445 | if (name.equals("java.exe")) //$NON-NLS-1$ |
| 446 | return true; // windows |
| 447 | if (name.equals("java")) //$NON-NLS-1$ |
| 448 | return true; // OSX |
| 449 | return false; |
| 450 | } |
| 451 | } |
| 452 | |
| 453 | /** |
| 454 | * JavaFile class is a File that sorts by Java version. |
nothing calls this directly
no outgoing calls
no test coverage detected