javaubuntu

Issues with running a compiled java program


I am a Java beginner. I wrote a quintessential "Hello, World!" program. It compiles, but won't run. The terminal says there is an exception in the thread main, and that the class hello is not found. I am using Ubuntu 12.04. What could be wrong here?

The file is called hello.java.

The commands I used:

$javac hello.java
$java hello

My code is below:

class hello{
public static void main(String[] args) {
    system.out.print("Hello");  
}
}

EDIT-----------------------------------------------------------------------------------------

I just realized that I am using openjdk7. Does that pose a problem?


Solution

  • Is that all your code? Since you use a terminal, can you add the results of the command ls -lR to your question? (run it in the same directory as your original command executing the application).