coqer
coqer

Reputation: 307

I can't run java program in the CMD

I can't run the java program in the CMD,but it's OK in the eclipse. enter image description here

These are my configures:

CLASSPATH:.;%JAVA_HOME%\lib\dt.jar;%JAVA_HOME%\lib\tools.jar

JAVA_HOME:C:\Program Files\Java\jdk1.7.0_03

PATH:%JAVA_HOME%\bin;%JAVA_HOME%\jre\bin

I don't think there is something wrong with the program,because I am not successful in running even one program.All these programs come from the official website of Head First Java.I can use javac without any problems.

I can only provide these now.If you need more information.I'll provide it to you.

Upvotes: 1

Views: 2552

Answers (1)

Jon Skeet
Jon Skeet

Reputation: 1499800

You should be in f:\pro\hfjavafinalsamples and run

java chap01.BeerSong

You need to give the java command the fully qualified class name, which according to the error message is chap01.BeerSong. Then java will look for the class BeerSong within the chap01 package by checking in the chap01 directory.

Note that Java is case-sensitive as well, even though the file system isn't - the class simple name is BeerSong, not beersong.

Upvotes: 4

Related Questions