1 /*
2 * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
171 CreateExecutionEnvironment(int *pargc, char ***pargv,
172 char *jrepath, jint so_jrepath,
173 char *jvmpath, jint so_jvmpath,
174 char *jvmcfg, jint so_jvmcfg) {
175 char * jvmtype;
176 int i = 0;
177 int running = CURRENT_DATA_MODEL;
178
179 int wanted = running;
180
181 char** argv = *pargv;
182 for (i = 0; i < *pargc ; i++) {
183 if (JLI_StrCmp(argv[i], "-J-d64") == 0 || JLI_StrCmp(argv[i], "-d64") == 0) {
184 wanted = 64;
185 continue;
186 }
187 if (JLI_StrCmp(argv[i], "-J-d32") == 0 || JLI_StrCmp(argv[i], "-d32") == 0) {
188 wanted = 32;
189 continue;
190 }
191 }
192 if (running != wanted) {
193 JLI_ReportErrorMessage(JRE_ERROR2, wanted);
194 exit(1);
195 }
196
197 /* Find out where the JRE is that we will be using. */
198 if (!GetJREPath(jrepath, so_jrepath)) {
199 JLI_ReportErrorMessage(JRE_ERROR1);
200 exit(2);
201 }
202
203 JLI_Snprintf(jvmcfg, so_jvmcfg, "%s%slib%s%s%sjvm.cfg",
204 jrepath, FILESEP, FILESEP, (char*)GetArch(), FILESEP);
205
206 /* Find the specified JVM type */
207 if (ReadKnownVMs(jvmcfg, JNI_FALSE) < 1) {
208 JLI_ReportErrorMessage(CFG_ERROR7);
209 exit(1);
210 }
|
1 /*
2 * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
171 CreateExecutionEnvironment(int *pargc, char ***pargv,
172 char *jrepath, jint so_jrepath,
173 char *jvmpath, jint so_jvmpath,
174 char *jvmcfg, jint so_jvmcfg) {
175 char * jvmtype;
176 int i = 0;
177 int running = CURRENT_DATA_MODEL;
178
179 int wanted = running;
180
181 char** argv = *pargv;
182 for (i = 0; i < *pargc ; i++) {
183 if (JLI_StrCmp(argv[i], "-J-d64") == 0 || JLI_StrCmp(argv[i], "-d64") == 0) {
184 wanted = 64;
185 continue;
186 }
187 if (JLI_StrCmp(argv[i], "-J-d32") == 0 || JLI_StrCmp(argv[i], "-d32") == 0) {
188 wanted = 32;
189 continue;
190 }
191
192 if (IsJavaArgs() && argv[i][0] != '-')
193 continue;
194 if (i > 0 && argv[i][0] != '-')
195 break;
196 }
197 if (running != wanted) {
198 JLI_ReportErrorMessage(JRE_ERROR2, wanted);
199 exit(1);
200 }
201
202 /* Find out where the JRE is that we will be using. */
203 if (!GetJREPath(jrepath, so_jrepath)) {
204 JLI_ReportErrorMessage(JRE_ERROR1);
205 exit(2);
206 }
207
208 JLI_Snprintf(jvmcfg, so_jvmcfg, "%s%slib%s%s%sjvm.cfg",
209 jrepath, FILESEP, FILESEP, (char*)GetArch(), FILESEP);
210
211 /* Find the specified JVM type */
212 if (ReadKnownVMs(jvmcfg, JNI_FALSE) < 1) {
213 JLI_ReportErrorMessage(CFG_ERROR7);
214 exit(1);
215 }
|