blob: 64a762a677d6cb89795aa0b0f99cd412f9acab7c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
|
// **********************************************************************
//
// Copyright (c) 2003-2013 ZeroC, Inc. All rights reserved.
//
// This copy of Ice is licensed to you under the terms described in the
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************
package IceGridGUI;
import javax.swing.JOptionPane;
public class Fallback extends javax.swing.JApplet
{
public void start()
{
try
{
java.net.URL jar = Fallback.class.getProtectionDomain().getCodeSource().getLocation();
java.util.List<String> command = new java.util.ArrayList<String>();
command.add("java");
command.add("IceGridGUI.Main");
String[] args = MainProxy.args();
for(String arg : args)
{
command.add(arg);
}
ProcessBuilder pb = new ProcessBuilder(command);
java.util.Map<String, String> env = pb.environment();
String classPath = env.get("CLASSPATH");
classPath = classPath == null ? "" : classPath;
if(classPath.indexOf("IceGridGUI.jar") == -1)
{
if(classPath == "")
{
classPath = jar.getPath();
}
else
{
classPath = System.getProperty("path.separator") + jar.getPath();
}
env.put("CLASSPATH", classPath);
}
final Process p = pb.start();
if(p != null)
{
Runtime.getRuntime().addShutdownHook(new Thread()
{
public void run()
{
while(true)
{
try
{
p.waitFor();
break;
}
catch(InterruptedException ex)
{
}
}
}
});
}
//
// Exit from the JApplet after we have lauch IceGridGUI
//
System.exit(0);
}
catch(java.io.IOException ex)
{
ex.printStackTrace();
JOptionPane.showMessageDialog(null,
"IOException trying to start IceGrid Admin from Fallback class",
"IceGrid Admin Error",
JOptionPane.ERROR_MESSAGE);
//
// Exit from the JApplet after we have lauch IceGridGUI
//
System.exit(1);
}
}
}
|