Showing posts with label error. Show all posts
Showing posts with label error. Show all posts

Sunday, October 6

'javac' is not recognized as an internal or external command, operable program or batch file.

'javac' is not recognized as an internal or external command, operable program or batch file.

This error might occur as JDK is not set in path System variable in environment variable


-->


To set this find out where Java is installed on your system

Let's say you have Java 7 installed on your system , copy bin directory path as below :

\jdk1.7.0\bin

Now access the path variable in environment variable from :

Control Panel\System and Security\System



Set Java_Home as
\jdk1.7.0\bin

then set  path variable value as : %Java_Home%;(current value in path)

OR

set path directly as
\jdk1.7.0\bin;(current value in path)


If Still it does not work and throw same error , Access command line 

and check the path with path command 

Now see if \jdk1.7.0\bin is there in the output ..

If it is not there then set path from command line using command 

set path =%path%;\jdk1.7.0\bin

Now check again the value of path variable , \jdk1.7.0\bin should be there 

Try executing program again , it should work now.. 












Monday, September 30

error:Class names are only accepted if annotation processing is explicitly requested






-->

This error generally occurs when one try to compile a java file without appending .java extension in file name ..

For example

I have below class at location C:\Users\mkum\Desktop\java


public class Test{

               
                public String result() {

                                return "abc";

                }

}

On compiling this as below :

C:\Users\mkum\Desktop\java>javac Test

error: Class names, 'Test', are only accepted if annotation processing is explicitly requested
1 error








So correct way to compile class from command line would be

C:\Users\mkum\Desktop\java>javac Test.java

Now it will compile well and will generate the binary file.