Last change
on this file since 1147 was 724, checked in by alloc, 12 years ago |
Platform tools library (information about platform, program execution)
|
File size:
906 bytes
|
Line | |
---|
1 | package net.oni2.platformtools.applicationinvoker;
|
---|
2 |
|
---|
3 | import java.io.File;
|
---|
4 |
|
---|
5 | import net.oni2.platformtools.PlatformInformation;
|
---|
6 | import net.oni2.platformtools.PlatformInformation.Platform;
|
---|
7 |
|
---|
8 | /**
|
---|
9 | * @author Christian Illy
|
---|
10 | */
|
---|
11 | public class Java {
|
---|
12 | private static int isFound = -1;
|
---|
13 | private static File jre = null;
|
---|
14 |
|
---|
15 | /**
|
---|
16 | * @return Was a JRE found
|
---|
17 | */
|
---|
18 | public static boolean isInstalled() {
|
---|
19 | if (isFound < 0) {
|
---|
20 | getRuntimeExe();
|
---|
21 | }
|
---|
22 | return isFound == 1;
|
---|
23 | }
|
---|
24 |
|
---|
25 | /**
|
---|
26 | * @return The JRE executable
|
---|
27 | */
|
---|
28 | public static File getRuntimeExe() {
|
---|
29 | if (isFound < 0) {
|
---|
30 | File jrehome = new File(System.getProperties().getProperty(
|
---|
31 | "java.home"), "bin");
|
---|
32 | if (PlatformInformation.getPlatform() == Platform.WIN)
|
---|
33 | jre = new File(jrehome, "javaw.exe");
|
---|
34 | else
|
---|
35 | jre = new File(jrehome, "java");
|
---|
36 | if (!jre.exists()) {
|
---|
37 | isFound = 0;
|
---|
38 | jre = null;
|
---|
39 | } else {
|
---|
40 | isFound = 1;
|
---|
41 | }
|
---|
42 | }
|
---|
43 | return jre;
|
---|
44 | }
|
---|
45 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.