diff --git a/jdk/src/share/classes/sun/launcher/LauncherHelper.java b/jdk/src/share/classes/sun/launcher/LauncherHelper.java index 5a6f40442ed..dc6a10bfac2 100644 --- a/jdk/src/share/classes/sun/launcher/LauncherHelper.java +++ b/jdk/src/share/classes/sun/launcher/LauncherHelper.java @@ -51,6 +51,7 @@ import java.nio.charset.Charset; import java.nio.file.DirectoryStream; import java.nio.file.Files; import java.nio.file.Path; +import java.text.Normalizer; import java.util.ResourceBundle; import java.text.MessageFormat; import java.util.ArrayList; @@ -493,7 +494,19 @@ public enum LauncherHelper { try { mainClass = scloader.loadClass(cn); } catch (NoClassDefFoundError | ClassNotFoundException cnfe) { - abort(cnfe, "java.launcher.cls.error1", cn); + if (System.getProperty("os.name", "").contains("OS X") + && Normalizer.isNormalized(cn, Normalizer.Form.NFD)) { + try { + // On Mac OS X since all names with diacretic symbols are given as decomposed it + // is possible that main class name comes incorrectly from the command line + // and we have to re-compose it + mainClass = scloader.loadClass(Normalizer.normalize(cn, Normalizer.Form.NFC)); + } catch (NoClassDefFoundError | ClassNotFoundException cnfe1) { + abort(cnfe, "java.launcher.cls.error1", cn); + } + } else { + abort(cnfe, "java.launcher.cls.error1", cn); + } } // set to mainClass appClass = mainClass; diff --git a/jdk/test/tools/launcher/8017248/ClassÁ.java b/jdk/test/tools/launcher/8017248/ClassÁ.java new file mode 100644 index 00000000000..2e264990c74 --- /dev/null +++ b/jdk/test/tools/launcher/8017248/ClassÁ.java @@ -0,0 +1,5 @@ +public class ClassÁ { + public static void main(String args[]) { + System.out.println("Succes!"); + } +} diff --git a/jdk/test/tools/launcher/8017248/test.sh b/jdk/test/tools/launcher/8017248/test.sh new file mode 100644 index 00000000000..7a96f46c223 --- /dev/null +++ b/jdk/test/tools/launcher/8017248/test.sh @@ -0,0 +1,16 @@ +#!/bin/sh +# @test test.sh +# @bug 8017248 +# @summary Compiler Diacritics Issue +# @run shell test.sh + +OSNAME=`uname -s` +if [ "$OSNAME" == "Darwin" ] +then + rm *.class + ${TESTJAVA}/bin/javac *.java + ${TESTJAVA}/bin/java `echo *.class | cut -d. -f1` +else + echo Test is specific to Mac OS X, skipping. + exit 0 +fi