Skip to Main Content

Java and JavaScript in the Database

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

error: "cannot find symbol" when using String.getBytes (java.nio.charset.Charset)

user1486505May 19 2015 — edited May 21 2015

I have a very simple java class that uses String.getBytes (java.nio.charset.Charset). When I use loadjava, i get the error: "cannot find symbol" for this call. Any ideas on what could be the problem?

Here is the full source:

package mytest;

import java.lang.String;
import java.nio.charset.*;

public class MyTest {
static final Charset utf8charset = Charset.forName("UTF-8");

    public int printString(String s)
{
        byte[] utf8 = s.getBytes(utf8charset);
System.out.println (utf8);
     }

    public void printString ()
{
printString ("hello");
}

};

Thanks in advance,

Keith

This post has been answered by PeterValencic on May 21 2015
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 18 2015
Added on May 19 2015
4 comments
4,254 views