Welcome to the Java Programming Forums

The professional, friendly Java community. 21,500 members and growing!

The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: IPv6 validation is failing with java.net.InetAddress

  1. #1
    Junior Member
    Join Date
    Jun 2014
    Thanked 0 Times in 0 Posts

    Exclamation IPv6 validation is failing with java.net.InetAddress

    Facing problem with java.net.InetAddress class while validating special form of IPv6 address.

    please check the following piece of code.

    String ipv6 = "0:0:0:0:0:ffff:a1f:e403";
    final Inet6Address i6 = (Inet6Address) InetAddress.getByName(ipv6);
    catch(ClassCastException e){
    System.out.println("Not a proper ip: "+e);

    It is throwing ClassCastException.

  2. #2
    Super Moderator
    Join Date
    Jun 2013
    So. Maryland, USA
    My Mood
    Thanked 688 Times in 675 Posts

    Default Re: IPv6 validation is failing with java.net.InetAddress

    Welcome to the forum! Please read this topic to learn how to post code in code or highlight tags and other useful info for new members.

    Please post your code correctly per the above link.

Similar Threads

  1. Intro. to Java Help.... In Danger of Failing Class
    By john++ in forum What's Wrong With My Code?
    Replies: 1
    Last Post: April 2nd, 2014, 02:32 AM
  2. My Java program is failing to run in command prompt
    By George Mawire in forum What's Wrong With My Code?
    Replies: 26
    Last Post: January 24th, 2014, 06:54 AM
  3. NetworkInterface vs InetAddress
    By keepStriving in forum Java Networking
    Replies: 0
    Last Post: June 5th, 2013, 12:03 PM
  4. InetAddress
    By lanpan in forum Member Introductions
    Replies: 2
    Last Post: December 13th, 2011, 03:12 AM
  5. IPv6 validation
    By subhvi in forum Java Networking
    Replies: 1
    Last Post: November 27th, 2009, 06:19 AM