Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8151575
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T15:25:55+00:00 2026-06-06T15:25:55+00:00

import java.nio.charset.Charsets in my class UriCodec.java,but when i use javac(jdk6) compile this class error.

  • 0

import java.nio.charset.Charsets in my class UriCodec.java,but when i use javac(jdk6) compile this class error. for example:
javac UriCodec.java

error code:

import java.nio.charset.Charsets;
                       ^
UriCodec.java:140: Can not find symbol
symbol: Variable Charsets
position: class com.android.exchange.utility.UriCodec
        appendEncoded(builder, s, Charsets.UTF_8, false);
                                  ^
UriCodec.java:144: Can not find symbol
symbol: Variable Charsets
position: class com.android.exchange.utility.UriCodec
        appendEncoded(builder, s, Charsets.UTF_8, true);
                                  ^
UriCodec.java:203: Can not find symbol
symbol: Variable Charsets
position: class com.android.exchange.utility.UriCodec
        return decode(s, false, Charsets.UTF_8);
                                ^
UriCodec.java:214: Can not find symbol
symbol: Method toHexString(byte,boolean)
position: class java.lang.Byte
        sb.append(Byte.toHexString(b, true));
                      ^
5 error

my class:

import java.nio.charset.Charset;
import java.nio.charset.Charsets;
public abstract class UriCodec {


    public final void appendEncoded(StringBuilder builder, String s) {
        appendEncoded(builder, s, Charsets.UTF_8, false);
    }

    public final void appendPartiallyEncoded(StringBuilder builder, String s) {
        appendEncoded(builder, s, Charsets.UTF_8, true);
    }

    public static String decode(String s) {
        return decode(s, false, Charsets.UTF_8);
    }


   public final String encode(String s, Charset charset) {
        // Guess a bit larger for encoded form
        StringBuilder builder = new StringBuilder(s.length() + 16);
        appendEncoded(builder, s, charset, false);
        return builder.toString();
    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T15:25:56+00:00Added an answer on June 6, 2026 at 3:25 pm

    There’s no such class as Charsets. There’s Charset (singular) but that’s not the same thing…

    I suspect you got a message like this:

    UriCodec.java:1: error: cannot find symbol
    import java.nio.charset.Charsets;
                           ^
      symbol:   class Charsets
      location: package java.nio.charset
    1 error
    

    When you get a compiler error, read it. If the compiler says it can’t find a symbol, then there’s usually a very good reason for it – so double-check that you’ve spelled everything correctly, with the correct casing.

    Change your import to

    import java.nio.charset.Charset;
    

    and all should be well.

    … or if you meant a different Charsets class (such as the one in Guava) you should add an import for that class instead.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Try to compile the following code in JDK7: import java.nio.file.*; public final class _DiamondSyntaxErrors
Why this line doesn't work? import static java.nio.file.AccessMode.*; Eclipse says: The import java.nio.file cannot
I'm really wondering what this code does: scala> import java.nio.file._ import java.nio.file._ scala> Files.copy(Paths.get(),
import java.io.*; import java.nio.ByteBuffer; import java.nio.channels.FileChannel; public class ExplicitChannelRead { /** * @param args
import java.util.Collection; import example.Event; public interface Query { public boolean hasMore (); public Collection<Event>
import java.lang.Math; public class NewtonIteration { public static void main(String[] args) { System.out.print(rootNofX(2,9)); }
import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; public class DateDemo { public static void main(String[]
import java.io.*; import java.util.Scanner; import java.util.StringTokenizer; public class Filereader { public static void main(String[]
import java.lang.reflect.Array; public class PrimitiveArrayGeneric { static <T> T[] genericArrayNewInstance(Class<T> componentType) { return (T[])
import java.awt.Graphics; import javax.swing.*; public class Demo { JFrame jf; JLabel[] labels; JPanel panel;

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.