--- old/src/macosx/bundle/appbundler/native/main.m 2012-02-21 11:47:32.000000000 -0500 +++ new/src/macosx/bundle/appbundler/native/main.m 2012-02-21 11:47:32.000000000 -0500 @@ -29,11 +29,10 @@ #define JAVA_LAUNCH_ERROR "JavaLaunchError" -#define JAVA_VM_KEY "JavaVM" -#define RUNTIME_KEY "Runtime" -#define MAIN_CLASS_NAME_KEY "MainClassName" -#define OPTIONS_KEY "Options" -#define ARGUMENTS_KEY "Arguments" +#define JVM_RUNTIME_KEY "JVMRuntime" +#define JVM_MAIN_CLASS_NAME_KEY "JVMMainClassName" +#define JVM_OPTIONS_KEY "JVMOptions" +#define JVM_ARGUMENTS_KEY "JVMArguments" // TODO Remove these; they are defined by the makefile #define FULL_VERSION "1.7.0" @@ -77,55 +76,48 @@ NSBundle *mainBundle = [NSBundle mainBundle]; NSDictionary *infoDictionary = [mainBundle infoDictionary]; - NSString *javaVMPath = [[mainBundle bundlePath] stringByAppendingString:@"/Contents/JavaVM"]; - - // Get the Java dictionary - NSDictionary *javaVMDictionary = [infoDictionary objectForKey:@JAVA_VM_KEY]; - if (javaVMDictionary == nil) { - [NSException raise:@JAVA_LAUNCH_ERROR format:@"%@ is required.", @JAVA_VM_KEY]; - } + // Get the path to the Java directory + NSString *javaPath = [[mainBundle bundlePath] stringByAppendingString:@"/Contents/Java"]; // Get the runtime bundle URL - NSString *runtime = [javaVMDictionary objectForKey:@RUNTIME_KEY]; - // TODO If unspecified, use default runtime location - + NSString *runtime = [infoDictionary objectForKey:@JVM_RUNTIME_KEY]; NSURL *runtimeBundleURL = [[mainBundle builtInPlugInsURL] URLByAppendingPathComponent:runtime]; // Get the main class name - NSString *mainClassName = [javaVMDictionary objectForKey:@MAIN_CLASS_NAME_KEY]; + NSString *mainClassName = [infoDictionary objectForKey:@JVM_MAIN_CLASS_NAME_KEY]; if (mainClassName == nil) { - [NSException raise:@JAVA_LAUNCH_ERROR format:@"%@ is required.", @MAIN_CLASS_NAME_KEY]; + [NSException raise:@JAVA_LAUNCH_ERROR format:@"%@ is required.", @JVM_MAIN_CLASS_NAME_KEY]; } // Set the class path NSString *classPathFormat = @"-Djava.class.path=%@/Classes"; - NSMutableString *classPath = [[NSString stringWithFormat:classPathFormat, javaVMPath] mutableCopy]; + NSMutableString *classPath = [[NSString stringWithFormat:classPathFormat, javaPath] mutableCopy]; NSFileManager *defaultFileManager = [NSFileManager defaultManager]; - NSArray *javaDirectoryContents = [defaultFileManager contentsOfDirectoryAtPath:javaVMPath error:nil]; + NSArray *javaDirectoryContents = [defaultFileManager contentsOfDirectoryAtPath:javaPath error:nil]; if (javaDirectoryContents == nil) { [NSException raise:@JAVA_LAUNCH_ERROR format:@"Could not enumerate Java directory contents."]; } for (NSString *file in javaDirectoryContents) { if ([file hasSuffix:@".jar"]) { - [classPath appendFormat:@":%@/%@", javaVMPath, file]; + [classPath appendFormat:@":%@/%@", javaPath, file]; } } // Set the library path NSString *libraryPathFormat = @"-Djava.library.path=%@"; - NSString *libraryPath = [NSString stringWithFormat:libraryPathFormat, javaVMPath]; + NSString *libraryPath = [NSString stringWithFormat:libraryPathFormat, javaPath]; // Get the VM options - NSArray *options = [javaVMDictionary objectForKey:@OPTIONS_KEY]; + NSArray *options = [infoDictionary objectForKey:@JVM_OPTIONS_KEY]; if (options == nil) { options = [NSArray array]; } // Get the application arguments - NSArray *arguments = [javaVMDictionary objectForKey:@ARGUMENTS_KEY]; + NSArray *arguments = [infoDictionary objectForKey:@JVM_ARGUMENTS_KEY]; if (arguments == nil) { arguments = [NSArray array]; }