Hi,

I'm having a rather strange problem with the Java compiler.

I'm trying to compile a simple hello world program and I can compile it perfectly within NetBean but when I try to use the commandline javac command I get a error.

The error says the there is something wrong with the parameters for my main.

public class hello {
    public static void main(String args[]){
        System.out.println("Hello Mugambo");
    }
}

Please check filename. Name of .java file must be hello.java. The name of a Java program file (.java) must match the name of the class with the extension java.

Please check filename. Name of .java file must be hello.java. The name of a Java program file (.java) must match the name of the class with the extension java.

I checked both the filename and the class name are the, this is a very strange bug.

Please post the exact and complete message.

hello.java:11: cannot find symbol
symbol  : class string
location: class hello
        public static void main(string args[]){

That is the error I get. It's really mind boggling, especially since my main is syntactically correct although the s in String has been made lower case in the error message can't figure out why.

Edited 7 Years Ago by kenji: n/a

String with a capital S. It's the name of a class - they always begin with a capital. Seems very unlikely that the compiler would change the capitalisation on its own! Duplicate file versions perhaps???

Edited 7 Years Ago by JamesCherrill: n/a

This article has been dead for over six months. Start a new discussion instead.