-2

I'm having troubles running the helloworldapp java program everytime i use the cmd.Here is the original execution of the program.


C:\Users\char>cd\

C:\>cd program files

C:\Program Files>cd java

C:\Program Files\Java>cd helloworldapp

C:\Program Files\Java\HelloWorldApp>path=c:\\program files\java\jdk1.7.0_11\bin

C:\Program Files\Java\HelloWorldApp>javac helloworldapp
error: Class names, 'helloworldapp', are only accepted if annotation processing
is explicitly requested
1 error

C:\Program Files\Java\HelloWorldApp> >> 

And everytime I try to correct the class name it is saying the same thing. Can you help me with this problem?

Iswanto San
  • 18,263
  • 13
  • 58
  • 79

3 Answers3

0

Compile it like this:

C:\Program Files\Java\HelloWorldApp>javac helloworldapp.java

Source : http://docs.oracle.com/javase/tutorial/getStarted/problems/index.html

If you receive this error, you forgot to include the .java suffix when compiling the program. Remember, the command is javac HelloWorldApp.java not javac HelloWorldApp.

Jaanus
  • 16,161
  • 49
  • 147
  • 202
0

Use:

C:\Program Files\Java\HelloWorldApp>javac helloworldapp.java

Instead:

C:\Program Files\Java\HelloWorldApp>javac helloworldapp

Reference : Lesson: Common Problems (and Their Solutions)

Iswanto San
  • 18,263
  • 13
  • 58
  • 79
0

The error is due to the fact the you haven't specified the .java file-extension.

Correct usage:

C:\Program Files\Java\HelloWorldApp>javac helloworldapp.java

The .class file will now be generated. To run it, use (without the extension this time):

C:\Program Files\Java\HelloWorldApp>java helloworldapp

Using the .class extension here will again cause you problems.

The following usage is incorrect:

C:\Program Files\Java\HelloWorldApp>java helloworldapp.class
Roney Michael
  • 3,964
  • 5
  • 30
  • 45