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.


>> REGISTER NOW TO START POSTING


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

Results 1 to 2 of 2

Thread: .class compiling error

  1. #1
    Junior Member
    Join Date
    Aug 2012
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default .class compiling error

    Hello, everyone.
    I just registered today;
    For the past couple of days I've been trying to modify a .class file which is part of a mod for a game I've been playing.

    It doesn't seem to find any errors in the modifications I've made, but it seems to have issues with lines from the original class file.
    (I've tried compiling both my modified version and the original)
    I'm brand new to java so I'm not sure exactly how to fix the errors.

    Here's the code, highlighted in blue are the modifications I made.

    public final class EnumFaces extends Enum
    {

    public static final EnumFaces Normal;
    public static final EnumFaces Angry;
    public static final EnumFaces Sad;
    public static final EnumFaces Happy;
    public static final EnumFaces Tired;
    public static final EnumFaces Shy;
    public static final EnumFaces Custom1;
    private static final EnumFaces $VALUES[];

    public static EnumFaces[] values()
    {
    return (EnumFaces[])$VALUES.clone();
    }

    public static EnumFaces valueOf(String name)
    {
    return (EnumFaces)Enum.valueOf(EnumFaces, name);
    }

    private EnumFaces(String s, int i)
    {
    super(s, i);
    }

    static
    {
    Normal = new EnumFaces("Normal", 0);
    Angry = new EnumFaces("Angry", 1);
    Sad = new EnumFaces("Sad", 2);
    Happy = new EnumFaces("Happy", 3);
    Tired = new EnumFaces("Tired", 4);
    Shy = new EnumFaces("Shy", 5);
    Custom1 = new EnumFaces("Custom1", 6);
    $VALUES = (new EnumFaces[] {
    Normal, Angry, Sad, Happy, Tired, Shy, Custom 1
    });
    }
    }


    Here are the errors that javac found:

    EnumFaces.java:2: error: classes cannot directly extend java.lang.Enum
    public final class EnumFaces extends Enum

    EnumFaces.java:20: error: cannot find symbol
    return (EnumFaces)Enum.valueOf(EnumFaces, name);

    symbol: variable EnumFaces
    location: class EnumFaces
    EnumFaces.java:25: error: contructor Enum in class Enum(E) cannot be applied to given types:
    super(s, i);

    required: String, int
    found: String, int, String, int
    reason: actual and formal argument lists differ in length
    where E is a type-variable:
    E extends Enum(E) declared in class Enum
    3 errors


    Thanks in advance
    Last edited by nijininjin; August 26th, 2012 at 01:57 PM.


  2. #2
    Member
    Join Date
    Jul 2012
    Posts
    90
    Thanks
    1
    Thanked 2 Times in 2 Posts

    Default Re: .class compiling error

    You have to wrap your code into this
    [key]<YOUR CODE GOES HERE?[/key]. Replace key with word code in order this to work.
    About the third error, the constructor requires the 1st argument to be a String and the 2nd argument to be an int,but you pass a string,an int,a string and an int

    about the enum class read this http://stackoverflow.com/questions/1...va-extend-enum
    Last edited by Samaras; August 26th, 2012 at 03:18 PM.

Similar Threads

  1. Compiling error
    By Bri4n in forum Java Theory & Questions
    Replies: 5
    Last Post: November 7th, 2011, 09:26 PM
  2. Compiling error
    By tangara in forum Java IDEs
    Replies: 3
    Last Post: September 4th, 2011, 03:00 AM
  3. Compiling Error?
    By Arkeshen in forum Java Theory & Questions
    Replies: 2
    Last Post: June 22nd, 2011, 04:31 AM
  4. Need help compiling java class files
    By peahead in forum What's Wrong With My Code?
    Replies: 5
    Last Post: February 11th, 2010, 08:04 AM
  5. Strange Compiling Error
    By crism85 in forum What's Wrong With My Code?
    Replies: 5
    Last Post: October 13th, 2009, 12:59 AM