author | mikejwre |
Thu, 03 Dec 2009 12:52:46 -0800 | |
changeset 4400 | 6f7b7cb74a72 |
parent 3834 | 16342ebd576d |
child 5506 | 202f599c92aa |
permissions | -rw-r--r-- |
2 | 1 |
/* |
715 | 2 |
* Copyright 1998-2008 Sun Microsystems, Inc. All Rights Reserved. |
2 | 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. Sun designates this |
|
8 |
* particular file as subject to the "Classpath" exception as provided |
|
9 |
* by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, |
|
22 |
* CA 95054 USA or visit www.sun.com if you need additional information or |
|
23 |
* have any questions. |
|
24 |
*/ |
|
25 |
||
26 |
#ifndef _JAVA_H_ |
|
27 |
#define _JAVA_H_ |
|
28 |
||
29 |
#include <stdio.h> |
|
30 |
#include <stdlib.h> |
|
31 |
#include <string.h> |
|
32 |
#include <limits.h> |
|
33 |
||
34 |
#include <jni.h> |
|
35 |
#include <jvm.h> |
|
36 |
||
37 |
/* |
|
38 |
* Get system specific defines. |
|
39 |
*/ |
|
40 |
#include "emessages.h" |
|
41 |
#include "java_md.h" |
|
42 |
#include "jli_util.h" |
|
43 |
||
44 |
#include "manifest_info.h" |
|
45 |
#include "version_comp.h" |
|
46 |
#include "wildcard.h" |
|
47 |
#include "splashscreen.h" |
|
48 |
||
49 |
# define KB (1024UL) |
|
50 |
# define MB (1024UL * KB) |
|
51 |
# define GB (1024UL * MB) |
|
52 |
||
53 |
#define CURRENT_DATA_MODEL (CHAR_BIT * sizeof(void*)) |
|
54 |
||
55 |
/* |
|
56 |
* The following environment variable is used to influence the behavior |
|
57 |
* of the jre exec'd through the SelectVersion routine. The command line |
|
58 |
* options which specify the version are not passed to the exec'd version, |
|
59 |
* because that jre may be an older version which wouldn't recognize them. |
|
60 |
* This environment variable is known to this (and later) version and serves |
|
61 |
* to suppress the version selection code. This is not only for efficiency, |
|
62 |
* but also for correctness, since any command line options have been |
|
63 |
* removed which would cause any value found in the manifest to be used. |
|
64 |
* This would be incorrect because the command line options are defined |
|
65 |
* to take precedence. |
|
66 |
* |
|
67 |
* The value associated with this environment variable is the MainClass |
|
68 |
* name from within the executable jar file (if any). This is strictly a |
|
69 |
* performance enhancement to avoid re-reading the jar file manifest. |
|
70 |
* |
|
71 |
*/ |
|
72 |
#define ENV_ENTRY "_JAVA_VERSION_SET" |
|
73 |
||
74 |
#define SPLASH_FILE_ENV_ENTRY "_JAVA_SPLASH_FILE" |
|
75 |
#define SPLASH_JAR_ENV_ENTRY "_JAVA_SPLASH_JAR" |
|
76 |
||
77 |
/* |
|
78 |
* Pointers to the needed JNI invocation API, initialized by LoadJavaVM. |
|
79 |
*/ |
|
80 |
typedef jint (JNICALL *CreateJavaVM_t)(JavaVM **pvm, void **env, void *args); |
|
81 |
typedef jint (JNICALL *GetDefaultJavaVMInitArgs_t)(void *args); |
|
82 |
||
83 |
typedef struct { |
|
84 |
CreateJavaVM_t CreateJavaVM; |
|
85 |
GetDefaultJavaVMInitArgs_t GetDefaultJavaVMInitArgs; |
|
86 |
} InvocationFunctions; |
|
87 |
||
88 |
int |
|
89 |
JLI_Launch(int argc, char ** argv, /* main argc, argc */ |
|
90 |
int jargc, const char** jargv, /* java args */ |
|
91 |
int appclassc, const char** appclassv, /* app classpath */ |
|
92 |
const char* fullversion, /* full version defined */ |
|
93 |
const char* dotversion, /* dot version defined */ |
|
94 |
const char* pname, /* program name */ |
|
95 |
const char* lname, /* launcher name */ |
|
96 |
jboolean javaargs, /* JAVA_ARGS */ |
|
97 |
jboolean cpwildcard, /* classpath wildcard */ |
|
98 |
jboolean javaw, /* windows-only javaw */ |
|
99 |
jint ergo_class /* ergnomics policy */ |
|
100 |
); |
|
101 |
||
102 |
/* |
|
103 |
* Prototypes for launcher functions in the system specific java_md.c. |
|
104 |
*/ |
|
105 |
||
106 |
jboolean |
|
107 |
LoadJavaVM(const char *jvmpath, InvocationFunctions *ifn); |
|
108 |
||
109 |
void |
|
110 |
GetXUsagePath(char *buf, jint bufsize); |
|
111 |
||
112 |
jboolean |
|
113 |
GetApplicationHome(char *buf, jint bufsize); |
|
114 |
||
115 |
#define GetArch() GetArchPath(CURRENT_DATA_MODEL) |
|
116 |
||
117 |
void CreateExecutionEnvironment(int *_argc, |
|
118 |
char ***_argv, |
|
119 |
char jrepath[], |
|
120 |
jint so_jrepath, |
|
121 |
char jvmpath[], |
|
122 |
jint so_jvmpath, |
|
123 |
char **original_argv); |
|
1145
404b11752c57
6685121: (launcher) make ReportErrorMessages accessible by other launcher subsystems
ksrini
parents:
715
diff
changeset
|
124 |
/* Reports an error message to stderr or a window as appropriate. */ |
404b11752c57
6685121: (launcher) make ReportErrorMessages accessible by other launcher subsystems
ksrini
parents:
715
diff
changeset
|
125 |
void JLI_ReportErrorMessage(const char * message, ...); |
2 | 126 |
|
1145
404b11752c57
6685121: (launcher) make ReportErrorMessages accessible by other launcher subsystems
ksrini
parents:
715
diff
changeset
|
127 |
/* Reports a system error message to stderr or a window */ |
404b11752c57
6685121: (launcher) make ReportErrorMessages accessible by other launcher subsystems
ksrini
parents:
715
diff
changeset
|
128 |
void JLI_ReportErrorMessageSys(const char * message, ...); |
404b11752c57
6685121: (launcher) make ReportErrorMessages accessible by other launcher subsystems
ksrini
parents:
715
diff
changeset
|
129 |
|
404b11752c57
6685121: (launcher) make ReportErrorMessages accessible by other launcher subsystems
ksrini
parents:
715
diff
changeset
|
130 |
/* Reports an error message only to stderr. */ |
404b11752c57
6685121: (launcher) make ReportErrorMessages accessible by other launcher subsystems
ksrini
parents:
715
diff
changeset
|
131 |
void JLI_ReportMessage(const char * message, ...); |
2 | 132 |
|
133 |
/* |
|
1145
404b11752c57
6685121: (launcher) make ReportErrorMessages accessible by other launcher subsystems
ksrini
parents:
715
diff
changeset
|
134 |
* Reports an exception which terminates the vm to stderr or a window |
2 | 135 |
* as appropriate. |
136 |
*/ |
|
1145
404b11752c57
6685121: (launcher) make ReportErrorMessages accessible by other launcher subsystems
ksrini
parents:
715
diff
changeset
|
137 |
void JLI_ReportExceptionDescription(JNIEnv * env); |
2 | 138 |
void PrintMachineDependentOptions(); |
139 |
||
140 |
const char *jlong_format_specifier(); |
|
141 |
||
142 |
/* |
|
143 |
* Block current thread and continue execution in new thread |
|
144 |
*/ |
|
145 |
int ContinueInNewThread0(int (JNICALL *continuation)(void *), |
|
146 |
jlong stack_size, void * args); |
|
147 |
||
148 |
/* sun.java.launcher.* platform properties. */ |
|
149 |
void SetJavaLauncherPlatformProps(void); |
|
150 |
void SetJavaCommandLineProp(char* classname, char* jarfile, int argc, char** argv); |
|
151 |
void SetJavaLauncherProp(void); |
|
152 |
||
153 |
/* |
|
154 |
* Functions defined in java.c and used in java_md.c. |
|
155 |
*/ |
|
156 |
jint ReadKnownVMs(const char *jrepath, const char * arch, jboolean speculative); |
|
157 |
char *CheckJvmType(int *argc, char ***argv, jboolean speculative); |
|
158 |
void AddOption(char *str, void *info); |
|
159 |
||
160 |
enum ergo_policy { |
|
161 |
DEFAULT_POLICY = 0, |
|
162 |
NEVER_SERVER_CLASS, |
|
163 |
ALWAYS_SERVER_CLASS |
|
164 |
}; |
|
165 |
||
166 |
const char* GetProgramName(); |
|
167 |
const char* GetDotVersion(); |
|
168 |
const char* GetFullVersion(); |
|
169 |
jboolean IsJavaArgs(); |
|
170 |
jboolean IsJavaw(); |
|
171 |
jint GetErgoPolicy(); |
|
172 |
||
173 |
jboolean ServerClassMachine(); |
|
174 |
||
175 |
static int ContinueInNewThread(InvocationFunctions* ifn, int argc, char** argv, |
|
176 |
char* jarfile, char* classname, int ret); |
|
177 |
||
39
560da37936db
6596475: (launcher) javaw should call InitCommonControls
ksrini
parents:
2
diff
changeset
|
178 |
/* |
560da37936db
6596475: (launcher) javaw should call InitCommonControls
ksrini
parents:
2
diff
changeset
|
179 |
* Initialize platform specific settings |
560da37936db
6596475: (launcher) javaw should call InitCommonControls
ksrini
parents:
2
diff
changeset
|
180 |
*/ |
560da37936db
6596475: (launcher) javaw should call InitCommonControls
ksrini
parents:
2
diff
changeset
|
181 |
void InitLauncher(jboolean javaw); |
2 | 182 |
|
1323
e14a3b3536cd
6742159: (launcher) improve the java launching mechanism
ksrini
parents:
1145
diff
changeset
|
183 |
/* |
e14a3b3536cd
6742159: (launcher) improve the java launching mechanism
ksrini
parents:
1145
diff
changeset
|
184 |
* This allows for finding classes from the VM's bootstrap class loader directly, |
e14a3b3536cd
6742159: (launcher) improve the java launching mechanism
ksrini
parents:
1145
diff
changeset
|
185 |
* FindClass uses the application class loader internally, this will cause |
e14a3b3536cd
6742159: (launcher) improve the java launching mechanism
ksrini
parents:
1145
diff
changeset
|
186 |
* unnecessary searching of the classpath for the required classes. |
e14a3b3536cd
6742159: (launcher) improve the java launching mechanism
ksrini
parents:
1145
diff
changeset
|
187 |
* |
e14a3b3536cd
6742159: (launcher) improve the java launching mechanism
ksrini
parents:
1145
diff
changeset
|
188 |
*/ |
e14a3b3536cd
6742159: (launcher) improve the java launching mechanism
ksrini
parents:
1145
diff
changeset
|
189 |
typedef jclass (JNICALL FindClassFromBootLoader_t(JNIEnv *env, |
3834
16342ebd576d
6864028: Update the java launcher to use the new entry point JVM_FindClassFromBootLoader
mchung
parents:
1331
diff
changeset
|
190 |
const char *name)); |
1323
e14a3b3536cd
6742159: (launcher) improve the java launching mechanism
ksrini
parents:
1145
diff
changeset
|
191 |
jclass FindBootStrapClass(JNIEnv *env, const char *classname); |
2 | 192 |
#endif /* _JAVA_H_ */ |