String(strBytes, "UTF-16LE"); thorws java.io.UnsupportedEncodingException

Andreas Grunewald gruni.ca@gmail.com
Sun Apr 17 12:42:00 GMT 2005


Ok once again a new something that I detected.
After SPLing 10 classes I was able to track down just a nother Error I
got. this time it's in String(strBytes, "UTF-16LE"); take this little
code snippet

import java.io.UnsupportedEncodingException;
import java.nio.charset.Charset;

public class GcjStringTest {
  public static void main(String args[]) throws UnsupportedEncodingException{
    System.out.println("Available Charsets are:\n"
        +Charset.availableCharsets().toString());
    byte[] strBytes = {0x12,0x0A,0x14,0xF};
    //Creating String with UTF which is available according to Charsets
    String mine = new String(strBytes, "UTF-16LE");
    //shouldn't recieve Exception
    System.out.println("["+mine+"]");
  }
}

in my understanding if Charset.available has UTF-16LE in it the String
constructor should work, but instead I get the following
output/Exception

Available Charsets are:
{ISO-8859-1=ISO-8859-1, US-ASCII=US-ASCII, UTF-16=UTF-16,
UTF-16BE=UTF-16BE, UTF-16LE=UTF-16LE, UTF-8=UTF-8}
Exception in thread "main" java.io.UnsupportedEncodingException:
UTF-16LE (java.lang.ClassNotFoundException: gnu.gcj.con
vert.Input_UnicodeLittle not found in
gnu.gcj.runtime.SystemClassLoader{urls=[file:.\],
parent=gnu.gcj.runtime.VMClassLo
ader{urls=[core:/], parent=null}})
   at GcjStringTest.main(java.lang.String[])
(E:\2004-development\2005-extraextra\src\GcjStringTest.java)
   at ._main (C:\DOKUME~1\GRUNEW~1\LOKALE~1\Temp\ccM5baaa.i)

Do I have to add yet another argument at compiletime to aviod this
error? Yet again this is with teh thisiscool.com GCJ 4.0 prerelease
but it also happens with GCJ3.4 from thisiscool.

Regards

  Andreas


PS Bug 21068



More information about the Java mailing list