langtools/test/tools/jdeps/Basic.java
changeset 27579 d1a63c99cdd5
parent 25442 755ff386d1ac
child 28706 a724585645ce
equal deleted inserted replaced
27578:d61af14a5cf7 27579:d1a63c99cdd5
    39 import java.util.*;
    39 import java.util.*;
    40 import java.util.regex.*;
    40 import java.util.regex.*;
    41 import static java.nio.file.StandardCopyOption.*;
    41 import static java.nio.file.StandardCopyOption.*;
    42 
    42 
    43 public class Basic {
    43 public class Basic {
    44     private static boolean symbolFileExist = initProfiles();
       
    45     private static boolean initProfiles() {
       
    46         // check if ct.sym exists; if not use the profiles.properties file
       
    47         Path home = Paths.get(System.getProperty("java.home"));
       
    48         if (home.endsWith("jre")) {
       
    49             home = home.getParent();
       
    50         }
       
    51         Path ctsym = home.resolve("lib").resolve("ct.sym");
       
    52         boolean symbolExists = ctsym.toFile().exists();
       
    53         if (!symbolExists) {
       
    54             Path testSrcProfiles =
       
    55                 Paths.get(System.getProperty("test.src", "."), "profiles.properties");
       
    56             if (!testSrcProfiles.toFile().exists())
       
    57                 throw new Error(testSrcProfiles + " does not exist");
       
    58             System.out.format("%s doesn't exist.%nUse %s to initialize profiles info%n",
       
    59                 ctsym, testSrcProfiles);
       
    60             System.setProperty("jdeps.profiles", testSrcProfiles.toString());
       
    61         }
       
    62         return symbolExists;
       
    63     }
       
    64 
       
    65     public static void main(String... args) throws Exception {
    44     public static void main(String... args) throws Exception {
    66         int errors = 0;
    45         int errors = 0;
    67         errors += new Basic().run();
    46         errors += new Basic().run();
    68         if (errors > 0)
    47         if (errors > 0)
    69             throw new Exception(errors + " errors found");
    48             throw new Exception(errors + " errors found");