test/sun/rmi/rmic/classpath/RMICClassPathTest.java

Print this page




  24 /*
  25  * Portions Copyright (c) 2012 IBM Corporation
  26  */
  27 
  28 /* @test
  29  * @bug 6610897 8030844
  30  * @summary New constructor in sun.tools.java.ClassPath builds a path using
  31  *          File.separator instead of File.pathSeparator. This test does
  32  *          not affect VM global state, so othervm is not required.
  33  * @run main RMICClassPathTest
  34  */
  35 
  36 import java.io.File;
  37 
  38 import sun.rmi.rmic.BatchEnvironment;
  39 
  40 public class RMICClassPathTest {
  41     private final static String SRC_PATH = System.getProperty("test.src", ".");
  42     public static void main(String[] args) throws Exception {
  43         String sysPath = SRC_PATH + "/jdk/jre/lib/rt.jar";
  44         String extDir = "";
  45         String clPath = SRC_PATH + "/user.jar" + File.pathSeparator +
  46             SRC_PATH + "/user2.jar" + File.pathSeparator +
  47             SRC_PATH + "/user3.jar";
  48 
  49         String cpStr = BatchEnvironment.createClassPath(clPath, sysPath, extDir).toString();
  50 
  51         String[] paths = cpStr.split(File.pathSeparator);
  52 
  53         if (paths.length != 4) {
  54             throw new Exception("ClassPath length is not correct: the expected length is 4 and the actual length is " + paths.length);
  55         }
  56     }
  57 }


  24 /*
  25  * Portions Copyright (c) 2012 IBM Corporation
  26  */
  27 
  28 /* @test
  29  * @bug 6610897 8030844
  30  * @summary New constructor in sun.tools.java.ClassPath builds a path using
  31  *          File.separator instead of File.pathSeparator. This test does
  32  *          not affect VM global state, so othervm is not required.
  33  * @run main RMICClassPathTest
  34  */
  35 
  36 import java.io.File;
  37 
  38 import sun.rmi.rmic.BatchEnvironment;
  39 
  40 public class RMICClassPathTest {
  41     private final static String SRC_PATH = System.getProperty("test.src", ".");
  42     public static void main(String[] args) throws Exception {
  43         String sysPath = SRC_PATH + "/jdk/jre/lib/rt.jar";

  44         String clPath = SRC_PATH + "/user.jar" + File.pathSeparator +
  45             SRC_PATH + "/user2.jar" + File.pathSeparator +
  46             SRC_PATH + "/user3.jar";
  47 
  48         String cpStr = BatchEnvironment.createClassPath(clPath, sysPath).toString();
  49 
  50         String[] paths = cpStr.split(File.pathSeparator);
  51 
  52         if (paths.length != 4) {
  53             throw new Exception("ClassPath length is not correct: the expected length is 4 and the actual length is " + paths.length);
  54         }
  55     }
  56 }