Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 17091 Details for
Bug 82518
[launcher] [RCP] Use JNI to launch Eclipse
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Second generation patch for Windows
launcher.patch (text/plain), 48.85 KB, created by
Ed Burnette
on 2005-01-11 19:42:51 EST
(
hide
)
Description:
Second generation patch for Windows
Filename:
MIME Type:
Creator:
Ed Burnette
Created:
2005-01-11 19:42:51 EST
Size:
48.85 KB
patch
obsolete
>Index: eclipse.c >=================================================================== >RCS file: /home/eclipse/platform-launcher/library/eclipse.c,v >retrieving revision 1.53 >diff -u -r1.53 eclipse.c >--- eclipse.c 16 Dec 2004 00:15:36 -0000 1.53 >+++ eclipse.c 12 Jan 2005 00:22:29 -0000 >@@ -12,100 +12,16 @@ > > /* Eclipse Program Launcher > * >- * This program performs the launching of the eclipse program along >- * with the splash window. If the splash window is to be displayed, >- * the java application will receive two extra arguments: >- * -showsplash <splashCommand> >- * >- * When the Java program starts, it should determine if a different >- * version of the splash bitmaps are to be used (uses the feature mechanism). >- * If feature specific bitmaps are to be used, the root directory where >- * those bitmaps reside (e.g., <rootDir>/splash/<bitmapFile>) should be >- * appended (in double quotes) to the splash command. If a directory is >- * not appended, the Eclipse install directory is used. >- * >- * The Java program initiates the displaying of the splash window >- * by executing the splash command as follows: >- * >- * String command = splashCommand; >- * String directory = getFeatureRootDirectory(); >- * if (directory != null) >- * command += " \"" + directory + "\""; >- * Process splashProcess = Runtime.getRuntime().exec( command ); >- * >- * When the Java program initialization is complete, the splash window >- * is brought down by destroying the splash process as follows: >- * >- * splashProcess.destroy(); >- * >- * Therefore, when the splash window is visible, there are actually three >- * processes running: >- * 1) the main launcher process >- * 2) the Java VM process (Eclipse) >- * 3) the splash window process. >- * >- * The Java application does not need to know the format of the >- * <splashCommand> argument but the command format is: >- * <fullPathOfLauncherProgram> -showsplash <timeout> >- * >- * In other words, another eclipse launcher program is run with >- * the arguments "-showsplash" and a timeout value for bringing >- * the splash window down. >- * >- * Similarly, the Java application will receive two other arguments: >- * -exitdata <exitDataCommand> >- * >- * The <exitDataCommand> argument can be used by the Java application >- * to provide specific exit data to the main launcher process. It accomplishes >- * this by executing the exit data command with an extra argument, which is >- * the exit data. >- * >- * String command = exitDataCommand; >- * String data = "Some data"; >- * if (data != null) >- * command += " \"" + data + "\""; >- * Process exitDataProcess = Runtime.getRuntime().exec( command ); >- * exitDataProcess.waitFor(); >- * >- * The exit data size must not exceed MAX_SHARED_LENGTH which is >- * 16Kb. The exit data process will exit with an exit code >- * different than 0 if that happens. >- * >- * The Java application does not need to know the format of the >- * <exitDataCommand> argument either, but the command format is: >- * <fullPathOfLauncherProgram> -exitdata <id> >- * >- * where id is a process independent identifier for the shared >- * memory segment that stores the exit data. >- * >- * The main launcher recognizes the following exit codes from the >- * Java application: >- * >- * 0 >- * - Exit normally. >- * RESTART_LAST_EC = 23 >- * - restart the java VM again with the same arguments as the previous one. >- * RESTART_NEW_EC = 24 >- * - restart the java VM again with the arguments taken from the exit data. >- * The exit data format is a list of arguments separated by '\n'. The Java >- * application should build this list using the arguments passed to it on >- * startup. See below. >- * >- * Additionally, if the Java application exits with an exit code other than the >- * ones above, the main launcher will display an error message with the contents >- * of the exit data. If the exit data is empty, a generic error message is >- * displayed. The generic error message shows the exit code and the arguments >- * passed to the Java application. >+ * This program performs the launching of the eclipse program. > * > * The options that can be specified by the user to the launcher are: > * -vm <javaVM> the Java VM to be used > * -os <opSys> the operating system being run on > * -arch <osArch> the hardware architecture of the OS: x86, sparc, hp9000 > * -ws <gui> the window system to be used: win32, motif, gtk, ... >- * -nosplash do not display the splash screen >- * -name <name> application name displayed in error message dialogs and >- * splash screen window. Default value is computed from the >- * name of the executable - with the first letter capitalized >+ * -name <name> application name displayed in error message dialogs. >+ * Default value is computed from the name of >+ * the executable - with the first letter capitalized > * if possible. e.g. eclipse.exe defaults to the name Eclipse. > * <userArgs> arguments that are passed along to the Java application > * (i.e, -data <path>, -debug, -console, -consoleLog, etc) >@@ -121,8 +37,6 @@ > * -os <user or default OS value> > * -ws <user or default WS value> > * -arch <user or default ARCH value> >- * [-showsplash <splashCommand>] >- * [-exitdata <exitDataCommand>] > * <userArgs> > * -vm <javaVM> > * -vmargs <all VM args> >@@ -133,10 +47,6 @@ > * -cp > * <startup jar full path> > * org.eclipse.core.launcher.Main >- * >- * If the -nosplash option is given to the launcher, the java >- * application will not receive the "-showsplash" option or its >- * associated command. > * > * See "Main.java" for a simple implementation of the Java > * application. >@@ -185,25 +95,15 @@ > static _TCHAR* program = NULL; /* full pathname of the program */ > static _TCHAR* homeDir = NULL; /* directory where program resides */ > static _TCHAR* javaVM = NULL; /* full pathname of the Java VM to run */ >-static _TCHAR* sharedID = NULL; /* ID for the shared memory */ >- >-/* Define the special exit codes returned from Eclipse. */ >-#define RESTART_LAST_EC 23 >-#define RESTART_NEW_EC 24 >- >-/* Define the maximum time (in seconds) for the splash window to remain visible. */ >-static _TCHAR* splashTimeout = _T("600"); /* 10 minutes */ > > /* Define the required VM arguments (all platforms). */ >-#define startupJarName _T("startup.jar") >-static _TCHAR* reqVMarg[] = { _T("-cp"), startupJarName, _T("org.eclipse.core.launcher.Main"), NULL }; >+static _TCHAR* startupJarName = _T("startup.jar"); >+static _TCHAR* startupClassName = _T("org/eclipse/core/launcher/Main"); > > /* Define error messages. (non-NLS) */ > static _TCHAR* exitMsg = _T("JVM terminated. Exit code=%d\n%s"); > static _TCHAR* goVMMsg = _T("Start VM: %s\n"); > static _TCHAR* pathMsg = _T("%s\n'%s' in your current PATH"); >-static _TCHAR* showMsg = _T("Could not load splash bitmap:\n%s"); >-static _TCHAR* shareMsg = _T("No shared data available."); > static _TCHAR* noVMMsg = > _T("A Java Runtime Environment (JRE) or Java Development Kit (JDK)\n\ > must be available in order to run %s. No Java virtual machine\n\ >@@ -212,7 +112,7 @@ > > static _TCHAR* homeMsg = > _T("The %s executable launcher was unable to locate its \n\ >-companion startup.jar file (in the same directory as the executable)."); >+companion %s file (in the same directory as the executable)."); > > /* Define constants for the options recognized by the launcher. */ > #define CONSOLE _T("-console") >@@ -220,9 +120,6 @@ > #define DEBUG _T("-debug") > #define OS _T("-os") > #define OSARCH _T("-arch") >-#define NOSPLASH _T("-nosplash") >-#define SHOWSPLASH _T("-showsplash") >-#define EXITDATA _T("-exitdata") > #define VM _T("-vm") > #define WS _T("-ws") > #define NAME _T("-name") >@@ -231,11 +128,8 @@ > /* Define the variables to receive the option values. */ > static int needConsole = 0; /* True: user wants a console */ > static int debug = 0; /* True: output debugging info */ >-static int noSplash = 0; /* True: do not show splash win */ > static _TCHAR* osArg = _T(DEFAULT_OS); > static _TCHAR* osArchArg = _T(DEFAULT_OS_ARCH); >-static _TCHAR* showSplashArg = NULL; /* showsplash data (main launcher window) */ >-static _TCHAR* exitDataArg = NULL; > static _TCHAR* vmName = NULL; /* Java VM that the user wants to run */ > static _TCHAR* wsArg = _T(DEFAULT_WS); /* the SWT supported GUI to be used */ > static _TCHAR* name = NULL; /* program name */ >@@ -254,11 +148,8 @@ > { CONSOLE, NULL, &needConsole, 0 }, > { CONSOLELOG, NULL, &needConsole, 0 }, > { DEBUG, NULL, &debug, 0 }, >- { NOSPLASH, NULL, &noSplash, 1 }, > { OS, &osArg, NULL, 2 }, > { OSARCH, &osArchArg, NULL, 2 }, >- { SHOWSPLASH, &showSplashArg, NULL, 2 }, >- { EXITDATA, &exitDataArg, NULL, 2 }, > { VM, &vmName, NULL, 2 }, > { NAME, &name, NULL, 2 }, > { WS, &wsArg, NULL, 2 } }; >@@ -268,16 +159,15 @@ > static _TCHAR** configArgv = NULL; > > /* Local methods */ >-static int createUserArgs(int configArgc, _TCHAR **configArgv, int *argc, _TCHAR ***argv); >-static void parseArgs( int* argc, _TCHAR* argv[] ); >-static _TCHAR** parseArgList( _TCHAR *data ); >-static void freeArgList( _TCHAR** data ); >-static _TCHAR** getVMCommand( int argc, _TCHAR* argv[] ); >+static int createUserArgs(int configArgc, _TCHAR **configArgv, int *argc, _TCHAR ***argv); >+static void parseArgs( int* argc, _TCHAR* argv[] ); >+static _TCHAR** getVMArguments( int argc, _TCHAR* argv[], int *dstArgc ); > _TCHAR* findCommand( _TCHAR* command ); >-static _TCHAR* formatVmCommandMsg( _TCHAR* args[] ); >- _TCHAR* getInstallDir(); >-static _TCHAR* getDefaultOfficialName(); >-static int isMainEclipse( int argc, _TCHAR **argv ); >+static _TCHAR* formatVmCommandMsg( int argc, _TCHAR* argv[] ); >+static _TCHAR* getInstallDir( void ); >+static _TCHAR* getDefaultOfficialName( void ); >+static _TCHAR* getJarFile( void ); >+static _TCHAR* getJavaVM( void ); > > #ifdef _WIN32 > #ifdef UNICODE >@@ -317,15 +207,11 @@ > > int main( int argc, _TCHAR* argv[] ) > { >- _TCHAR* splashBitmap; > _TCHAR* ch; >- _TCHAR* data; >- _TCHAR* shippedVM = NULL; >- _TCHAR* vmSearchPath = NULL; >- _TCHAR** vmCommand = NULL; >- _TCHAR** vmCommandList = NULL; >- _TCHAR** vmCommandArgs = NULL; >+ _TCHAR** vmCommandArgv = NULL; > _TCHAR* vmCommandMsg = NULL; >+ int vmCommandArgc = 0; >+ _TCHAR* jarFile = NULL; > _TCHAR* errorMsg; > int exitCode; > >@@ -355,7 +241,7 @@ > } > > /* Parse configuration file arguments */ >- if (isMainEclipse(argc, argv) && readConfigFile(program, argv[0], &configArgc, &configArgv) == 0) >+ if (readConfigFile(program, argv[0], &configArgc, &configArgv) == 0) > { > parseArgs (&configArgc, configArgv); > } >@@ -375,174 +261,55 @@ > /* Initialize official program name */ > officialName = name != NULL ? _tcsdup( name ) : getDefaultOfficialName(); > >- /* Initialize the window system. */ >- initWindowSystem( &argc, argv, (showSplashArg != NULL) ); >- > /* Find the home directory where the Eclipse is installed. */ > homeDir = getInstallDir(); >+ >+ /* Initialize the window system. */ >+ initWindowSystem( &argc, argv, homeDir ); >+ >+ /* Error if home dir could not be determined */ > if (homeDir == NULL) > { >- errorMsg = malloc( (_tcslen(homeMsg) + _tcslen(officialName) + 10) * sizeof(_TCHAR) ); >- _stprintf( errorMsg, homeMsg, officialName ); >+ errorMsg = malloc( (_tcslen(homeMsg) + _tcslen(officialName) + _tcslen(startupJarName) + 10) * sizeof(_TCHAR) ); >+ _stprintf( errorMsg, homeMsg, officialName, startupJarName ); > displayMessage( errorMsg ); > free( errorMsg ); > exit( 1 ); > } >+ >+ /* Determine the location of the startup jar file */ >+ jarFile = getJarFile(); > >- /* If the exit data option was given, set exit data */ >- if (exitDataArg != NULL) >- { >- /* If an extra argument was given, use it as the exit data, otherwise clear exit data */ >- data = argc > 1 ? argv[1] : NULL; >- if (data != NULL && _tcslen( data ) > MAX_SHARED_LENGTH - 1) >- { >- exitCode = EINVAL; >- } >- else { >- exitCode = setSharedData( exitDataArg, data ); >- } >- if (exitCode != 0 && debug) displayMessage( shareMsg ); >- exit( exitCode ); >- } >- >- /* If the showsplash option was given */ >- if (showSplashArg != NULL) >- { >- /* If an extra argument was given, pass it as the image to display. */ >- splashBitmap = (argc > 1 ? argv[1] : NULL); >- exitCode = showSplash( showSplashArg, homeDir, splashBitmap ); >- if (exitCode && debug) >- { >- if (splashBitmap == NULL) >- splashBitmap = homeDir; >- errorMsg = malloc( (_tcslen(showMsg) + _tcslen(splashBitmap) + 10) * sizeof(_TCHAR) ); >- _stprintf( errorMsg, showMsg, splashBitmap ); >- displayMessage( errorMsg ); >- free( errorMsg ); >- } >- exit( exitCode ); >- } >- >- /* If the user did not specify a VM to be used */ >- if (vmName == NULL) >- { >- /* Determine which type of VM should be used. */ >- vmName = ((debug || needConsole) ? consoleVM : defaultVM); >- >- /* Try to find the VM shipped with eclipse. */ >- shippedVM = malloc( (_tcslen( homeDir ) + _tcslen( shippedVMDir ) + _tcslen( vmName ) + 10) * sizeof(_TCHAR) ); >- _stprintf( shippedVM, _T("%s%s%s"), homeDir, shippedVMDir, vmName ); >- javaVM = findCommand( shippedVM ); >- >- /* Format a message to indicate the default VM search path. */ >- vmSearchPath = malloc( (_tcslen( pathMsg ) + _tcslen( shippedVM ) + _tcslen( vmName ) + 10) * sizeof(_TCHAR) ); >- _stprintf( vmSearchPath, pathMsg, shippedVM, vmName ); >- free( shippedVM ); >- shippedVM = NULL; >- } >- >- /* If a Java VM has not been found yet */ >- if (javaVM == NULL) >- { >- /* Either verify the VM specified by the user or >- attempt to find the VM in the user's PATH. */ >- javaVM = findCommand( vmName ); >- >- /* If the VM was not found, display a message and exit. */ >- if (javaVM == NULL) >- { >- if (vmSearchPath != NULL) vmName = vmSearchPath; /* used default VM searching */ >- errorMsg = malloc( (_tcslen(noVMMsg) + _tcslen(officialName) + _tcslen(vmName) + 10) * sizeof(_TCHAR) ); >- _stprintf( errorMsg, noVMMsg, officialName, vmName ); >- displayMessage( errorMsg ); >- free( errorMsg ); >- exit(1); >- } >- } >- >- if (createSharedData( &sharedID, MAX_SHARED_LENGTH )) { >- if (debug) { >- if (debug) displayMessage( shareMsg ); >- } >- } >- >- /* Get the command to start the Java VM. */ >- vmCommandArgs = getVMCommand( argc, argv ); >+ /* Determine the Java VM to be used */ >+ javaVM = getJavaVM(); > >- /* While the Java VM should be restarted */ >- vmCommand = vmCommandArgs; >- while (vmCommand != NULL) >- { >- vmCommandMsg = formatVmCommandMsg( vmCommand ); >- if (debug) _tprintf( goVMMsg, vmCommandMsg ); >- exitCode = startJavaVM( vmCommand ); >- switch( exitCode ) { >- case 0: >- vmCommand = NULL; >- break; >- case RESTART_LAST_EC: >- break; >- case RESTART_NEW_EC: >- if (getSharedData( sharedID, &data ) == 0) { >- if (vmCommandList != NULL) freeArgList( vmCommandList ); >- vmCommand = vmCommandList = parseArgList( data ); >- } else { >- vmCommand = NULL; >- if (debug) displayMessage( shareMsg ); >- } >- break; >- default: >- vmCommand = NULL; >- errorMsg = NULL; >- if (getSharedData( sharedID, &errorMsg ) == 0) { >- if (_tcslen( errorMsg ) == 0) { >- free( errorMsg ); >- errorMsg = NULL; >- } >- } else { >- if (debug) displayMessage( shareMsg ); >- } >- if (errorMsg == NULL) { >- errorMsg = malloc( (_tcslen(exitMsg) + _tcslen(vmCommandMsg) + 10) * sizeof(_TCHAR) ); >- _stprintf( errorMsg, exitMsg, exitCode, vmCommandMsg ); >- } >- displayMessage( errorMsg ); >- free( errorMsg ); >- break; >- } >- free( vmCommandMsg ); >- } >+ /* Get the arguments to pass to the Java VM. */ >+ vmCommandArgv = getVMArguments( argc, argv, &vmCommandArgc ); >+ vmCommandMsg = formatVmCommandMsg( vmCommandArgc, vmCommandArgv ); >+ if (debug) _tprintf( goVMMsg, vmCommandMsg ); >+ >+ /* Let 'er rip */ >+ exitCode = startJavaVM( javaVM, jarFile, startupClassName, vmCommandArgc, vmCommandArgv ); >+ if (exitCode != 0) >+ { >+ errorMsg = malloc( (_tcslen(exitMsg) + _tcslen(vmCommandMsg) + 10) * sizeof(_TCHAR) ); >+ _stprintf( errorMsg, exitMsg, exitCode, vmCommandMsg ); >+ displayMessage( errorMsg ); >+ free( errorMsg ); >+ } > > /* Cleanup time. */ > free( homeDir ); > free( program ); >- if ( vmSearchPath != NULL ) free( vmSearchPath ); >- if ( vmCommandList != NULL ) freeArgList( vmCommandList ); >+ if ( jarFile != NULL ) free( jarFile ); >+ if ( vmCommandMsg != NULL ) free( vmCommandMsg ); > if ( configArgv != NULL ) freeConfig( configArgv ); > if (configArgc > 1) free( argv ); > free( officialName ); >- if ( sharedID != NULL ) { >- if (destroySharedData( sharedID ) != 0) { >- if (debug) displayMessage( shareMsg ); >- } >- free( sharedID ); >- } > > return 0; > } > >-/* Return 1 if the current Eclipse is the process that starts the java IDE >- * Return 0 if it is an Eclipse used to display a splash screen or to write >- * data to a shared memory segment. >- * The main Eclipse is the only one that reads the eclipse.ini file. >- */ >-static int isMainEclipse( int argc, _TCHAR **argv ) >-{ >- /* It is the main eclipse if the argument 1 is neither SHOWSPLASH nor EXITDATA */ >- if (argc < 2) return 1; >- return (_tcsicmp( argv[1], SHOWSPLASH ) != 0 && _tcsicmp( argv[1], EXITDATA ) != 0); >-} >- > /* > * Parse arguments of the command. > */ >@@ -632,43 +399,6 @@ > } > > /* >- * Free the memory allocated by parseArgList(). >- */ >-static void freeArgList( _TCHAR** data ) { >- if (data == NULL) return; >- free( data [0] ); >- free( data ); >-} >- >-/* >- * Parse the data into a list of arguments separarted by \n. >- * >- * The list of strings returned by this function must be freed with >- * freeArgList(). >- */ >-static _TCHAR** parseArgList( _TCHAR* data ) { >- int totalArgs = 0, dst = 0, length; >- _TCHAR *ch1, *ch2, **execArg; >- length = _tcslen( data ); >- ch1 = ch2 = data; >- while ((ch2 = _tcschr( ch1, _T('\n') )) != NULL) { >- totalArgs++; >- ch1 = ch2 + 1; >- } >- if (ch1 != data + length) totalArgs++; >- execArg = malloc( (totalArgs + 1) * sizeof( _TCHAR* ) ); >- ch1 = ch2 = data; >- while ((ch2 = _tcschr( ch1, _T('\n') )) != NULL) { >- execArg[ dst++ ] = ch1; >- ch2[ 0 ] = _T('\0'); >- ch1 = ch2 + 1; >- } >- if (ch1 != data + length) execArg[ dst++ ] = ch1; >- execArg[ dst++ ] = NULL; >- return execArg; >-} >- >-/* > * Find the absolute pathname to where a command resides. > * > * The string returned by the function must be freed. >@@ -804,7 +534,7 @@ > } > > /* >- * Get the command and arguments to start the Java VM. >+ * Get the arguments to pass to the Java VM. > * > * Memory allocated by this function is assumed to be > * deallocated when the program terminates. >@@ -813,17 +543,11 @@ > * passed directly from the main( argv ) array so they > * should not be deallocated. > */ >-static _TCHAR** getVMCommand( int argc, _TCHAR* argv[] ) >+static _TCHAR** getVMArguments( int argc, _TCHAR* argv[], int *dstArgc ) > { >- _TCHAR** defVMarg; >- int nDefVMarg = 0; >- int nReqVMarg = 0; > int nUserVMarg = 0; > int totalArgs; > _TCHAR** execArg; >- _TCHAR* jarFile = NULL; >- _TCHAR* splashExec; >- _TCHAR* exitDataExec; > int src; > int dst; > >@@ -834,55 +558,18 @@ > nUserVMarg++; > } > >- /* Calculate the number of default VM arguments. */ >- defVMarg = getArgVM( javaVM ); >- while (defVMarg[ nDefVMarg ] != NULL) >- nDefVMarg++; >- >- /* Calculate the number of required VM arguments. */ >- while (reqVMarg[ nReqVMarg ] != NULL) >- nReqVMarg++; >- >- /* Allocate the arg list for the exec call. >- * (VM + userVMargs + defaultVMargs + requiredVMargs + OS <os> + WS <ws> + ARCH <arch> >- * + SHOWSPLASH <cmd> + EXITDATA <cmd> + argv[] + VM + <vm> + VMARGS + userVMargs + defaultVMargs + requiredVMargs >- * + NULL) >+ /* Allocate the arg list for the JVM >+ * (userVMargs + defaultVMargs + OS <os> + WS <ws> + ARCH <arch> >+ * + argv[] + NULL) > */ >- totalArgs = 1 + nUserVMarg + nDefVMarg + nReqVMarg + 2 + 2 + 2 + 2 + 2 + argc + 2 + 1 + nUserVMarg + nDefVMarg + nReqVMarg + 1; >+ totalArgs = nUserVMarg + 2 + 2 + 2 + 2 + 2 + argc + 2 + 1; > execArg = malloc( totalArgs * sizeof( _TCHAR* ) ); > dst = 0; >- execArg[ dst++ ] = javaVM; > >- /* If the user specified "-vmargs", add them instead of the default VM args. */ >- if (userVMarg != NULL) >- { >- for (src = 0; src < nUserVMarg; src++) >- execArg[ dst++ ] = userVMarg[ src ]; >- } >- else >- { >- for (src = 0; src < nDefVMarg; src++) >- execArg[ dst++ ] = defVMarg[ src ]; >- } >+ /* For each user VM arg */ >+ for (src = 0; src < nUserVMarg; src++) >+ execArg[ dst++ ] = userVMarg[ src ]; > >- /* For each required VM arg */ >- jarFile = malloc( (_tcslen( homeDir ) + _tcslen( startupJarName ) + 1) * sizeof( _TCHAR ) ); >- jarFile = _tcscpy( jarFile, homeDir ); >- jarFile = _tcscat( jarFile, startupJarName ); >- for (src = 0; src < nReqVMarg; src++) >- { >- /* If the argument is not the startup jar, use it as is. */ >- if (_tcscmp( reqVMarg[ src ], startupJarName ) != 0) >- { >- execArg[ dst++ ] = reqVMarg[ src ]; >- } >- >- /* else use the absolute path of the jar file. */ >- else >- { >- execArg[ dst++ ] = jarFile; >- } >- } > > /* Append the required options. */ > execArg[ dst++ ] = OS; >@@ -892,62 +579,11 @@ > execArg[ dst++ ] = OSARCH; > execArg[ dst++ ] = osArchArg; > >- /* Append the show splash window command, if defined. */ >- if (!noSplash) >- { >- execArg[ dst++ ] = SHOWSPLASH; >- splashExec = malloc( (_tcslen( program ) + _tcslen(SHOWSPLASH) + _tcslen( splashTimeout ) + 3) * sizeof(_TCHAR) ); >- _stprintf( splashExec, _T("%s %s %s"), program, SHOWSPLASH, splashTimeout ); >- execArg[ dst++ ] = splashExec; >- } >- >- /* Append the exit data command. */ >- if (sharedID) { >- execArg[ dst++ ] = EXITDATA; >- exitDataExec = malloc( (_tcslen( program ) + _tcslen( EXITDATA ) + _tcslen( sharedID ) + 3) * sizeof(_TCHAR) ); >- _stprintf( exitDataExec, _T("%s %s %s"), program, EXITDATA, sharedID ); >- execArg[ dst++ ] = exitDataExec; >- } >- > /* Append the remaining user defined arguments. */ > for (src = 1; src < argc; src++) >- { > execArg[ dst++ ] = argv[ src ]; >- } >- >- /* Append VM and VMARGS to be able to relaunch using exit data. */ >- execArg[ dst++ ] = VM; >- execArg[ dst++ ] = javaVM; >- execArg[ dst++ ] = VMARGS; >- /* If the user specified "-vmargs", add them instead of the default VM args. */ >- if (userVMarg != NULL) >- { >- for (src = 0; src < nUserVMarg; src++) >- execArg[ dst++ ] = userVMarg[ src ]; >- } >- else >- { >- for (src = 0; src < nDefVMarg; src++) >- execArg[ dst++ ] = defVMarg[ src ]; >- } >- /* For each required VM arg */ >- for (src = 0; src < nReqVMarg; src++) >- { >- /* If the argument is not the startup jar, use it as is. */ >- if (_tcscmp( reqVMarg[ src ], startupJarName ) != 0) >- { >- execArg[ dst++ ] = reqVMarg[ src ]; >- } >- >- /* else use the absolute path of the jar file. */ >- else >- { >- execArg[ dst++ ] = jarFile; >- } >- } >- >- execArg[ dst++ ] = NULL; > >+ *dstArgc = dst; > return execArg; > } > >@@ -957,7 +593,7 @@ > * that can be used in displaying error messages. The string returned from this > * method is probably not NLS compliant and must be deallocated by the caller. > */ >-static _TCHAR* formatVmCommandMsg( _TCHAR* args[] ) >+static _TCHAR* formatVmCommandMsg( int argc, _TCHAR* argv[] ) > { > int index; > int length; >@@ -966,9 +602,9 @@ > > /* Determine the length of the message buffer. */ > length = 0; >- for (index = 0; args[index] != NULL; index++) >+ for (index = 0; index < argc; index++) > { >- length += _tcslen(args[index]) + 1; >+ length += _tcslen(argv[index]) + 1; > } > message = malloc( (length + 5) * sizeof(_TCHAR) ); > >@@ -976,12 +612,12 @@ > on a new line. Otherwise, the Motif MessageBox does not automatically wrap > the messages and the message window can extend beyond both sides of the display. */ > ch = message; >- for (index = 0; args[index] != NULL; index++) >+ for (index = 0; index < argc; index++) > { >- if (args[index][0] == _T('-') && *(ch-1) == _T(' ')) >+ if (argv[index][0] == _T('-') && *(ch-1) == _T(' ')) > *(ch-1) = _T('\n'); >- _tcscpy( ch, args[index] ); >- ch += _tcslen( args[index] ); >+ _tcscpy( ch, argv[index] ); >+ ch += _tcslen( argv[index] ); > *ch++ = _T(' '); > } > *ch = _T('\0'); >@@ -993,13 +629,12 @@ > * Determine the default official application name > * > * This function provides the default application name that appears in a variety of >- * places such as: title of message dialog, title of splash screen window >- * that shows up in Windows task bar. >+ * places such as: title of message dialog that shows up in Windows task bar. > * It is computed from the name of the launcher executable and > * by capitalizing the first letter. e.g. "c:/ide/eclipse.exe" provides > * a default name of "Eclipse". > */ >-static _TCHAR* getDefaultOfficialName() >+static _TCHAR* getDefaultOfficialName( void ) > { > _TCHAR *ch = NULL; > >@@ -1031,7 +666,7 @@ > * contain the startup JAR file and the executable must be either in the > * install directory or in a subdirectory. > */ >-_TCHAR* getInstallDir( ) >+static _TCHAR* getInstallDir( void ) > { > _TCHAR* ch; > _TCHAR* installDir; >@@ -1067,3 +702,63 @@ > return NULL; > } > >+/* >+ * Determine the Jar file name. Caller must free pointer returned. >+ */ >+static _TCHAR* getJarFile( void ) >+{ >+ _TCHAR* jarFile = malloc( (_tcslen( homeDir ) + _tcslen( startupJarName ) + 1) * sizeof( _TCHAR ) ); >+ jarFile = _tcscpy( jarFile, homeDir ); >+ jarFile = _tcscat( jarFile, startupJarName ); >+ return jarFile; >+} >+ >+/* >+ * Determine the Java VM >+ */ >+static _TCHAR* getJavaVM( void ) >+{ >+ _TCHAR* shippedVM = NULL; >+ _TCHAR* javaVM = NULL; >+ _TCHAR* vmSearchPath = NULL; >+ _TCHAR* errorMsg = NULL; >+ >+ /* If the user did not specify a VM to be used */ >+ if (vmName == NULL) >+ { >+ /* Determine which type of VM should be used. */ >+ vmName = ((debug || needConsole) ? consoleVM : defaultVM); >+ >+ /* Try to find the VM shipped with eclipse. */ >+ shippedVM = malloc( (_tcslen( homeDir ) + _tcslen( shippedVMDir ) + _tcslen( vmName ) + 10) * sizeof(_TCHAR) ); >+ _stprintf( shippedVM, _T("%s%s%s"), homeDir, shippedVMDir, vmName ); >+ javaVM = findCommand( shippedVM ); >+ >+ /* Format a message to indicate the default VM search path. */ >+ vmSearchPath = malloc( (_tcslen( pathMsg ) + _tcslen( shippedVM ) + _tcslen( vmName ) + 10) * sizeof(_TCHAR) ); >+ _stprintf( vmSearchPath, pathMsg, shippedVM, vmName ); >+ free( shippedVM ); >+ shippedVM = NULL; >+ } >+ >+ /* If a Java VM has not been found yet */ >+ if (javaVM == NULL) >+ { >+ /* Either verify the VM specified by the user or >+ attempt to find the VM in the user's PATH. */ >+ javaVM = findCommand( vmName ); >+ >+ /* If the VM was not found, display a message and exit. */ >+ if (javaVM == NULL) >+ { >+ if (vmSearchPath != NULL) vmName = vmSearchPath; /* used default VM searching */ >+ errorMsg = malloc( (_tcslen(noVMMsg) + _tcslen(officialName) + _tcslen(vmName) + 10) * sizeof(_TCHAR) ); >+ _stprintf( errorMsg, noVMMsg, officialName, vmName ); >+ displayMessage( errorMsg ); >+ free( errorMsg ); >+ exit(1); >+ } >+ } >+ if ( vmSearchPath != NULL ) free( vmSearchPath ); >+ return javaVM; >+} >Index: eclipseOS.h >=================================================================== >RCS file: /home/eclipse/platform-launcher/library/eclipseOS.h,v >retrieving revision 1.22 >diff -u -r1.22 eclipseOS.h >--- eclipseOS.h 10 Dec 2004 17:28:53 -0000 1.22 >+++ eclipseOS.h 12 Jan 2005 00:22:29 -0000 >@@ -60,52 +60,17 @@ > * > * This method is called after the command line arguments have been > * parsed. Its purpose is to initialize the corresponding window system. >- * >- * The showSplash flag indicates the splash window will be displayed by >- * this process (e.g., value will be zero for the main launcher). >- */ >-extern void initWindowSystem( int* argc, _TCHAR* argv[], int showSplash ); >- >- >-/** Show the Splash Window >- * >- * This method is called to display the actual splash window. It will only >- * be called by the splash window process and not the main launcher process. >- * The splash ID passed corresponds to the string returned from initWindowSystem(). >- * If possible, this ID should be used to communicate some piece of data back >- * to the main launcher program for two reasons: >- * 1) to detect when the splash window process terminates >- * 2) to terminate the splash window process should the JVM terminate before it >- * completes its initialization. >- * >- * Two parameters are passed: the install home directory and a specific bitmap image >- * file for a feature. The feature's image file is tried first and if it cannot be >- * displayed, the images from the install directory are used. >- * >- * Return (exit code): >- * 0 - success >- * non-zero - could not find a splash image to display >- */ >-extern int showSplash( _TCHAR* splashId, _TCHAR* homeDir, _TCHAR* featureImage ); >- >- >-/** Get List of Java VM Arguments >- * >- * A given Java VM might require a special set of arguments in order to >- * optimize its performance. This method returns a NULL terminated array >- * of strings, where each string is a separate VM argument. > */ >-extern _TCHAR** getArgVM( _TCHAR *vm ); >- >+extern void initWindowSystem( int* argc, _TCHAR* argv[], _TCHAR *homeDir ); > >-/* Start the Java VM and Wait For It to Terminate >+/** Start the Java VM and Wait For It to Terminate > * > * This method is responsible for starting the Java VM and for > * detecting its termination. The resulting JVM exit code should > * be returned to the main launcher, which will display a message if > * the termination was not normal. > */ >-extern int startJavaVM( _TCHAR* args[] ); >+extern int startJavaVM( _TCHAR* javaVM, _TCHAR* jarFile, _TCHAR* className, int argc, _TCHAR* argv[] ); > > #endif /* ECLIPSE_OS_H */ > >Index: win32/eclipse.rc >=================================================================== >RCS file: /home/eclipse/platform-launcher/library/win32/eclipse.rc,v >retrieving revision 1.4 >diff -u -r1.4 eclipse.rc >--- win32/eclipse.rc 24 Mar 2003 19:02:04 -0000 1.4 >+++ win32/eclipse.rc 12 Jan 2005 00:22:29 -0000 >@@ -8,13 +8,15 @@ > * Contributors: > * IBM Corporation - initial API and implementation > *******************************************************************************/ >- >+ > #define ECLIPSE_ICON 401 >+#define CREATEPROCESS_MANIFEST_RESOURCE_ID 1 >+#define RT_MANIFEST 24 > > #include "windows.h" > #include "winver.h" > >- > ECLIPSE_ICON ICON DISCARDABLE "eclipse.ico" >+CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "eclipse.exe.manifest" > > >Index: win32/eclipseWin.c >=================================================================== >RCS file: /home/eclipse/platform-launcher/library/win32/eclipseWin.c,v >retrieving revision 1.20 >diff -u -r1.20 eclipseWin.c >--- win32/eclipseWin.c 10 Dec 2004 17:28:53 -0000 1.20 >+++ win32/eclipseWin.c 12 Jan 2005 00:22:29 -0000 >@@ -25,40 +25,18 @@ > /* Global Variables */ > _TCHAR dirSeparator = _T('\\'); > _TCHAR pathSeparator = _T(';'); >-_TCHAR* consoleVM = _T("java.exe"); >-_TCHAR* defaultVM = _T("javaw.exe"); >-_TCHAR* shippedVMDir = _T("jre\\bin\\"); >- >-/* Define the window system arguments for the Java VM. */ >-static _TCHAR* argVM[] = { NULL }; >- >-/* Define local variables for the main window. */ >-static HWND topWindow = 0; >-static WNDPROC oldProc; >+#include <jni.h> /* java native interface */ >+_TCHAR* consoleVM = _T("jni.dll"); >+_TCHAR* defaultVM = _T("jni.dll"); >+_TCHAR* shippedVMDir = _T("jre\\bin\\client\\"); > > /* Define local variables for running the JVM and detecting its exit. */ >-static int jvmProcess = 0; > static int jvmExitCode = 0; >-static int jvmExitTimeout = 100; >-static int jvmExitTimerId = 99; >- >-/* Define local variables for handling the splash window and its image. */ >-static _TCHAR* loResSplash = _T("splash_basic.bmp"); >-static _TCHAR* hiResSplash = _T("splash_full.bmp"); >-static int splashTimerId = 88; >-#define LO_RES_DEPTH 8 >- >-/* Local functions */ >-static void CALLBACK detectJvmExit( HWND hwnd, UINT uMsg, UINT id, DWORD dwTime ); >-static HBITMAP loadSplashImage(_TCHAR *baseDir, _TCHAR *fileName); >-static void CALLBACK splashTimeout( HWND hwnd, UINT uMsg, UINT id, DWORD dwTime ); >-static LRESULT WINAPI WndProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam); >- > > /* Display a Message */ > void displayMessage( _TCHAR* message ) > { >- MessageBox( topWindow, message, officialName, MB_OK ); >+ MessageBox( NULL, message, officialName, MB_OK ); > } > > /* Initialize Window System >@@ -68,270 +46,173 @@ > * Return the window handle as the data for the splash command. > * > */ >-void initWindowSystem( int* pArgc, _TCHAR* argv[], int showSplash ) >-{ >- /* Create a window that has no decorations. */ >- topWindow = CreateWindowEx (0, >- _T("STATIC"), >- officialName, >- SS_BITMAP | WS_POPUP, >- 0, >- 0, >- 0, >- 0, >- NULL, >- NULL, >- GetModuleHandle (NULL), >- NULL); >- oldProc = (WNDPROC) GetWindowLong (topWindow, GWL_WNDPROC); >- SetWindowLong (topWindow, GWL_WNDPROC, (LONG) WndProc); >-} >- >- >-/* Show the Splash Window >- * >- * Open the bitmap, insert into the splash window and display it. >- * >- */ >-int showSplash( _TCHAR* timeoutString, _TCHAR* homeDir, _TCHAR* featureImage ) >+void initWindowSystem( int* argc, _TCHAR* argv[], _TCHAR *homeDir ) > { >- int timeout = 0; >- RECT rect; >- HBITMAP hBitmap = 0; >- HDC hDC; >- int depth; >- int x, y; >- int width, height; >- MSG msg; >- >- /* Determine the splash timeout value (in seconds). */ >- if (timeoutString != NULL && _tcslen( timeoutString ) > 0) >- { >- _stscanf( timeoutString, _T("%d"), &timeout ); >- } >- >- /* Load the bitmap for the feature. */ >- hDC = GetDC( NULL); >- depth = GetDeviceCaps( hDC, BITSPIXEL ) * GetDeviceCaps( hDC, PLANES); >- ReleaseDC(NULL, hDC); >- if (featureImage != NULL) >- hBitmap = LoadImage(NULL, featureImage, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE); >- >- /* If the bitmap could not be found, try again using the install directory. */ >- if (hBitmap == 0) >- hBitmap = loadSplashImage( homeDir, depth <= LO_RES_DEPTH ? loResSplash : hiResSplash ); >- >- /* If the bitmap could not be found, return an error. */ >- if (hBitmap == 0) >- return ERROR_FILE_NOT_FOUND; >- >- /* Load the bitmap into the splash popup window. */ >- SendMessage( topWindow, STM_SETIMAGE, IMAGE_BITMAP, (LPARAM) hBitmap ); >- >- /* Centre the splash window and display it. */ >- GetWindowRect (topWindow, &rect); >- width = GetSystemMetrics (SM_CXSCREEN); >- height = GetSystemMetrics (SM_CYSCREEN); >- x = (width - (rect.right - rect.left)) / 2; >- y = (height - (rect.bottom - rect.top)) / 2; >- SetWindowPos (topWindow, 0, x, y, 0, 0, SWP_NOZORDER | SWP_NOSIZE | SWP_NOACTIVATE); >- ShowWindow( topWindow, SW_SHOW ); >- BringWindowToTop( topWindow ); > >- /* If a timeout for the splash window was given */ >- if (timeout != 0) >- { >- /* Add a timeout (in milliseconds) to bring down the splash screen. */ >- SetTimer( topWindow, splashTimerId, (timeout * 1000), splashTimeout ); >- } >- >- /* Process messages until the splash window is closed or process is terminated. */ >- while (GetMessage( &msg, NULL, 0, 0 )) >- { >- TranslateMessage( &msg ); >- DispatchMessage( &msg ); >- } >- >- return 0; > } > >+static jstring newJavaString(JNIEnv *env, char *s) >+{ >+ int len; >+ jclass cls; >+ jmethodID mid; >+ jbyteArray ary; >+ jstring str = 0; >+ >+ if (s == NULL) >+ return 0; >+ len = strlen(s); >+ ary = (*env)->NewByteArray(env, len); >+ if (ary != 0) >+ { >+ (*env)->SetByteArrayRegion(env, ary, 0, len, (jbyte *)s); >+ if (!(*env)->ExceptionOccurred(env)) { >+ cls = (*env)->FindClass(env, "java/lang/String"); >+ mid = (*env)->GetMethodID(env, cls, "<init>", "([B)V"); >+ str = (*env)->NewObject(env, cls, mid, ary); >+ } >+ (*env)->DeleteLocalRef(env, ary); >+ } >+ return str; >+} >+ >+static jobjectArray newJavaStringArray(JNIEnv *env, char **argv, int argc) >+{ >+ jarray cls; >+ jarray ary; >+ int i; >+ >+ cls = (*env)->FindClass(env, "java/lang/String"); >+ ary = (*env)->NewObjectArray(env, argc, cls, 0); >+ for (i = 0; i < argc; i++) { >+ jstring str = newJavaString(env, *argv++); >+ (*env)->SetObjectArrayElement(env, ary, i, str); >+ (*env)->DeleteLocalRef(env, str); >+ } >+ return ary; >+} > >-/* Get the window system specific VM args */ >-_TCHAR** getArgVM( _TCHAR *vm ) >+/** >+ * Convert a wide string to a narrow one suitable for use in JNI. >+ * Caller must free the null terminated string returned. >+ */ >+static char *toNarrow(_TCHAR* src) > { >- return argVM; >+#ifdef UNICODE >+ int byteCount = WideCharToMultiByte (CP_ACP, 0, (wchar_t *)src, -1, NULL, 0, NULL, NULL); >+ char *dest = malloc(byteCount+1); >+ dest[byteCount] = 0; >+ WideCharToMultiByte (CP_ACP, 0, (wchar_t *)src, -1, dest, byteCount, NULL, NULL); >+ return dest; >+#else >+ return _tcsdup(src); >+#endif > } > >- > /* Start the Java VM > * > * This method is called to start the Java virtual machine and to wait until it > * terminates. The function returns the exit code from the JVM. > */ >-int startJavaVM( _TCHAR* args[] ) >+int startJavaVM( _TCHAR* javaVM, _TCHAR* jarFile, _TCHAR* className, int argc, _TCHAR* argv[] ) > { >- MSG msg; >- int index, length; >- _TCHAR *commandLine, *ch, *space; >- >- /* >- * Build the command line. Any argument with spaces must be in >- * double quotes in the command line. >- */ >- length = 0; >- for (index = 0; args[index] != NULL; index++) >- { >- /* String length plus space character */ >- length += _tcslen( args[ index ] ) + 1; >- /* Quotes */ >- if (_tcschr( args[ index ], _T(' ') ) != NULL) length += 2; >- } >- commandLine = ch = malloc ( (length + 1) * sizeof(_TCHAR) ); >- for (index = 0; args[index] != NULL; index++) >- { >- space = _tcschr( args[ index ], _T(' ')); >- if (space != NULL) *ch++ = _T('\"'); >- _tcscpy( ch, args[index] ); >- ch += _tcslen( args[index] ); >- if (space != NULL) *ch++ = _T('\"'); >- *ch++ = _T(' '); >- } >- *ch = _T('\0'); >- >- /* >- * Start the Java virtual machine. Use CreateProcess() instead of spawnv() >- * otherwise the arguments cannot be freed since spawnv() segments fault. >- */ >- { >- STARTUPINFO si; >- PROCESS_INFORMATION pi; >- GetStartupInfo(&si); >- if (CreateProcess(NULL, commandLine, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi)) { >- CloseHandle( pi.hThread ); >- jvmProcess = (int)pi.hProcess; >- } >- } >- >- free( commandLine ); >- >- /* If the child process (JVM) would not start */ >- if (jvmProcess == -1) >+ HINSTANCE jvmLibrary; // Library handle >+ >+ //displayMessage(_T("jni invoke\n")); >+ jvmLibrary = LoadLibrary(javaVM); >+ /* If the child library (JVM) would not start */ >+ if (jvmLibrary == 0) > { > /* Return the error number. */ >+ displayMessage(_T("child lib would not start\n")); > jvmExitCode = errno; >- jvmProcess = 0; > } >- >- /* else */ > else > { >- /* Set a timer to detect JVM process termination. */ >- SetTimer( topWindow, jvmExitTimerId, jvmExitTimeout, detectJvmExit ); >- >- /* Process messages until the JVM terminates. >- This launcher process must continue to process events until the JVM exits >- or else Windows 2K will hang if the desktop properties (e.g., background) are >- changed by the user. Windows does a SendMessage() to every top level window >- process, which blocks the caller until the process responds. */ >- while (jvmProcess != 0) >- { >- GetMessage( &msg, NULL, 0, 0 ); >- TranslateMessage( &msg ); >- DispatchMessage( &msg ); >+ /* Get the function addresses */ >+ //displayMessage(_T("get function address\n")); >+ jint (JNICALL *createJavaVM)(JavaVM **pvm, JNIEnv **env, void *args); >+ createJavaVM = (void *)GetProcAddress(jvmLibrary, "JNI_CreateJavaVM"); >+ if (createJavaVM == 0) >+ { >+ /* Return the error number. */ >+ displayMessage(_T("createJavaVM or getDefaultJavaVMInitArgs address not found\n")); >+ jvmExitCode = errno; >+ } >+ else >+ { >+ JavaVM *jvm; /* denotes a Java VM */ >+ JNIEnv *env; /* pointer to native method interface */ >+ int i; >+ char *narrowJarFile = toNarrow(jarFile); >+ //displayMessage(jarFile); >+ char *narrowClassName = toNarrow(className); >+ //displayMessage(className); >+ >+ // documented here: http://java.sun.com/j2se/1.4.2/docs/guide/jni/jni-12.html#JNI_CreateJavaVM >+ //displayMessage(_T("pack arguments\n")); >+ JavaVMInitArgs vm_args = {0}; >+ JavaVMOption *options = malloc((1 + argc) * sizeof(JavaVMOption)); >+ memset(options, 0, (1 + argc) * sizeof(JavaVMOption)); >+ static char* classPath = "-Djava.class.path="; >+ options[0].optionString = malloc(strlen(classPath) + strlen(narrowJarFile) + 1); >+ strcpy(options[0].optionString, classPath); >+ strcat(options[0].optionString, narrowJarFile); >+ for (i = 0; i < argc; i++) { >+ options[i+1].optionString = toNarrow(argv[i]); >+ } >+ vm_args.version = JNI_VERSION_1_4; >+ vm_args.options = options; >+ vm_args.nOptions = 1 + argc; >+ vm_args.ignoreUnrecognized = JNI_TRUE; >+ >+ /* load and initialize a Java VM, return a JNI interface pointer in env */ >+ //displayMessage(_T("about to create vm\n")); >+ (*createJavaVM)(&jvm, &env, &vm_args); >+ if (jvm == NULL) >+ { >+ displayMessage(_T("createJavaVM failed\n")); >+ jvmExitCode = errno; >+ } >+ else >+ { >+ /* invoke the Main.test method using the JNI */ >+ //displayMessage(_T("about to FindClass\n")); >+ jclass cls = (*env)->FindClass(env, narrowClassName); >+ if (cls == NULL) >+ { >+ displayMessage(_T("FindClass failed\n")); >+ jvmExitCode = errno; >+ } >+ else >+ { >+ //displayMessage(_T("about to GetStaticMethodID\n")); >+ jmethodID mid = (*env)->GetStaticMethodID(env, cls, "main", "([Ljava/lang/String;)V"); >+ if (mid == NULL) >+ { >+ displayMessage(_T("GetStaticMethodID failed\n")); >+ jvmExitCode = errno; >+ } >+ else >+ { >+ //displayMessage(_T("about to call main\n")); >+ (*env)->CallStaticVoidMethod(env, cls, mid, >+ newJavaStringArray(env, NULL, 0)); >+ // shouldn't get here, but just in case... >+ //displayMessage(_T("main complete, destroying vm\n")); >+ /* We are done. */ >+ (*jvm)->DestroyJavaVM(jvm); >+ } >+ } >+ } >+ for (i = 0; i < vm_args.nOptions; i++) >+ free(options[i].optionString); >+ free(options); >+ free(narrowJarFile); >+ free(narrowClassName); > } >- >- /* Kill the timer. */ >- KillTimer( topWindow, jvmExitTimerId ); > } > > /* Return the exit code from the JVM. */ > return jvmExitCode; > } >- >-/* Local functions */ >- >-/* Detect JVM Process Termination */ >-static void CALLBACK detectJvmExit( HWND hwnd, UINT uMsg, UINT id, DWORD dwTime ) >-{ >- DWORD exitCode; >- >- /* If the JVM process has terminated */ >- if (!GetExitCodeProcess( (HANDLE)jvmProcess, &exitCode ) || >- exitCode != STILL_ACTIVE) >- { >- /* Save the JVM exit code. This should cause the loop in startJavaVM() to exit. */ >- jvmExitCode = exitCode; >- jvmProcess = 0; >- } >-} >- >-/* Splash Timeout */ >-static void CALLBACK splashTimeout( HWND hwnd, UINT uMsg, UINT id, DWORD dwTime ) >-{ >- /* Kill the timer. */ >- KillTimer( topWindow, id ); >- PostMessage( topWindow, WM_QUIT, 0, 0 ); >-} >- >- >-/* Load the splash image depending on the current locale. >- * >- * This is the search sequence for an USA english locale: >- * >- * 1 - <homeDir>splash\en_US\<fileName> >- * 2 - <homeDir>splash\en\<fileName> >- * 3 - <homeDir>splash\<fileName> >- * >- * Returns an HBITMAP or NULL if the file can not be found. >- */ >-static HBITMAP loadSplashImage(_TCHAR* baseDir, _TCHAR* fileName) >-{ >- HBITMAP hBitmap = NULL; >- LCID locale; >- _TCHAR lang[4] = {0}; >- _TCHAR country[4] = {0}; >- _TCHAR *splashFile; >- >- locale = GetThreadLocale (); >- GetLocaleInfo(locale, LOCALE_SISO639LANGNAME, lang, 4); >- GetLocaleInfo(locale, LOCALE_SISO3166CTRYNAME, country, 4); >- >- splashFile = malloc ( (_tcslen( baseDir ) + 256) * sizeof(_TCHAR) ); >- >- _stprintf( splashFile, _T("%s\\splash\\%s_%s\\%s"), baseDir, lang, country, fileName ); >- hBitmap = LoadImage (NULL, splashFile, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE); >- >- if (hBitmap == NULL) >- { >- _stprintf( splashFile, _T("%s\\splash\\%s\\%s"), baseDir, lang, fileName ); >- hBitmap = LoadImage (NULL, splashFile, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE); >- } >- >- if (hBitmap == NULL) >- { >- _stprintf( splashFile, _T("%s\\splash\\%s"), baseDir, fileName ); >- hBitmap = LoadImage (NULL, splashFile, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE); >- } >- >- free (splashFile); >- return hBitmap; >-} >- >- >-/* Window Procedure for the Spash window. >- * >- * A special WndProc is needed to return the proper vlaue for WM_NCHITTEST. >- * It must also detect the message from the splash window process. >- */ >-static LRESULT WINAPI WndProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) >-{ >- switch (uMsg) >- { >- case WM_NCHITTEST: return HTCLIENT; >- case WM_CLOSE: >- PostQuitMessage( 0 ); >- break; >- } >- return CallWindowProc (oldProc, hwnd, uMsg, wParam, lParam); >-} >- >Index: win32/make_mingw.mak >=================================================================== >RCS file: /home/eclipse/platform-launcher/library/win32/make_mingw.mak,v >retrieving revision 1.8 >diff -u -r1.8 make_mingw.mak >--- win32/make_mingw.mak 13 Dec 2004 19:58:13 -0000 1.8 >+++ win32/make_mingw.mak 12 Jan 2005 00:22:29 -0000 >@@ -34,6 +34,9 @@ > RC = $(TDIR)/i586-pc-cygwin-windres > SYSINC = -isystem $(TDIR)/../include/mingw > endif >+JDK_HOME="C:\Program Files\Java\jdk1.5.0_01" >+JNIINC = -I$(JDK_HOME)/include/ -I$(JDK_HOME)/include/win32 >+#CDEBUG = -g > > ifeq ($(CC),) > $(error Unable to find $(CCVER)-pc-cygwin-gcc) >@@ -48,7 +51,7 @@ > EXEC = $(PROGRAM_OUTPUT) > DEBUG = $(CDEBUG) > CFLAGS = -O -s -Wall \ >- -I. $(SYSINC) \ >+ -I. $(JNIINC) $(SYSINC) \ > -D_WIN32 \ > -DWIN32_LEAN_AND_MEAN \ > -mno-cygwin >Index: win32/eclipse.exe.manifest >=================================================================== >RCS file: win32/eclipse.exe.manifest >diff -N win32/eclipse.exe.manifest >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ win32/eclipse.exe.manifest 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,10 @@ >+<?xml version="1.0" encoding="UTF-8" standalone="yes"?> >+<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"> >+ <assemblyIdentity version="1.0.0.0" processorArchitecture="X86" name="IBM.Eclipse.eclipse" type="win32"/> >+ <description>Eclipse IDE</description> >+ <dependency> >+ <dependentAssembly> >+ <assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" processorArchitecture="X86" publicKeyToken="6595b64144ccf1df" language="*"/> >+ </dependentAssembly> >+ </dependency> >+</assembly>
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 82518
:
17063
| 17091