1 /*
2 * Copyright (c) 1998, 2016, 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
69 */
70 #define ENV_ENTRY "_JAVA_VERSION_SET"
71
72 #define SPLASH_FILE_ENV_ENTRY "_JAVA_SPLASH_FILE"
73 #define SPLASH_JAR_ENV_ENTRY "_JAVA_SPLASH_JAR"
74 #define JDK_JAVA_OPTIONS "JDK_JAVA_OPTIONS"
75
76 /*
77 * Pointers to the needed JNI invocation API, initialized by LoadJavaVM.
78 */
79 typedef jint (JNICALL *CreateJavaVM_t)(JavaVM **pvm, void **env, void *args);
80 typedef jint (JNICALL *GetDefaultJavaVMInitArgs_t)(void *args);
81 typedef jint (JNICALL *GetCreatedJavaVMs_t)(JavaVM **vmBuf, jsize bufLen, jsize *nVMs);
82
83 typedef struct {
84 CreateJavaVM_t CreateJavaVM;
85 GetDefaultJavaVMInitArgs_t GetDefaultJavaVMInitArgs;
86 GetCreatedJavaVMs_t GetCreatedJavaVMs;
87 } InvocationFunctions;
88
89 int
90 JLI_Launch(int argc, char ** argv, /* main argc, argc */
91 int jargc, const char** jargv, /* java args */
92 int appclassc, const char** appclassv, /* app classpath */
93 const char* fullversion, /* full version defined */
94 const char* dotversion, /* dot version defined */
95 const char* pname, /* program name */
96 const char* lname, /* launcher name */
97 jboolean javaargs, /* JAVA_ARGS */
98 jboolean cpwildcard, /* classpath wildcard */
99 jboolean javaw, /* windows-only javaw */
100 jint ergo_class /* ergnomics policy */
101 );
102
103 /*
104 * Prototypes for launcher functions in the system specific java_md.c.
105 */
106
107 jboolean
108 LoadJavaVM(const char *jvmpath, InvocationFunctions *ifn);
109
116 jboolean
117 GetApplicationHomeFromDll(char *buf, jint bufsize);
118
119 #define GetArch() GetArchPath(CURRENT_DATA_MODEL)
120
121 /*
122 * Different platforms will implement this, here
123 * pargc is a pointer to the original argc,
124 * pargv is a pointer to the original argv,
125 * jrepath is an accessible path to the jre as determined by the call
126 * so_jrepath is the length of the buffer jrepath
127 * jvmpath is an accessible path to the jvm as determined by the call
128 * so_jvmpath is the length of the buffer jvmpath
129 */
130 void CreateExecutionEnvironment(int *argc, char ***argv,
131 char *jrepath, jint so_jrepath,
132 char *jvmpath, jint so_jvmpath,
133 char *jvmcfg, jint so_jvmcfg);
134
135 /* Reports an error message to stderr or a window as appropriate. */
136 void JLI_ReportErrorMessage(const char * message, ...);
137
138 /* Reports a system error message to stderr or a window */
139 void JLI_ReportErrorMessageSys(const char * message, ...);
140
141 /* Reports an error message only to stderr. */
142 void JLI_ReportMessage(const char * message, ...);
143
144 /* Reports a message only to stdout. */
145 void JLI_ShowMessage(const char * message, ...);
146
147 /*
148 * Reports an exception which terminates the vm to stderr or a window
149 * as appropriate.
150 */
151 void JLI_ReportExceptionDescription(JNIEnv * env);
152 void PrintMachineDependentOptions();
153
154 /*
155 * Block current thread and continue execution in new thread
156 */
157 int ContinueInNewThread0(int (JNICALL *continuation)(void *),
158 jlong stack_size, void * args);
159
160 /* sun.java.launcher.* platform properties. */
161 void SetJavaLauncherPlatformProps(void);
162 void SetJavaCommandLineProp(char* what, int argc, char** argv);
163 void SetJavaLauncherProp(void);
164
165 /*
166 * Functions defined in java.c and used in java_md.c.
167 */
168 jint ReadKnownVMs(const char *jvmcfg, jboolean speculative);
169 char *CheckJvmType(int *argc, char ***argv, jboolean speculative);
170 void AddOption(char *str, void *info);
171 jboolean IsWhiteSpaceOption(const char* name);
|
1 /*
2 * Copyright (c) 1998, 2018, 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
69 */
70 #define ENV_ENTRY "_JAVA_VERSION_SET"
71
72 #define SPLASH_FILE_ENV_ENTRY "_JAVA_SPLASH_FILE"
73 #define SPLASH_JAR_ENV_ENTRY "_JAVA_SPLASH_JAR"
74 #define JDK_JAVA_OPTIONS "JDK_JAVA_OPTIONS"
75
76 /*
77 * Pointers to the needed JNI invocation API, initialized by LoadJavaVM.
78 */
79 typedef jint (JNICALL *CreateJavaVM_t)(JavaVM **pvm, void **env, void *args);
80 typedef jint (JNICALL *GetDefaultJavaVMInitArgs_t)(void *args);
81 typedef jint (JNICALL *GetCreatedJavaVMs_t)(JavaVM **vmBuf, jsize bufLen, jsize *nVMs);
82
83 typedef struct {
84 CreateJavaVM_t CreateJavaVM;
85 GetDefaultJavaVMInitArgs_t GetDefaultJavaVMInitArgs;
86 GetCreatedJavaVMs_t GetCreatedJavaVMs;
87 } InvocationFunctions;
88
89 JNIEXPORT int JNICALL
90 JLI_Launch(int argc, char ** argv, /* main argc, argc */
91 int jargc, const char** jargv, /* java args */
92 int appclassc, const char** appclassv, /* app classpath */
93 const char* fullversion, /* full version defined */
94 const char* dotversion, /* dot version defined */
95 const char* pname, /* program name */
96 const char* lname, /* launcher name */
97 jboolean javaargs, /* JAVA_ARGS */
98 jboolean cpwildcard, /* classpath wildcard */
99 jboolean javaw, /* windows-only javaw */
100 jint ergo_class /* ergnomics policy */
101 );
102
103 /*
104 * Prototypes for launcher functions in the system specific java_md.c.
105 */
106
107 jboolean
108 LoadJavaVM(const char *jvmpath, InvocationFunctions *ifn);
109
116 jboolean
117 GetApplicationHomeFromDll(char *buf, jint bufsize);
118
119 #define GetArch() GetArchPath(CURRENT_DATA_MODEL)
120
121 /*
122 * Different platforms will implement this, here
123 * pargc is a pointer to the original argc,
124 * pargv is a pointer to the original argv,
125 * jrepath is an accessible path to the jre as determined by the call
126 * so_jrepath is the length of the buffer jrepath
127 * jvmpath is an accessible path to the jvm as determined by the call
128 * so_jvmpath is the length of the buffer jvmpath
129 */
130 void CreateExecutionEnvironment(int *argc, char ***argv,
131 char *jrepath, jint so_jrepath,
132 char *jvmpath, jint so_jvmpath,
133 char *jvmcfg, jint so_jvmcfg);
134
135 /* Reports an error message to stderr or a window as appropriate. */
136 JNIEXPORT void JNICALL
137 JLI_ReportErrorMessage(const char * message, ...);
138
139 /* Reports a system error message to stderr or a window */
140 JNIEXPORT void JNICALL
141 JLI_ReportErrorMessageSys(const char * message, ...);
142
143 /* Reports an error message only to stderr. */
144 JNIEXPORT void JNICALL
145 JLI_ReportMessage(const char * message, ...);
146
147 /* Reports a message only to stdout. */
148 void JLI_ShowMessage(const char * message, ...);
149
150 /*
151 * Reports an exception which terminates the vm to stderr or a window
152 * as appropriate.
153 */
154 JNIEXPORT void JNICALL
155 JLI_ReportExceptionDescription(JNIEnv * env);
156 void PrintMachineDependentOptions();
157
158 /*
159 * Block current thread and continue execution in new thread
160 */
161 int ContinueInNewThread0(int (JNICALL *continuation)(void *),
162 jlong stack_size, void * args);
163
164 /* sun.java.launcher.* platform properties. */
165 void SetJavaLauncherPlatformProps(void);
166 void SetJavaCommandLineProp(char* what, int argc, char** argv);
167 void SetJavaLauncherProp(void);
168
169 /*
170 * Functions defined in java.c and used in java_md.c.
171 */
172 jint ReadKnownVMs(const char *jvmcfg, jboolean speculative);
173 char *CheckJvmType(int *argc, char ***argv, jboolean speculative);
174 void AddOption(char *str, void *info);
175 jboolean IsWhiteSpaceOption(const char* name);
|