I am new to java. I write a simple code like this:
import java.io.*;
public class a
{
public static void main(String []argc)
{
System.out.println("S");
}
}
I compile it with below bash command:
javac a.java
then this:
java a
But it said:
Could not find or load main class a
My java version is 1.6.0.
What should I do?
A common reason for this is that you’ve set the environment variable
CLASSPATH.This is usually not a good idea, because that setting always influences your whole system.
You can easily define a per-instance classpath, by specifying the
-cpparameter.In your case you can do
This tells Java to look for classes in the current directory (
.).