`
Wen_JN_86
  • 浏览: 34138 次
  • 性别: Icon_minigender_1
社区版块
存档分类
最新评论

Could not find the main class: Hello.class

    博客分类:
  • jdk
阅读更多

关于jdk初学时Could not find the main class: Hello.class.问题的讨论
今天开始学习java了于是下了一个jdk,可是没想到写Hello world的时候就出现了问题,好郁闷,太打击人了。到网上搜了好长时间未果,最后在百度贴吧的java吧偶然发现了问题所在

一般认为出现这个问题的原因有两个:一个是没有注意到java本身是严格区分大小写这一问题,第二个是java的classpath配置出现了问题。

第一个问题是新手很容易犯的错误

下面我们来分析第二个错误。

到底是classpath的哪里出现问题了呢
上面的截图去掉了classpath中的.;

<!--StartFragment -->

这张截图的classpath只有一个 .代表当前路径

<!--StartFragment -->

上面的是正常配置

所以综上,由于classpath导致出现这个错误的原因是classpath中没有写.; 当前路径

分享到:
评论

相关推荐

    java发送邮件必备的jar包(mail.jar和activation.jar)

    public static void main(String[] args) throws Exception { Properties props = new Properties(); props.put("mail.smtp.auth", "true"); props.put("mail.smtp.starttls.enable", "true"); props.put("mail...

    java打jar包的方法

    ### Java打包成JAR文件的方法及解决“Could not find the main class, Program will exit”错误 在Java开发中,将程序打包成一个可执行的JAR文件是非常常见且实用的操作。这种方式不仅便于程序的分发与部署,还能...

    rxtx-2.1.7.jar串口通信gnu.io包不存在问题

    public class SerialCommunication { private SerialPort serialPort; public void openPort() throws Exception { CommPortIdentifier portId = CommPortIdentifier.getPortIdentifier("COM1"); serialPort = ...

    Java邮件开发Fundamentals of the JavaMail API

    The API's main purpose is not for transporting, delivering, and forwarding messages; this is the purview of applications such as sendmail and other Mail Transfer Agent (MTA) type programs. MUA-type...

    Google C++ Style Guide(Google C++编程规范)高清PDF

    For example, if your header file uses the File class in ways that do not require access to the declaration of the File class, your header file can just forward declare class File; instead of having ...

    jeecg-boot环境搭建

    1. Node Sass could not find a binding for your current environment: Windows 64-bit with Node.js 7.x:解决方法:npm rebuild node-sass 2. ERROR ...

    JDK环境变量设置.txt

    - **问题3**:运行Java程序时报错“Error: Could not find or load main class”。 - **解决方案**:检查`CLASSPATH`环境变量是否正确配置,确保所有依赖的类库路径都被正确指定。 通过上述步骤,我们可以确保JDK...

Global site tag (gtag.js) - Google Analytics