src/jdk.jpackage/share/classes/jdk/jpackage/internal/BundleParams.java
branchJDK-8200758-branch
changeset 57062 044e7a644ee3
parent 57039 98d3963b0b7b
child 57078 db003bfc5bf7
equal deleted inserted replaced
57061:ac44f38300b2 57062:044e7a644ee3
   299 
   299 
   300     public List<String> getArguments() {
   300     public List<String> getArguments() {
   301         return ARGUMENTS.fetchFrom(params);
   301         return ARGUMENTS.fetchFrom(params);
   302     }
   302     }
   303 
   303 
   304     // Validation approach:
       
   305     //  - javac and
       
   306     //
       
   307     //  - /jmods dir
       
   308     // or
       
   309     //  - JRE marker (rt.jar)
       
   310     //  - FX marker (jfxrt.jar)
       
   311     //  - JDK marker (tools.jar)
       
   312     private static boolean checkJDKRoot(File jdkRoot) {
       
   313         String exe = (Platform.getPlatform() == Platform.WINDOWS) ?
       
   314                 ".exe" : "";
       
   315         File javac = new File(jdkRoot, "bin/javac" + exe);
       
   316         if (!javac.exists()) {
       
   317             Log.verbose("javac is not found at " + javac.getAbsolutePath());
       
   318             return false;
       
   319         }
       
   320 
       
   321         File jmods = new File(jdkRoot, "jmods");
       
   322         if (!jmods.exists()) {
       
   323             Log.verbose("jmods is not found in " + jdkRoot.getAbsolutePath());
       
   324             return false;
       
   325         }
       
   326         return true;
       
   327     }
       
   328 
       
   329     public jdk.jpackage.internal.RelativeFileSet getAppResource() {
   304     public jdk.jpackage.internal.RelativeFileSet getAppResource() {
   330         return fetchParam(APP_RESOURCES);
   305         return fetchParam(APP_RESOURCES);
   331     }
   306     }
   332 
   307 
   333     public void setAppResource(jdk.jpackage.internal.RelativeFileSet fs) {
   308     public void setAppResource(jdk.jpackage.internal.RelativeFileSet fs) {
   376     public void setIdentifier(String s) {
   351     public void setIdentifier(String s) {
   377         putUnlessNull(PARAM_IDENTIFIER, s);
   352         putUnlessNull(PARAM_IDENTIFIER, s);
   378     }
   353     }
   379 
   354 
   380     private String mainJar = null;
   355     private String mainJar = null;
   381     private String mainJarClassPath = null;
       
   382     private boolean useFXPackaging = true;
       
   383 
       
   384     // For regular executable Jars we need to take care of classpath
       
   385     // For JavaFX executable jars we do not need to pay attention to
       
   386     // ClassPath entry in manifest
       
   387     public String getAppClassPath() {
       
   388         if (mainJar == null) {
       
   389             // this will find out answer
       
   390             getMainApplicationJar();
       
   391         }
       
   392         if (useFXPackaging || mainJarClassPath == null) {
       
   393             return "";
       
   394         }
       
   395         return mainJarClassPath;
       
   396     }
       
   397 
   356 
   398     // assuming that application was packaged according to the rules
   357     // assuming that application was packaged according to the rules
   399     // we must have application jar, i.e. jar where we embed launcher
   358     // we must have application jar, i.e. jar where we embed launcher
   400     // and have main application class listed as main class!
   359     // and have main application class listed as main class!
   401     // If there are more than one, or none - it will be treated as
   360     // If there are more than one, or none - it will be treated as
   440                     boolean javaMain = applicationClass.equals(
   399                     boolean javaMain = applicationClass.equals(
   441                                attrs.getValue(Attributes.Name.MAIN_CLASS));
   400                                attrs.getValue(Attributes.Name.MAIN_CLASS));
   442 
   401 
   443                     if (javaMain) {
   402                     if (javaMain) {
   444                         mainJar = fname;
   403                         mainJar = fname;
   445                         mainJarClassPath = attrs.getValue(
       
   446                                Attributes.Name.CLASS_PATH);
       
   447                         return mainJar;
   404                         return mainJar;
   448                     }
   405                     }
   449                 }
   406                 }
   450             } catch (IOException ignore) {
   407             } catch (IOException ignore) {
   451             }
   408             }