source: AE/installer2/src/net/oni2/aeinstaller/backend/ToolLauncher.java@ 711

Last change on this file since 711 was 709, checked in by alloc, 12 years ago

AEI2: Refactorings for breaking out independent features into libraries

File size: 1.4 KB
Line 
1package net.oni2.aeinstaller.backend;
2
3import java.io.File;
4import java.util.Vector;
5
6import net.oni2.aeinstaller.backend.packages.Package;
7import net.oni2.applicationinvoker.AppExecution;
8import net.oni2.settingsmanager.Settings;
9import net.oni2.settingsmanager.Settings.Platform;
10
11/**
12 * @author Christian Illy
13 */
14public class ToolLauncher {
15 /**
16 * @param p
17 * Package of tool to launch
18 * @throws Exception
19 * If a required runtime is not found
20 */
21 public static void launch(Package p) throws Exception {
22 File exe = p.getExeFile();
23
24 Vector<String> params = new Vector<String>();
25 switch (p.getExeType()) {
26 case OSBINARY:
27 break;
28 case DOTNET:
29 if (!DotNet.isInstalled())
30 throw new Exception(".NET not found");
31 if (Settings.getPlatform() != Platform.WIN) {
32 params.add(DotNet.getRuntimeExe());
33 }
34 break;
35 case JAR:
36 File jre = null;
37 if (Settings.getPlatform() == Platform.WIN)
38 jre = new File(System.getProperties().getProperty(
39 "java.home"), "bin/javaw.exe");
40 else
41 jre = new File(System.getProperties().getProperty(
42 "java.home"), "bin/java");
43 if (!jre.exists())
44 throw new Exception("JRE not found");
45 params.add(jre.getPath());
46 params.add("-jar");
47 break;
48 }
49 params.add(exe.getPath());
50
51 File wd = p.getWorkingDir();
52
53 AppExecution.execute(params, wd);
54 }
55}
Note: See TracBrowser for help on using the repository browser.