简体   繁体   English

我无法在CMD中运行java程序

[英]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. 我无法在CMD中运行java程序,但在日食中它是可以的。 在此输入图像描述

These are my configures: 这些是我的配置:

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

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

PATH:%JAVA_HOME%\\bin;%JAVA_HOME%\\jre\\bin 路径:%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. 我不认为该程序有什么问题,因为我甚至没有成功运行一个程序。所有这些程序都来自Head First Java的官方网站。我可以毫无问题地使用javac

I can only provide these now.If you need more information.I'll provide it to you. 我现在只能提供这些。如果您需要更多信息,我会提供给您。

You should be in f:\\pro\\hfjavafinalsamples and run 你应该在f:\\pro\\hfjavafinalsamples并运行

java chap01.BeerSong

You need to give the java command the fully qualified class name, which according to the error message is chap01.BeerSong . 您需要为java命令提供完全限定的类名,根据错误消息,该名称为chap01.BeerSong Then java will look for the class BeerSong within the chap01 package by checking in the chap01 directory. 然后java将通过检查chap01目录在chap01包中查找类BeerSong

Note that Java is case-sensitive as well, even though the file system isn't - the class simple name is BeerSong , not beersong . 请注意,Java也区分大小写,即使文件系统不是 - 类的简单名称是BeerSong ,而不是beersong

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM