< prev index next >

test/jdk/tools/jpackage/apps/image/Hello.java

Print this page




  51         var lines = printArgs(args);
  52 
  53         Stream.of(args).forEach(arg -> System.out.println(
  54                 arg.codePoints()
  55                         .mapToObj(codePoint -> String.format("0x%04x", codePoint))
  56                         .collect(Collectors.joining(",", "[", "]"))));
  57 
  58         lines.forEach(System.out::println);
  59 
  60         var outputFile = getOutputFile(args);
  61         trace(String.format("Output file: [%s]", outputFile));
  62         Files.write(outputFile, lines);
  63     }
  64 
  65     private static List<String> printArgs(String[] args) {
  66         List<String> lines = new ArrayList<>();
  67         lines.add(MSG);
  68 
  69         lines.add("args.length: " + args.length);
  70 
  71         lines.addAll(List.of(args));






  72 
  73         for (int index = 1; index <= EXPECTED_NUM_OF_PARAMS; index++) {
  74             String value = System.getProperty("param" + index);
  75             if (value != null) {
  76                 lines.add("-Dparam" + index + "=" + value);
  77             }
  78         }
  79 
  80         return lines;
  81     }
  82 
  83     private static Path getOutputFile(String[] args) {
  84         Path outputFilePath = Path.of("appOutput.txt");
  85 
  86         // If first arg is a file (most likely from fa), then put output in the same folder as
  87         // the file from fa.
  88         if (args.length >= 1) {
  89             Path faPath = Path.of(args[0]);
  90             if (Files.exists(faPath)) {
  91                 return faPath.toAbsolutePath().getParent().resolve(outputFilePath);




  51         var lines = printArgs(args);
  52 
  53         Stream.of(args).forEach(arg -> System.out.println(
  54                 arg.codePoints()
  55                         .mapToObj(codePoint -> String.format("0x%04x", codePoint))
  56                         .collect(Collectors.joining(",", "[", "]"))));
  57 
  58         lines.forEach(System.out::println);
  59 
  60         var outputFile = getOutputFile(args);
  61         trace(String.format("Output file: [%s]", outputFile));
  62         Files.write(outputFile, lines);
  63     }
  64 
  65     private static List<String> printArgs(String[] args) {
  66         List<String> lines = new ArrayList<>();
  67         lines.add(MSG);
  68 
  69         lines.add("args.length: " + args.length);
  70 
  71         for (String arg : args) {
  72             if (arg.startsWith("jpackage.app")) {
  73                 lines.add(arg + "=" + System.getProperty(arg));
  74             } else {
  75                 lines.add(arg);
  76             }
  77         }
  78 
  79         for (int index = 1; index <= EXPECTED_NUM_OF_PARAMS; index++) {
  80             String value = System.getProperty("param" + index);
  81             if (value != null) {
  82                 lines.add("-Dparam" + index + "=" + value);
  83             }
  84         }
  85 
  86         return lines;
  87     }
  88 
  89     private static Path getOutputFile(String[] args) {
  90         Path outputFilePath = Path.of("appOutput.txt");
  91 
  92         // If first arg is a file (most likely from fa), then put output in the same folder as
  93         // the file from fa.
  94         if (args.length >= 1) {
  95             Path faPath = Path.of(args[0]);
  96             if (Files.exists(faPath)) {
  97                 return faPath.toAbsolutePath().getParent().resolve(outputFilePath);


< prev index next >