Skip to Main Content

Java HotSpot Virtual Machine


For appeals, questions and feedback, please email

Can the _JAVA_VERSION_SET environment variable be set to any value that is not null?

user-jfuf9Apr 18 2023

The value of _JAVA_VERSION_SET is given to main_class, but it will be ignored。

Get the application's main class. * * See bugid 5030265.

The Main-Class name has already been parsed

* from the manifest, but not parsed properly for UTF-8 support.

* Hence the code here ignores the value previously extracted and

* uses the pre-existing code to reextract the value. This is

* possibly an end of release cycle expedient. However, it has * also been discovered that passing some character sets through the environment has "strange" behavior on some variants of

* Windows. Hence, maybe the manifest parsing code local to the

* launcher should never be enhanced.

* * Hence, future work should either:

* 1) Correct the local parsing code and verify that the * Main-Class attribute gets properly passed through * all environments,

* 2) Remove the vestages of maintaining main_class through * the environment (and remove these comments).

SelectVersion(int argc, char **argv, char **main_class){

if ((env_in = getenv(ENV_ENTRY)) != NULL) {
if (*env_in != '\0')
*main_class = JLI_StringDup(env_in);



So the _JAVA_VERSION_SET environment variable can be set to any non-empty value to avoid reading MANIFEST.MF twice, right?The bug description also says that the main_class will be removed in the future, but why hasn't it been removed yet?Obviously main_class doesn't make sense anymore._JAVA_VERSION_SET has very little meaning anymore, doesn't it?

Post Details
Added on Apr 18 2023