jruby-launcher 1.1.1-java → 1.1.2-java
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/COPYING +826 -826
- data/Makefile +122 -122
- data/README.md +64 -64
- data/Rakefile +51 -51
- data/argnames.h +35 -35
- data/argparser.cpp +668 -667
- data/argparser.h +78 -78
- data/extconf.rb +7 -7
- data/inc/Makefile-conf.mk +76 -76
- data/inc/Makefile-impl.mk +107 -107
- data/inc/Makefile-rules.mk +40 -40
- data/jruby.cpp +77 -77
- data/jrubyexe.cpp +84 -84
- data/jvmlauncher.cpp +459 -454
- data/jvmlauncher.h +143 -143
- data/lib/jruby-launcher.rb +3 -3
- data/lib/rubygems/defaults/jruby_native.rb +4 -4
- data/nbexecloader.h +43 -43
- data/ng.c +730 -730
- data/platformlauncher.cpp +252 -252
- data/platformlauncher.h +73 -73
- data/rb_w32_cmdvector.h +287 -287
- data/resources/jruby.rc +25 -25
- data/spec/launcher_spec.rb +262 -258
- data/spec/spec_helper.rb +81 -81
- data/strlcpy.c +72 -72
- data/unixlauncher.cpp +100 -100
- data/unixlauncher.h +22 -22
- data/utilsfuncs.cpp +279 -279
- data/utilsfuncs.h +85 -85
- data/utilsfuncswin.cpp +229 -229
- data/version.h +1 -1
- metadata +3 -3
data/platformlauncher.cpp
CHANGED
@@ -1,252 +1,252 @@
|
|
1
|
-
/*
|
2
|
-
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
|
3
|
-
*
|
4
|
-
* Copyright 2009-2012 JRuby Team (www.jruby.org).
|
5
|
-
* Copyright 1997-2008 Sun Microsystems, Inc. All rights reserved.
|
6
|
-
*
|
7
|
-
* The contents of this file are subject to the terms of either the GNU
|
8
|
-
* General Public License Version 2 only ("GPL") or the Common
|
9
|
-
* Development and Distribution License("CDDL") (collectively, the
|
10
|
-
* "License"). You may not use this file except in compliance with the
|
11
|
-
* License. You can obtain a copy of the License at
|
12
|
-
* http://www.netbeans.org/cddl-gplv2.html
|
13
|
-
* or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
|
14
|
-
* specific language governing permissions and limitations under the
|
15
|
-
* License. When distributing the software, include this License Header
|
16
|
-
* Notice in each file and include the License file at
|
17
|
-
* nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
|
18
|
-
* particular file as subject to the "Classpath" exception as provided
|
19
|
-
* by Sun in the GPL Version 2 section of the License file that
|
20
|
-
* accompanied this code. If applicable, add the following below the
|
21
|
-
* License Header, with the fields enclosed by brackets [] replaced by
|
22
|
-
* your own identifying information:
|
23
|
-
* "Portions Copyrighted [year] [name of copyright owner]"
|
24
|
-
*
|
25
|
-
* Contributor(s):
|
26
|
-
*
|
27
|
-
* The Original Software is NetBeans. The Initial Developer of the Original
|
28
|
-
* Software is Sun Microsystems, Inc. Portions Copyright 1997-2008 Sun
|
29
|
-
* Microsystems, Inc. All Rights Reserved.
|
30
|
-
*
|
31
|
-
* If you wish your version of this file to be governed by only the CDDL
|
32
|
-
* or only the GPL Version 2, indicate your decision by adding
|
33
|
-
* "[Contributor] elects to include this software in this distribution
|
34
|
-
* under the [CDDL or GPL Version 2] license." If you do not indicate a
|
35
|
-
* single choice of license, a recipient has the option to distribute
|
36
|
-
* your version of this file under either the CDDL, the GPL Version 2 or
|
37
|
-
* to extend the choice of license to its licensees as provided above.
|
38
|
-
* However, if you add GPL Version 2 code and therefore, elected the GPL
|
39
|
-
* Version 2 license, then the option applies only if the new code is
|
40
|
-
* made subject to such option by the copyright holder.
|
41
|
-
*
|
42
|
-
* Author: Tomas Holy
|
43
|
-
*/
|
44
|
-
|
45
|
-
#include <stdio.h>
|
46
|
-
#include "utilsfuncs.h"
|
47
|
-
#include "platformlauncher.h"
|
48
|
-
#include "rb_w32_cmdvector.h"
|
49
|
-
|
50
|
-
using namespace std;
|
51
|
-
|
52
|
-
extern "C" int nailgunClientMain(int argc, char *argv[], char *env[]);
|
53
|
-
|
54
|
-
PlatformLauncher::PlatformLauncher()
|
55
|
-
: ArgParser()
|
56
|
-
, suppressConsole(false)
|
57
|
-
{
|
58
|
-
separateProcess = false;
|
59
|
-
}
|
60
|
-
|
61
|
-
PlatformLauncher::PlatformLauncher(const PlatformLauncher& orig)
|
62
|
-
: ArgParser(orig)
|
63
|
-
{
|
64
|
-
}
|
65
|
-
|
66
|
-
PlatformLauncher::~PlatformLauncher() {
|
67
|
-
}
|
68
|
-
|
69
|
-
list<string>* GetEnvStringsAsList() {
|
70
|
-
char * env = GetEnvironmentStrings();
|
71
|
-
list<string> * envList = new list<string>();
|
72
|
-
while (*env) {
|
73
|
-
envList->push_back(env);
|
74
|
-
env = env + strlen(env) + 1;
|
75
|
-
}
|
76
|
-
return envList;
|
77
|
-
}
|
78
|
-
|
79
|
-
bool PlatformLauncher::start(char* argv[], int argc, DWORD *retCode, const char* binaryName) {
|
80
|
-
|
81
|
-
// subvert cmd.exe's feeble attempt at command line parsing,
|
82
|
-
// the code is taken from MRI
|
83
|
-
argc = rb_w32_cmdvector(GetCommandLine(), &argv);
|
84
|
-
|
85
|
-
// remove the first argument ('jruby')
|
86
|
-
argc -= 1;
|
87
|
-
argv += 1;
|
88
|
-
|
89
|
-
platformDir = binaryName;
|
90
|
-
checkLoggingArg(argc, argv, false);
|
91
|
-
if (!initPlatformDir()
|
92
|
-
|| !parseArgs(argc, argv)
|
93
|
-
|| !checkJDKHome()) {
|
94
|
-
return false;
|
95
|
-
}
|
96
|
-
disableFolderVirtualization(GetCurrentProcess());
|
97
|
-
|
98
|
-
if (nailgunClient) {
|
99
|
-
progArgs.push_front("org.jruby.util.NailMain");
|
100
|
-
char ** nailArgv = convertToArgvArray(progArgs);
|
101
|
-
if (printCommandLine) {
|
102
|
-
printListToConsole(progArgs);
|
103
|
-
return true;
|
104
|
-
}
|
105
|
-
|
106
|
-
list<string>* envList = GetEnvStringsAsList();
|
107
|
-
char ** nailEnv = convertToArgvArray(*envList);
|
108
|
-
nailgunClientMain(progArgs.size(), nailArgv, nailEnv);
|
109
|
-
return true;
|
110
|
-
}
|
111
|
-
|
112
|
-
if (binaryName) {
|
113
|
-
// clean up the binaryName first,
|
114
|
-
// remove '.exe' from the end, and the possible path.
|
115
|
-
string bn = binaryName;
|
116
|
-
|
117
|
-
size_t found = bn.find_last_of("/\\");
|
118
|
-
if (found != string::npos) {
|
119
|
-
logMsg("The binary name contains slashes, will remove: %s", binaryName);
|
120
|
-
bn = bn.substr(found + 1);
|
121
|
-
binaryName = bn.c_str();
|
122
|
-
}
|
123
|
-
|
124
|
-
found = bn.find(".exe", bn.length() - 4);
|
125
|
-
if (found != string::npos) {
|
126
|
-
bn.erase(found, 4);
|
127
|
-
binaryName = bn.c_str();
|
128
|
-
logMsg("*** Cleaned up the binary name: %s", binaryName);
|
129
|
-
} else {
|
130
|
-
logMsg("*** No need to clean the binary name: %s", binaryName);
|
131
|
-
}
|
132
|
-
|
133
|
-
if (strnicmp(binaryName, DEFAULT_EXECUTABLE, strlen(DEFAULT_EXECUTABLE)) != 0) {
|
134
|
-
logMsg("PlatformLauncher:\n\tNon-default executable name: %s", binaryName);
|
135
|
-
logMsg("\tHence, launching with extra parameters: -S %s", binaryName);
|
136
|
-
progArgs.push_front(binaryName);
|
137
|
-
progArgs.push_front("-S");
|
138
|
-
}
|
139
|
-
}
|
140
|
-
|
141
|
-
prepareOptions();
|
142
|
-
|
143
|
-
string java("");
|
144
|
-
|
145
|
-
if (getenv("JAVACMD") != NULL) {
|
146
|
-
java = getenv("JAVACMD");
|
147
|
-
jvmLauncher.setJavaCmd(java);
|
148
|
-
separateProcess = true;
|
149
|
-
suppressConsole = false;
|
150
|
-
} else {
|
151
|
-
if (jdkhome.empty()) {
|
152
|
-
if (!jvmLauncher.initialize(REQ_JAVA_VERSION)) {
|
153
|
-
logErr(false, true, "Cannot find Java %s or higher.", REQ_JAVA_VERSION);
|
154
|
-
return false;
|
155
|
-
}
|
156
|
-
}
|
157
|
-
|
158
|
-
jvmLauncher.getJavaPath(jdkhome);
|
159
|
-
java = jdkhome + "\\bin\\java";
|
160
|
-
}
|
161
|
-
|
162
|
-
if (printCommandLine) {
|
163
|
-
list<string> commandLine;
|
164
|
-
commandLine.push_back(java);
|
165
|
-
addOptionsToCommandLine(commandLine);
|
166
|
-
for (list<string>::iterator it = commandLine.begin(); it != commandLine.end(); it++) {
|
167
|
-
printf("%s\n", it->c_str());
|
168
|
-
}
|
169
|
-
return true;
|
170
|
-
}
|
171
|
-
|
172
|
-
if (nextAction.empty()) {
|
173
|
-
while (true) {
|
174
|
-
// run app
|
175
|
-
if (!run(retCode)) {
|
176
|
-
return false;
|
177
|
-
}
|
178
|
-
|
179
|
-
break;
|
180
|
-
}
|
181
|
-
} else {
|
182
|
-
logErr(false, true, "We should not get here.");
|
183
|
-
return false;
|
184
|
-
}
|
185
|
-
|
186
|
-
return true;
|
187
|
-
}
|
188
|
-
|
189
|
-
bool PlatformLauncher::run(DWORD *retCode) {
|
190
|
-
logMsg("Starting application...");
|
191
|
-
|
192
|
-
jvmLauncher.setSuppressConsole(suppressConsole);
|
193
|
-
|
194
|
-
bool rc = jvmLauncher.start(bootclass.c_str(), progArgs, javaOptions, separateProcess, retCode);
|
195
|
-
if (!separateProcess) {
|
196
|
-
exit(0);
|
197
|
-
}
|
198
|
-
return rc;
|
199
|
-
}
|
200
|
-
|
201
|
-
bool PlatformLauncher::checkJDKHome() {
|
202
|
-
if (!jdkhome.empty() && !jvmLauncher.initialize(jdkhome.c_str())) {
|
203
|
-
logMsg("Cannot locate java installation in specified jdkhome: %s", jdkhome.c_str());
|
204
|
-
string errMsg = "ERROR: Cannot locate Java installation in specified jdkhome:\n";
|
205
|
-
errMsg += jdkhome;
|
206
|
-
string errMsgFull = errMsg + "\nDo you want to try to use default version?";
|
207
|
-
jdkhome = "";
|
208
|
-
// Pop-up the message box only if there is no console
|
209
|
-
if (!isConsoleAttached()) {
|
210
|
-
if (::MessageBox(NULL, errMsgFull.c_str(), "Invalid jdkhome specified", MB_ICONQUESTION | MB_YESNO) == IDNO) {
|
211
|
-
return false;
|
212
|
-
}
|
213
|
-
} else {
|
214
|
-
fprintf(stdout, "%s\n", errMsg.c_str());
|
215
|
-
return false;
|
216
|
-
}
|
217
|
-
}
|
218
|
-
|
219
|
-
if (jdkhome.empty()) {
|
220
|
-
logMsg("-Xjdkhome is not set, checking for %%JAVA_HOME%%...");
|
221
|
-
char *origJavaHome = getenv("JAVA_HOME");
|
222
|
-
if (origJavaHome) {
|
223
|
-
string javaHome = trimTrailingBackslashes(origJavaHome);
|
224
|
-
logMsg("%%JAVA_HOME%% is set: %s", javaHome.c_str());
|
225
|
-
if (!jvmLauncher.initialize(javaHome.c_str())) {
|
226
|
-
logMsg("ERROR: Cannot locate java installation, specified by JAVA_HOME: %s", javaHome.c_str());
|
227
|
-
string errMsg = "Cannot locate Java installation, specified by JAVA_HOME:\n";
|
228
|
-
errMsg += javaHome;
|
229
|
-
string errMsgFull = errMsg + "\nDo you want to try to use default version?";
|
230
|
-
jdkhome = "";
|
231
|
-
// Pop-up the message box only if there is no console
|
232
|
-
if (!isConsoleAttached()) {
|
233
|
-
if (::MessageBox(NULL, errMsgFull.c_str(),
|
234
|
-
"Invalid jdkhome specified", MB_ICONQUESTION | MB_YESNO) == IDNO) {
|
235
|
-
return false;
|
236
|
-
}
|
237
|
-
} else {
|
238
|
-
fprintf(stdout, "%s\n", errMsg.c_str());
|
239
|
-
return false;
|
240
|
-
}
|
241
|
-
} else {
|
242
|
-
jdkhome = javaHome;
|
243
|
-
}
|
244
|
-
}
|
245
|
-
}
|
246
|
-
|
247
|
-
return true;
|
248
|
-
}
|
249
|
-
|
250
|
-
void PlatformLauncher::onExit() {
|
251
|
-
logMsg("onExit()");
|
252
|
-
}
|
1
|
+
/*
|
2
|
+
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
|
3
|
+
*
|
4
|
+
* Copyright 2009-2012 JRuby Team (www.jruby.org).
|
5
|
+
* Copyright 1997-2008 Sun Microsystems, Inc. All rights reserved.
|
6
|
+
*
|
7
|
+
* The contents of this file are subject to the terms of either the GNU
|
8
|
+
* General Public License Version 2 only ("GPL") or the Common
|
9
|
+
* Development and Distribution License("CDDL") (collectively, the
|
10
|
+
* "License"). You may not use this file except in compliance with the
|
11
|
+
* License. You can obtain a copy of the License at
|
12
|
+
* http://www.netbeans.org/cddl-gplv2.html
|
13
|
+
* or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
|
14
|
+
* specific language governing permissions and limitations under the
|
15
|
+
* License. When distributing the software, include this License Header
|
16
|
+
* Notice in each file and include the License file at
|
17
|
+
* nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
|
18
|
+
* particular file as subject to the "Classpath" exception as provided
|
19
|
+
* by Sun in the GPL Version 2 section of the License file that
|
20
|
+
* accompanied this code. If applicable, add the following below the
|
21
|
+
* License Header, with the fields enclosed by brackets [] replaced by
|
22
|
+
* your own identifying information:
|
23
|
+
* "Portions Copyrighted [year] [name of copyright owner]"
|
24
|
+
*
|
25
|
+
* Contributor(s):
|
26
|
+
*
|
27
|
+
* The Original Software is NetBeans. The Initial Developer of the Original
|
28
|
+
* Software is Sun Microsystems, Inc. Portions Copyright 1997-2008 Sun
|
29
|
+
* Microsystems, Inc. All Rights Reserved.
|
30
|
+
*
|
31
|
+
* If you wish your version of this file to be governed by only the CDDL
|
32
|
+
* or only the GPL Version 2, indicate your decision by adding
|
33
|
+
* "[Contributor] elects to include this software in this distribution
|
34
|
+
* under the [CDDL or GPL Version 2] license." If you do not indicate a
|
35
|
+
* single choice of license, a recipient has the option to distribute
|
36
|
+
* your version of this file under either the CDDL, the GPL Version 2 or
|
37
|
+
* to extend the choice of license to its licensees as provided above.
|
38
|
+
* However, if you add GPL Version 2 code and therefore, elected the GPL
|
39
|
+
* Version 2 license, then the option applies only if the new code is
|
40
|
+
* made subject to such option by the copyright holder.
|
41
|
+
*
|
42
|
+
* Author: Tomas Holy
|
43
|
+
*/
|
44
|
+
|
45
|
+
#include <stdio.h>
|
46
|
+
#include "utilsfuncs.h"
|
47
|
+
#include "platformlauncher.h"
|
48
|
+
#include "rb_w32_cmdvector.h"
|
49
|
+
|
50
|
+
using namespace std;
|
51
|
+
|
52
|
+
extern "C" int nailgunClientMain(int argc, char *argv[], char *env[]);
|
53
|
+
|
54
|
+
PlatformLauncher::PlatformLauncher()
|
55
|
+
: ArgParser()
|
56
|
+
, suppressConsole(false)
|
57
|
+
{
|
58
|
+
separateProcess = false;
|
59
|
+
}
|
60
|
+
|
61
|
+
PlatformLauncher::PlatformLauncher(const PlatformLauncher& orig)
|
62
|
+
: ArgParser(orig)
|
63
|
+
{
|
64
|
+
}
|
65
|
+
|
66
|
+
PlatformLauncher::~PlatformLauncher() {
|
67
|
+
}
|
68
|
+
|
69
|
+
list<string>* GetEnvStringsAsList() {
|
70
|
+
char * env = GetEnvironmentStrings();
|
71
|
+
list<string> * envList = new list<string>();
|
72
|
+
while (*env) {
|
73
|
+
envList->push_back(env);
|
74
|
+
env = env + strlen(env) + 1;
|
75
|
+
}
|
76
|
+
return envList;
|
77
|
+
}
|
78
|
+
|
79
|
+
bool PlatformLauncher::start(char* argv[], int argc, DWORD *retCode, const char* binaryName) {
|
80
|
+
|
81
|
+
// subvert cmd.exe's feeble attempt at command line parsing,
|
82
|
+
// the code is taken from MRI
|
83
|
+
argc = rb_w32_cmdvector(GetCommandLine(), &argv);
|
84
|
+
|
85
|
+
// remove the first argument ('jruby')
|
86
|
+
argc -= 1;
|
87
|
+
argv += 1;
|
88
|
+
|
89
|
+
platformDir = binaryName;
|
90
|
+
checkLoggingArg(argc, argv, false);
|
91
|
+
if (!initPlatformDir()
|
92
|
+
|| !parseArgs(argc, argv)
|
93
|
+
|| !checkJDKHome()) {
|
94
|
+
return false;
|
95
|
+
}
|
96
|
+
disableFolderVirtualization(GetCurrentProcess());
|
97
|
+
|
98
|
+
if (nailgunClient) {
|
99
|
+
progArgs.push_front("org.jruby.util.NailMain");
|
100
|
+
char ** nailArgv = convertToArgvArray(progArgs);
|
101
|
+
if (printCommandLine) {
|
102
|
+
printListToConsole(progArgs);
|
103
|
+
return true;
|
104
|
+
}
|
105
|
+
|
106
|
+
list<string>* envList = GetEnvStringsAsList();
|
107
|
+
char ** nailEnv = convertToArgvArray(*envList);
|
108
|
+
nailgunClientMain(progArgs.size(), nailArgv, nailEnv);
|
109
|
+
return true;
|
110
|
+
}
|
111
|
+
|
112
|
+
if (binaryName) {
|
113
|
+
// clean up the binaryName first,
|
114
|
+
// remove '.exe' from the end, and the possible path.
|
115
|
+
string bn = binaryName;
|
116
|
+
|
117
|
+
size_t found = bn.find_last_of("/\\");
|
118
|
+
if (found != string::npos) {
|
119
|
+
logMsg("The binary name contains slashes, will remove: %s", binaryName);
|
120
|
+
bn = bn.substr(found + 1);
|
121
|
+
binaryName = bn.c_str();
|
122
|
+
}
|
123
|
+
|
124
|
+
found = bn.find(".exe", bn.length() - 4);
|
125
|
+
if (found != string::npos) {
|
126
|
+
bn.erase(found, 4);
|
127
|
+
binaryName = bn.c_str();
|
128
|
+
logMsg("*** Cleaned up the binary name: %s", binaryName);
|
129
|
+
} else {
|
130
|
+
logMsg("*** No need to clean the binary name: %s", binaryName);
|
131
|
+
}
|
132
|
+
|
133
|
+
if (strnicmp(binaryName, DEFAULT_EXECUTABLE, strlen(DEFAULT_EXECUTABLE)) != 0) {
|
134
|
+
logMsg("PlatformLauncher:\n\tNon-default executable name: %s", binaryName);
|
135
|
+
logMsg("\tHence, launching with extra parameters: -S %s", binaryName);
|
136
|
+
progArgs.push_front(binaryName);
|
137
|
+
progArgs.push_front("-S");
|
138
|
+
}
|
139
|
+
}
|
140
|
+
|
141
|
+
prepareOptions();
|
142
|
+
|
143
|
+
string java("");
|
144
|
+
|
145
|
+
if (getenv("JAVACMD") != NULL) {
|
146
|
+
java = getenv("JAVACMD");
|
147
|
+
jvmLauncher.setJavaCmd(java);
|
148
|
+
separateProcess = true;
|
149
|
+
suppressConsole = false;
|
150
|
+
} else {
|
151
|
+
if (jdkhome.empty()) {
|
152
|
+
if (!jvmLauncher.initialize(REQ_JAVA_VERSION)) {
|
153
|
+
logErr(false, true, "Cannot find Java %s or higher.", REQ_JAVA_VERSION);
|
154
|
+
return false;
|
155
|
+
}
|
156
|
+
}
|
157
|
+
|
158
|
+
jvmLauncher.getJavaPath(jdkhome);
|
159
|
+
java = jdkhome + "\\bin\\java";
|
160
|
+
}
|
161
|
+
|
162
|
+
if (printCommandLine) {
|
163
|
+
list<string> commandLine;
|
164
|
+
commandLine.push_back(java);
|
165
|
+
addOptionsToCommandLine(commandLine);
|
166
|
+
for (list<string>::iterator it = commandLine.begin(); it != commandLine.end(); it++) {
|
167
|
+
printf("%s\n", it->c_str());
|
168
|
+
}
|
169
|
+
return true;
|
170
|
+
}
|
171
|
+
|
172
|
+
if (nextAction.empty()) {
|
173
|
+
while (true) {
|
174
|
+
// run app
|
175
|
+
if (!run(retCode)) {
|
176
|
+
return false;
|
177
|
+
}
|
178
|
+
|
179
|
+
break;
|
180
|
+
}
|
181
|
+
} else {
|
182
|
+
logErr(false, true, "We should not get here.");
|
183
|
+
return false;
|
184
|
+
}
|
185
|
+
|
186
|
+
return true;
|
187
|
+
}
|
188
|
+
|
189
|
+
bool PlatformLauncher::run(DWORD *retCode) {
|
190
|
+
logMsg("Starting application...");
|
191
|
+
|
192
|
+
jvmLauncher.setSuppressConsole(suppressConsole);
|
193
|
+
|
194
|
+
bool rc = jvmLauncher.start(bootclass.c_str(), progArgs, javaOptions, separateProcess, retCode);
|
195
|
+
if (!separateProcess) {
|
196
|
+
exit(0);
|
197
|
+
}
|
198
|
+
return rc;
|
199
|
+
}
|
200
|
+
|
201
|
+
bool PlatformLauncher::checkJDKHome() {
|
202
|
+
if (!jdkhome.empty() && !jvmLauncher.initialize(jdkhome.c_str())) {
|
203
|
+
logMsg("Cannot locate java installation in specified jdkhome: %s", jdkhome.c_str());
|
204
|
+
string errMsg = "ERROR: Cannot locate Java installation in specified jdkhome:\n";
|
205
|
+
errMsg += jdkhome;
|
206
|
+
string errMsgFull = errMsg + "\nDo you want to try to use default version?";
|
207
|
+
jdkhome = "";
|
208
|
+
// Pop-up the message box only if there is no console
|
209
|
+
if (!isConsoleAttached()) {
|
210
|
+
if (::MessageBox(NULL, errMsgFull.c_str(), "Invalid jdkhome specified", MB_ICONQUESTION | MB_YESNO) == IDNO) {
|
211
|
+
return false;
|
212
|
+
}
|
213
|
+
} else {
|
214
|
+
fprintf(stdout, "%s\n", errMsg.c_str());
|
215
|
+
return false;
|
216
|
+
}
|
217
|
+
}
|
218
|
+
|
219
|
+
if (jdkhome.empty()) {
|
220
|
+
logMsg("-Xjdkhome is not set, checking for %%JAVA_HOME%%...");
|
221
|
+
char *origJavaHome = getenv("JAVA_HOME");
|
222
|
+
if (origJavaHome) {
|
223
|
+
string javaHome = trimTrailingBackslashes(origJavaHome);
|
224
|
+
logMsg("%%JAVA_HOME%% is set: %s", javaHome.c_str());
|
225
|
+
if (!jvmLauncher.initialize(javaHome.c_str())) {
|
226
|
+
logMsg("ERROR: Cannot locate java installation, specified by JAVA_HOME: %s", javaHome.c_str());
|
227
|
+
string errMsg = "Cannot locate Java installation, specified by JAVA_HOME:\n";
|
228
|
+
errMsg += javaHome;
|
229
|
+
string errMsgFull = errMsg + "\nDo you want to try to use default version?";
|
230
|
+
jdkhome = "";
|
231
|
+
// Pop-up the message box only if there is no console
|
232
|
+
if (!isConsoleAttached()) {
|
233
|
+
if (::MessageBox(NULL, errMsgFull.c_str(),
|
234
|
+
"Invalid jdkhome specified", MB_ICONQUESTION | MB_YESNO) == IDNO) {
|
235
|
+
return false;
|
236
|
+
}
|
237
|
+
} else {
|
238
|
+
fprintf(stdout, "%s\n", errMsg.c_str());
|
239
|
+
return false;
|
240
|
+
}
|
241
|
+
} else {
|
242
|
+
jdkhome = javaHome;
|
243
|
+
}
|
244
|
+
}
|
245
|
+
}
|
246
|
+
|
247
|
+
return true;
|
248
|
+
}
|
249
|
+
|
250
|
+
void PlatformLauncher::onExit() {
|
251
|
+
logMsg("onExit()");
|
252
|
+
}
|