Skip to content

Commit f512094

Browse files
committed
Merge branch 'master' of [email protected]:jruby/jruby-launcher
2 parents 8726755 + 018ea90 commit f512094

File tree

6 files changed

+36
-14
lines changed

6 files changed

+36
-14
lines changed

jvmlauncher.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/*
22
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
33
*
4+
* Copyright 2009-2011 JRuby Team (www.jruby.org).
45
* Copyright 1997-2008 Sun Microsystems, Inc. All rights reserved.
56
*
67
* The contents of this file are subject to the terms of either the GNU
@@ -69,6 +70,14 @@ JvmLauncher::JvmLauncher(const JvmLauncher& orig) {
6970
JvmLauncher::~JvmLauncher() {
7071
}
7172

73+
void JvmLauncher::setJavaCmd(const string cmdPath) {
74+
javaExePath = cmdPath;
75+
javaPath = "";
76+
javawExePath = javaPath;
77+
javaClientDllPath = javaPath;
78+
javaServerDllPath = javaPath;
79+
}
80+
7281
bool JvmLauncher::checkJava(const char *path, const char *prefix) {
7382
assert(path);
7483
assert(prefix);

jvmlauncher.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
/*
22
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
33
*
4-
* Copyright 1997-2008, 2010 Sun Microsystems, Inc. All rights reserved.
4+
* Copyright 2009-2011 JRuby Team (www.jruby.org).
5+
* Copyright 1997-2008 Sun Microsystems, Inc. All rights reserved.
56
*
67
* The contents of this file are subject to the terms of either the GNU
78
* General Public License Version 2 only ("GPL") or the Common
@@ -76,6 +77,7 @@ class JvmLauncher {
7677
void setSuppressConsole(bool val) {
7778
suppressConsole = val;
7879
}
80+
void setJavaCmd(const std::string cmdPath);
7981

8082
private:
8183
JvmLauncher(const JvmLauncher& orig);

lib/jruby-launcher.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module JRubyLauncher
2-
VERSION = "1.0.4"
2+
VERSION = "1.0.5"
33
end

platformlauncher.cpp

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
33
*
4-
* Copyright 2009-2010 JRuby Team (www.jruby.org).
4+
* Copyright 2009-2011 JRuby Team (www.jruby.org).
55
* Copyright 1997-2008 Sun Microsystems, Inc. All rights reserved.
66
*
77
* The contents of this file are subject to the terms of either the GNU
@@ -137,20 +137,30 @@ bool PlatformLauncher::start(char* argv[], int argc, DWORD *retCode, const char*
137137
}
138138
}
139139

140-
if (jdkhome.empty()) {
141-
if (!jvmLauncher.initialize(REQ_JAVA_VERSION)) {
142-
logErr(false, true, "Cannot find Java %s or higher.", REQ_JAVA_VERSION);
143-
return false;
144-
}
145-
}
140+
prepareOptions();
146141

147-
jvmLauncher.getJavaPath(jdkhome);
142+
string java("");
148143

149-
prepareOptions();
144+
if (getenv("JAVACMD") != NULL) {
145+
java = getenv("JAVACMD");
146+
jvmLauncher.setJavaCmd(java);
147+
separateProcess = true;
148+
suppressConsole = false;
149+
} else {
150+
if (jdkhome.empty()) {
151+
if (!jvmLauncher.initialize(REQ_JAVA_VERSION)) {
152+
logErr(false, true, "Cannot find Java %s or higher.", REQ_JAVA_VERSION);
153+
return false;
154+
}
155+
}
156+
157+
jvmLauncher.getJavaPath(jdkhome);
158+
java = jdkhome + "\\bin\\java";
159+
}
150160

151161
if (printCommandLine) {
152162
list<string> commandLine;
153-
commandLine.push_back(jdkhome + "\\bin\\java");
163+
commandLine.push_back(java);
154164
addOptionsToCommandLine(commandLine);
155165
for (list<string>::iterator it = commandLine.begin(); it != commandLine.end(); it++) {
156166
printf("%s\n", it->c_str());
@@ -179,6 +189,7 @@ bool PlatformLauncher::run(DWORD *retCode) {
179189
logMsg("Starting application...");
180190

181191
jvmLauncher.setSuppressConsole(suppressConsole);
192+
182193
bool rc = jvmLauncher.start(bootclass.c_str(), progArgs, javaOptions, separateProcess, retCode);
183194
if (!separateProcess) {
184195
exit(0);

platformlauncher.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
33
*
4-
* Copyright 2009-2010 JRuby Team (www.jruby.org).
4+
* Copyright 2009-2011 JRuby Team (www.jruby.org).
55
* Copyright 1997-2008 Sun Microsystems, Inc. All rights reserved.
66
*
77
* The contents of this file are subject to the terms of either the GNU

version.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@
66
#ifndef _VERSION_H_
77
#define _VERSION_H_
88

9-
#define JRUBY_LAUNCHER_VERSION "1.0.4"
9+
#define JRUBY_LAUNCHER_VERSION "1.0.5"
1010

1111
#endif // ! _VERSION_H_

0 commit comments

Comments
 (0)