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 post the exact and complete message.

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.

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???

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.