diff --git a/libjava/ChangeLog b/libjava/ChangeLog index c2baccfe8f6..82a9f182ea5 100644 --- a/libjava/ChangeLog +++ b/libjava/ChangeLog @@ -1,3 +1,11 @@ +2006-05-31 Bryce McKinlay + + * prims.cc (_Jv_RunMain): Use JvNewStringUTF for command-line class + name, not Latin1. + * gnu/java/lang/MainThread.java (run): Allow file separator char to + be used in place of '.' as class-name separator. Don't chain + ClassNotFoundException. + 2006-05-31 Thomas Fitzsimmons * java/lang/VMClassLoader.java (initialize): Set default library diff --git a/libjava/gnu/java/lang/MainThread.java b/libjava/gnu/java/lang/MainThread.java index c35359f0e5a..470de0c3a68 100644 --- a/libjava/gnu/java/lang/MainThread.java +++ b/libjava/gnu/java/lang/MainThread.java @@ -39,6 +39,7 @@ exception statement from your version. */ package gnu.java.lang; +import java.io.File; import java.util.jar.Attributes; import java.util.jar.JarFile; @@ -91,13 +92,14 @@ final class MainThread extends Thread { try { - klass = Class.forName(klass_name, true, - ClassLoader.getSystemClassLoader()); + ClassLoader cl = ClassLoader.getSystemClassLoader(); + // Permit main class name to be specified in file-system format. + klass_name = klass_name.replace(File.separatorChar, '.'); + klass = cl.loadClass(klass_name); } catch (ClassNotFoundException x) { NoClassDefFoundError ncdfe = new NoClassDefFoundError(klass_name); - ncdfe.initCause(x); throw ncdfe; } } diff --git a/libjava/prims.cc b/libjava/prims.cc index 1c3490e7511..a066866c534 100644 --- a/libjava/prims.cc +++ b/libjava/prims.cc @@ -1524,7 +1524,7 @@ _Jv_RunMain (JvVMInitArgs *vm_args, jclass klass, const char *name, int argc, if (klass) main_thread = new MainThread (klass, arg_vec); else - main_thread = new MainThread (JvNewStringLatin1 (name), + main_thread = new MainThread (JvNewStringUTF (name), arg_vec, is_jar); } catch (java::lang::Throwable *t)