@@ -105,8 +105,18 @@ int main(int argc, char** argv) {
105105 }
106106
107107 jvmVersion = javaInfo[@" JVMVersion" ];
108- jvmOptionsFile = javaInfo[@" JVMOptionsFile" ];
109- bootstrapScript = javaInfo[@" BootstrapScript" ];
108+ if (javaInfo[@" JVMOptionsFile" ] != nil ) {
109+ NSString *jvmOptFileWithPlaceholders = javaInfo[@" JVMOptionsFile" ];
110+ jvmOptionsFile = resolvePlaceholders (jvmOptFileWithPlaceholders, javaFolder);
111+ } else {
112+ jvmOptionsFile = info[@" JVMOptionsFile" ];
113+ }
114+ if (javaInfo[@" BootstrapScript" ] != nil ) {
115+ NSString *bootstrapFileWithPlaceholders = javaInfo[@" BootstrapScript" ];
116+ bootstrapScript = resolvePlaceholders (bootstrapFileWithPlaceholders, javaFolder);
117+ } else {
118+ bootstrapScript = info[@" BootstrapScript" ];
119+ }
110120 } else {
111121 NSLog (@" [%s ] [PlistStyle] Oracle" , appName);
112122 javaFolder = [[main bundlePath ] stringByAppendingPathComponent: @" Contents/Java" ];
@@ -151,8 +161,18 @@ int main(int argc, char** argv) {
151161 }
152162
153163 jvmVersion = info[@" JVMVersion" ];
154- jvmOptionsFile = info[@" JVMOptionsFile" ];
155- bootstrapScript = info[@" BootstrapScript" ];
164+ if (javaInfo[@" JVMOptionsFile" ] != nil ) {
165+ NSString *jvmOptFileWithPlaceholders = javaInfo[@" JVMOptionsFile" ];
166+ jvmOptionsFile = resolvePlaceholders (jvmOptFileWithPlaceholders, javaFolder);
167+ } else {
168+ jvmOptionsFile = info[@" JVMOptionsFile" ];
169+ }
170+ if (javaInfo[@" BootstrapScript" ] != nil ) {
171+ NSString *bootstrapFileWithPlaceholders = javaInfo[@" BootstrapScript" ];
172+ bootstrapScript = resolvePlaceholders (bootstrapFileWithPlaceholders, javaFolder);
173+ } else {
174+ bootstrapScript = info[@" BootstrapScript" ];
175+ }
156176 }
157177 if ([jvmVersion containsString: @" ;" ]) {
158178 NSArray *stringParts = [jvmVersion componentsSeparatedByString: @" ;" ];
@@ -360,6 +380,10 @@ int main(int argc, char** argv) {
360380 NSString *optionsFile = [[NSString alloc ] initWithData: [fileManager contentsAtPath: jvmOptionsFile] encoding: NSUTF8StringEncoding];
361381 NSArray *lines = [optionsFile componentsSeparatedByString: @" \n " ];
362382 for (NSString *line in lines) {
383+ // Filter empty lines, otherwise application will fail to start for empty file
384+ if ([line length ] == 0 ) {
385+ continue ;
386+ }
363387 if ([line hasPrefix: @" #" ]) {
364388 continue ;
365389 }
@@ -521,4 +545,4 @@ BOOL versionMeetsMaxConstraint(NSString *version, NSString *constraint) {
521545 // no modifier means it must match exactly
522546 return !exceeds && [constraintParts count ] == [versionParts count ];
523547 }
524- }
548+ }
0 commit comments