在 linux 下写了一个非常简单的 Hello World 程序,编译正常,运行报错:Error: Could not find or load main class Hello

这是由于 CLASSPATH 配置不当导致的,我们需要检查一下 CLASSPATH 后面是否有英文状态下的“.:”。

主要在环境变量这块:

export JAVA_HOME=/usr/java/jdk1.8.0
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
export PATH=${JAVA_HOME}/bin:$PATH

CLASSPATH=后面一定要加上英文状态下的“.:”(不含中文状态下的双引号)。
更新后需要执行 source /etc/profile 命令重新加载此文件。

Could not find or load main class Hello的更多相关文章

  1. Error: Could not find or load main class test.EditFile

    今天写了一个简单的小程序,运行之后发现Error: Could not find or load main class test.EditFile,项目无法启动.删除main中的所有内容之后依旧提示该 ...

  2. Eclipse報錯:Could not find or load main class

    代碼正確,但在Eclipse中無法運行,一直報錯: Could not find or load main class

  3. Hadoop could not find or load main class

    Error: Could not find or load main class <class_name> 我在尝试使用hadoop definitive guide的代码做练习时,遇到一 ...

  4. Linux 下 Error: Could not find or load main class Hello

    在linux下写了一个很easy的Hello world程序,编译执行居然报错:Error: Could not find or load main class Hello 最后发现是CLASSPAT ...

  5. Error: Could not find or load main class Test

    问题描述 Linux 环境下运行 Java 程序时,执行 javac Test.java 生成 Test.class 文件,再执行 java Test 时报错:Error: Could not fin ...

  6. Sqoop找不到主类 Error: Could not find or load main class org.apache.sqoop.Sqoop

    最近由于要使用Sqoop来到出数据到hdfs,可是发现Sqoop1.4.5跟hadoop2.X不兼容,需要对Sqoop1.4.5进行编译,编译的具体方法见:http://my.codeweblog.c ...

  7. Could not find or load main class org.apache.spark.deploy.yarn.ApplicationMaster

    Spark YARN Cluster mode get this error "Could not find or load main class org.apache.spark.depl ...

  8. [sloved] IDE JavaServlet "Error: Could not find or load main class Servlet"

    [ sloved ] JavaServlet "Error: Could not find or load main class Servlet" 报错内容: 提供一份 Servl ...

  9. 【java】Could not find or load main class

    https://stackoverflow.com/questions/18093928/what-does-could-not-find-or-load-main-class-mean A comm ...

  10. Error: Could not find or load main class org.apache.flume.tools.GetJavaProperty

    问题: [root@master conf]# flume-ng version Error: Could not find or load main class org.apache.flume.t ...

随机推荐

  1. hdu4658(广义五边形&分割函数2)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4658 题意:f(x) 为将 x 分成其他数和的形式的方案数.对于 t 组输入,输出 f(xi, k), ...

  2. web安全-xss攻击

    web安全问题 xss攻击 1.html标签 html内容的转义 escapeHtml str = str.replace(/&/g,'&amp'); str = str.replac ...

  3. Cannot find module 'webpack/bin/config-yargs'

    1.版本不兼容 npm install webpack-dev-server@1.15.0 -g

  4. JSONArray.fromObject Date显示问题

    原文链接:http://www.cnblogs.com/Nbge/archive/2012/07/31/2617127.html 使用JSONArray.fromObject,Date类型打出来的完全 ...

  5. 选课 ( dp 树形dp 动态规划 树规)

    和某篇随笔重了?!!?!?!?!?!?不管了留着吧 题目: 在大学里每个学生,为了达到一定的学分,必须从很多课程里选择一些课程来学习,在课程里有些课程必须在某些课程之前学习,如高等数学总是在其它课程之 ...

  6. Python利用百度地图api批量获取地址经纬度

    1.pip安装xlrd,xlwt,requests模块. 2.在工程目录处放置地点Excel文件. python2.7.13代码: #coding:utf-8 import xlrd import x ...

  7. PANet训练自己的数据(VIA标注)

    当前最好的实例分割网络非PANet莫属,可是由于模型太新,网上的资料太少,最近的项目需要 实例分割,只能自己踩踩坑了,目前我还没看到一篇关于PANet训练的博客,只有几篇讲论文的. 环境:ubuntu ...

  8. Dell N5010 Win7下 玩CS全屏(1366*768)问题

    在Dell N5010 Win7 下完CS1.6 全屏不了,以下是解决办法 1.按windows+r键打开 运行 窗口,输入regedit,打开注册表 2.依次点开 HKEY_LOCAL_MACHIN ...

  9. 开源linux远程登录、远程文件管理(ftp)工具

    ssh远程登录用 PuTTY.Xshell 5 如果觉得命令行下敲命令管理文件麻烦,就用WinSCP.FileZilla Client(SSH模式),可做到文件上传.下载.改权限等等,很便捷

  10. mysql 常用函数。。

    FIND_IN_SET(str,strlist) ,strlist 是 一个 由 逗号 分割的字符串,要注意 strlist 不能有逗号.. 它 等于  where str in (1,2,3***) ...