@@ -265,16 +265,19 @@ protected void bundleJre(File destinationFolder, File jarFile, File libsFolder,
265265
266266 File currentJdk = new File (System .getProperty ("java.home" ));
267267
268- Logger .infoIndent ("Bundling JRE ... with " + currentJdk . getAbsolutePath () );
268+ Logger .infoIndent ("Bundling JRE ... with " + currentJdk );
269269
270270 if (specificJreFolder != null ) {
271271
272272 Logger .info ("Embedding JRE from " + specificJreFolder );
273273
274- if (!specificJreFolder .exists ()) {
275- throw new Exception ("JRE path specified does not exist: " + specificJreFolder .getAbsolutePath ());
276- } else if (!specificJreFolder .isDirectory ()) {
277- throw new Exception ("JRE path specified is not a folder: " + specificJreFolder .getAbsolutePath ());
274+ if (platform .equals (Platform .mac )) {
275+ specificJreFolder = new File (specificJreFolder , "Contents/Home" );
276+ }
277+
278+ // checks if valid jre specified
279+ if (!JDKUtils .isValidJRE (platform , specificJreFolder )) {
280+ throw new Exception ("Invalid JRE specified for '" + platform + "' platform: " + jrePath );
278281 }
279282
280283 // removes old jre folder from bundle
@@ -285,9 +288,6 @@ protected void bundleJre(File destinationFolder, File jarFile, File libsFolder,
285288
286289 // sets execution permissions on executables in jre
287290 File binFolder = new File (destinationFolder , "bin" );
288- if (!binFolder .exists ()) {
289- throw new Exception ("Could not embed JRE from " + specificJreFolder .getAbsolutePath () + ": " + binFolder .getAbsolutePath () + " doesn't exist" );
290- }
291291 Arrays .asList (binFolder .listFiles ()).forEach (f -> f .setExecutable (true , false ));
292292
293293 } else if (JavaUtils .getJavaMajorVersion () <= 8 ) {
@@ -302,12 +302,13 @@ protected void bundleJre(File destinationFolder, File jarFile, File libsFolder,
302302
303303 } else {
304304
305+ Logger .info ("Creating customized JRE ..." );
306+
305307 // tests if specified JDK is for the same platform than target platform
306- if (!JDKUtils .isValidJdk (platform , jdkPath )) {
307- throw new Exception ("Invalid JDK: '" + jdkPath + "' for platform : " + platform );
308+ if (!JDKUtils .isValidJDK (platform , jdkPath )) {
309+ throw new Exception ("Invalid JDK for platform '" + platform + "': " + jdkPath );
308310 }
309311
310-
311312 String modules = getRequiredModules (libsFolder , customizedJre , jarFile , defaultModules , additionalModules );
312313
313314 Logger .info ("Creating JRE with next modules included: " + modules );
0 commit comments