< prev index next >

test/hotspot/jtreg/runtime/LoadClass/LongBCP.java

Print this page




  22  */
  23 
  24 /*
  25  * @test
  26  * @summary JVM should be able to handle full path (directory path plus
  27  *          class name) or directory path longer than MAX_PATH specified
  28  *          in -Xbootclasspath/a on windows.
  29  * @library /test/lib
  30  * @modules java.base/jdk.internal.misc
  31  *          java.management
  32  *          jdk.jartool/sun.tools.jar
  33  * @run main LongBCP
  34  */
  35 
  36 import java.io.File;
  37 import java.nio.file.Files;
  38 import java.nio.file.FileStore;
  39 import java.nio.file.Path;
  40 import java.nio.file.Paths;
  41 import java.util.Arrays;
  42 import jdk.test.lib.Platform;
  43 import jdk.test.lib.compiler.CompilerUtils;
  44 import jdk.test.lib.process.ProcessTools;
  45 import jdk.test.lib.process.OutputAnalyzer;
  46 
  47 public class LongBCP {
  48 
  49     private static final int MAX_PATH = 260;
  50 
  51     public static void main(String args[]) throws Exception {
  52         Path sourceDir = Paths.get(System.getProperty("test.src"), "test-classes");
  53         Path classDir = Paths.get(System.getProperty("test.classes"));
  54         Path destDir = classDir;
  55 
  56         // create a sub-path so that the destDir length is almost MAX_PATH
  57         // so that the full path (with the class name) will exceed MAX_PATH
  58         int subDirLen = MAX_PATH - classDir.toString().length() - 2;
  59         if (subDirLen > 0) {
  60             char[] chars = new char[subDirLen];
  61             Arrays.fill(chars, 'x');
  62             String subPath = new String(chars);




  22  */
  23 
  24 /*
  25  * @test
  26  * @summary JVM should be able to handle full path (directory path plus
  27  *          class name) or directory path longer than MAX_PATH specified
  28  *          in -Xbootclasspath/a on windows.
  29  * @library /test/lib
  30  * @modules java.base/jdk.internal.misc
  31  *          java.management
  32  *          jdk.jartool/sun.tools.jar
  33  * @run main LongBCP
  34  */
  35 
  36 import java.io.File;
  37 import java.nio.file.Files;
  38 import java.nio.file.FileStore;
  39 import java.nio.file.Path;
  40 import java.nio.file.Paths;
  41 import java.util.Arrays;

  42 import jdk.test.lib.compiler.CompilerUtils;
  43 import jdk.test.lib.process.ProcessTools;
  44 import jdk.test.lib.process.OutputAnalyzer;
  45 
  46 public class LongBCP {
  47 
  48     private static final int MAX_PATH = 260;
  49 
  50     public static void main(String args[]) throws Exception {
  51         Path sourceDir = Paths.get(System.getProperty("test.src"), "test-classes");
  52         Path classDir = Paths.get(System.getProperty("test.classes"));
  53         Path destDir = classDir;
  54 
  55         // create a sub-path so that the destDir length is almost MAX_PATH
  56         // so that the full path (with the class name) will exceed MAX_PATH
  57         int subDirLen = MAX_PATH - classDir.toString().length() - 2;
  58         if (subDirLen > 0) {
  59             char[] chars = new char[subDirLen];
  60             Arrays.fill(chars, 'x');
  61             String subPath = new String(chars);


< prev index next >