source: java/PlatformTools/src/net/oni2/platformtools/applicationinvoker/Java.java@ 1194

Last change on this file since 1194 was 724, checked in by alloc, 12 years ago

Platform tools library (information about platform, program execution)

File size: 906 bytes
Line 
1package net.oni2.platformtools.applicationinvoker;
2
3import java.io.File;
4
5import net.oni2.platformtools.PlatformInformation;
6import net.oni2.platformtools.PlatformInformation.Platform;
7
8/**
9 * @author Christian Illy
10 */
11public 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.