publicstaticvoid main(String... args) throws Exception { boolean localeAvailable = false; for (Locale l : Locale.getAvailableLocales()) { if (l.toLanguageTag().equals(Locale.JAPAN.toLanguageTag())) {
localeAvailable = true; break;
}
} if (!localeAvailable) {
System.out.println("Warning: locale: " + Locale.JAPAN
+ " not found, test passes vacuously"); return;
} if ("C".equals(LC_ALL) || "C".equals(LANG)) {
System.out.println("Warning: The LANG and/or LC_ALL env vars are " + "set to \"C\":\n" + " LANG=" + LANG + "\n" + " LC_ALL=" + LC_ALL + "\n" + "This test requires support for multi-byte filenames.\n" + "Test passes vacuously."); return;
} if (encoding.equals("MS932") || encoding.equals("UTF-8")) {
Locale.setDefault(Locale.JAPAN);
System.out.println("using locale " + Locale.JAPAN + ", encoding " + encoding);
} else {
System.out.println("Warning: current encoding is " + encoding + "this test requires MS932 <Ja> or UTF-8," + " test passes vacuously"); return;
}
dir.mkdir();
File dirfile = new File(dir, "foo.jar");
createJar(dirfile, "public static void main(String... args) {", "System.out.println(\"Hello World\");", "System.exit(0);", "}");
// remove the class files, to ensure that the class is indeed picked up // from the jar file and not from ambient classpath.
File[] classFiles = cwd.listFiles(createFilter(CLASS_FILE_EXT)); for (File f : classFiles) {
f.delete();
}
// test with a jar file
TestResult tr = doExec(javaCmd, "-jar", dirfile.getAbsolutePath());
System.out.println(tr); if (!tr.isOK()) { thrownew RuntimeException("TEST FAILED");
}
// test the same class but by specifying it as a classpath
tr = doExec(javaCmd, "-cp", dirfile.getAbsolutePath(), "Foo");
System.out.println(tr); if (!tr.isOK()) { thrownew RuntimeException("TEST FAILED");
}
}
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.