Wednesday, May 13, 2009

Class names 'MyApp', are only accepted if annotation processing is explicitly requested

Class names 'MyApp', are only accepted if annotation processing is explicitly requested

Dear oh dear...

I/You forgot to put '.java' on the end of the filename. Thinking you're above all that '.java. stuff huh?

21 comments:

  1. Ehehe :) thank you!
    ~Miku

    ReplyDelete
  2. Anonymous2:22 AM

    Thank you friend....

    ReplyDelete
  3. Anonymous4:10 PM

    wonderful!

    ReplyDelete
  4. Anonymous9:56 PM

    THAT IS NOT A REASON ,I SEE THIS ON RUNNING TIME NOT ON IN COMPILING.

    ReplyDelete
  5. At runtime? I am not too sure about that, but if the problem is happening for the same reason as the '.java' extension, then have you configured some sort of dynamic compiling mechanism? Or is it because you're using some framework that is missing some configuration somewhere? Another back-to-basics thought train could be to check your path too, to make sure you're not pointing to different instances of the same filename.

    Just some thoughts; but I am not really sure of your situation. Hope you manage to resolve it somehow!

    ReplyDelete
  6. Anonymous6:42 AM

    if some1 is able to solve this prob then pls post the procedure.

    ReplyDelete
  7. Anonymous3:19 AM

    thank you

    ReplyDelete
  8. Anonymous4:02 PM

    i cant compile... i put .java on the end but still got the same error

    ReplyDelete
  9. Anonymous8:38 PM

    did you check your classpath?

    ReplyDelete
  10. Anonymous9:56 PM

    im running a simple program and im getting the same error? ive checked the class path... the names right everything that needs (), ;, and {} has them... it all appears to be correct... yet i still get the same error... and yes its named.java...

    ReplyDelete
  11. This is interesting that so many people are facing this problem. Could someone provide the source code for what they are trying to compile?

    ReplyDelete
  12. thnks a lot--------------------------------@biswa

    ReplyDelete
  13. i am facing this problem too, i can compile and run my app in netbeans IDE, but i cannot in command prompt. Can the problem be about JAR file? Please help me!

    ReplyDelete
  14. realy nice ...!!thanks lot of

    ReplyDelete
  15. class Nk{
    int x;
    int y;
    int z;
    int add(int a,int b)
    {
    x=a;
    y=b;
    int w=x+y;
    return w;
    }
    int mal(int a,int b,int c)
    {
    x=a;
    y=b;
    z=c;
    int f=x*y*z;
    return f;
    }
    }
    class Fk{
    public static void main(String arg[])
    {
    Nk m=new Nk();
    int n= m.add(7,8);
    System .out.println(n);
    int u=m.mal(7,8,9);
    System .out.println(u);
    }
    }

    ReplyDelete
  16. This comment has been removed by the author.

    ReplyDelete
  17. this code compile successfully but as i make run, i encounter with the error CLASS"Fk" ACCEPTED IF ANNOTATION PROCESSING explicitly requested.what type of error is this when it occur and how can i remove,i have put file extension (Fk.java), one interesting thing is that when i use CLASS NAME FORCE IN PLACE OF Fk it run successfully, whAT TYPE OF ERROR IS THIS, KINDLY HELP ME.THANK U
    class Nk{
    int x;
    int y;
    int z;
    int add(int a,int b)
    {
    x=a;
    y=b;
    int w=x+y;
    return w;
    }
    int mal(int a,int b,int c)
    {
    x=a;
    y=b;
    z=c;
    int f=x*y*z;
    return f;
    }
    }
    class Fk{
    public static void main(String arg[])
    {
    Nk m=new Nk();
    int n= m.add(7,8);
    System .out.println(n);
    int u=m.mal(7,8,9);
    System .out.println(u);
    }
    }

    ReplyDelete
  18. This comment has been removed by the author.

    ReplyDelete
    Replies
    1. I don't do much Java programming anymore, but shouldn't you save your file as 'Nk.java' not 'Fk.java' ?

      Also are you missing closing brackets on your second class?

      From what I remember about Java, having two class declarations in the same file is really not a good thing either.

      Hope that helps in some way?

      Delete
  19. @mark ashworth again facing same problem in this programm at the run time plz give any permanet solution dear
    public class Value{

    static int x = 3;
    public static void main(String args[]) {

    // int x = 3;

    passMethod(x);

    System.out.println("After invoking passMethod, x = " + x);
    }

    public static void passMethod(int p) {
    System.out.println("After invoking passMethod p ; " + p);
    p = 10;
    System.out.println("After invoking passMethod, p= " + p);
    System.out.println("After invoking passMethod, x = " + x);

    }
    }

    ReplyDelete
    Replies
    1. Hmm. You do realise that it is not my job to do your programming homework for you right?

      Delete