United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: 7131021 [macosx] Consider using system properties to pass arguments from the launcher to AWT/SplashScreen
7131021 : [macosx] Consider using system properties to pass arguments from the launcher to AWT/SplashScreen

Details
Type:
Enhancement
Submit Date:
2012-01-18
Status:
Closed
Updated Date:
2012-05-05
Project Name:
JDK
Resolved Date:
2012-05-05
Component:
client-libs
OS:
generic
Sub-Component:
java.awt
CPU:
generic
Priority:
P4
Resolution:
Fixed
Affected Versions:
8
Fixed Versions:
7u6

Related Reports
Backport:

Sub Tasks

Description
On the Mac the following environment variables can be set by the launcher code:

JAVA_MAIN_CLASS_<pid> - a string containing the class name which main() methods is called.
JAVA_STARTED_ON_FIRST_THREAD_<pid> - set when the -XstartOnFirstThread is specified on the command line.
APP_ICON_<pid>, APP_NAME_<pid> - set when the corresponding -Xdock:icon or name are specified on the command line.

These variables were first introduced in Apple JDK. Oracle JDK for the Mac continues to use them. The variables are used from libosxapp dynamic library to initialize an instance of the NSApplicationAWT class properly.

While the APP_* and JAVA_STARTED_* are conditional, the JAVA_MAIN_CLASS is set unconditionally. This may cause problems with tests or applications that start another process from the currently running Java app, and want to be able to specify an empty or custom environment for the newly started app.

                                    

Comments
EVALUATION

The proposed fix:

http://cr.openjdk.java.net/~anthony/7u6-2-keepEnvVars-7131021.1/
                                     
2012-04-11
EVALUATION

We must write a regression test to check that launcher correctly sets the environment variables on the Mac.
                                     
2012-04-05
EVALUATION

###@###.###: SWT relies on APP_NAME and APP_ICON.  We should not drop support for these variables.
                                     
2012-03-23
EVALUATION

We could use a JVM system property instead of the JAVA_MAIN_CLASS_<pid> variable. E.g. sun.awt.mainClassName.

Note that actually all of these parameters are used only after the JVM is started, and as such we could turn all of them into system properties.

However, other software may rely on the existing environment variables. For instance, JavaFX relies on the APP_ICON_<pid> environment variable in order to set a dock icon for an FX app. We need to make sure these apps aren't broken if we replace the env. variables with system properties.
                                     
2012-01-18



Hardware and Software, Engineered to Work Together