javac main.java 编译后没有问题

java main 出现下面在问题:

Exception in thread "main" java.lang.NoClassDefFoundError: main (wrong name: pm/main)
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
        at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
        at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
        at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:355)

解决方法:

  要加上类的包名才可以、还要注意你当所在位置;

  例如main.java的物理路径:A文件夹->AA文件夹->packname(也是文件夹)->main.java

  #cd /A文件夹/AA文件夹/packname

  #javac main.java

  OK这里没有问题。但是要执行java main是要返到类包名的上级目录才可以

  也就是物必须返回到"AA文件夹"目录

  然后:java packname.main 才能成功

  

可参见:http://blog.csdn.net/xifeijian/article/details/8831916

java Exception in thread "main" java.lang.NoClassDefFoundError: main (wrong name: pm/main)的更多相关文章

  1. Java中线程出现Exception in thread "Thread-0" java.lang.IllegalMonitorStateException异常 解决方法

    代码 package thread; public class TestChongNeng { public static void main(String[] args) { Thread t1 = ...

  2. Exception in thread "http-bio-8081-exec-3" java.lang.OutOfMemoryError: PermGen space

    前言: 在http://www.cnblogs.com/wql025/p/4865673.html一文中我曾描述这种异常也提供了解决方式,但效果不太理想,现在用本文的方式,效果显著. 目前此项目只能登 ...

  3. Exception in thread "http-apr-8080-exec-6" java.lang.OutOfMemoryError: PermGen space 解决!

    Exception in thread "http-apr-8080-exec-6" java.lang.OutOfMemoryError: PermGen space at ja ...

  4. 异常Exception in thread "AWT-EventQueue-XX" java.lang.StackOverflowError

    今天太背了,bug不断,检查到最后都会发现自己脑残了,粗心写错,更悲剧的是写错的时候还不提示错. 刚才有遇到一个问题,抛了这个异常Exception in thread "AWT-Event ...

  5. web 环境项目(intellj部署的tomcat) 重启时报 Exception in thread "HouseKeeper" java.lang.NullPointerException (转)

    Exception in thread "HouseKeeper" java.lang.NullPointerException at org.logicalcobwebs.pro ...

  6. exception in thread "http-apr-80-exec-24" java.lang.OutOfMemoryError:PermGen...

    今天客户说项目访问不了了,我急忙看了下告警,发现上报:“exception in thread "http-apr-80-exec-24" java.lang.OutOfMemor ...

  7. idea Exception in thread "http-apr-8080-exec-2" java.lang.OutOfMemoryError: PermGen space

    idea Exception in thread "http-apr-8080-exec-2" java.lang.OutOfMemoryError: PermGen space ...

  8. 项目启动时 Exception in thread "HouseKeeper" java.lang.NullPointerException

    首先查看是否是端口冲突引起,在日志信息该错误位置往上找,如果再无错误信息,而只有该错误,则原因可能如下: 原因: This is because Proxool is not being shutdo ...

  9. Exception in thread "http-apr-8080-exec-1" java.lang.StackOverflowError

    Exception in thread "http-apr-8080-exec-1" java.lang.StackOverflowError 可能执行了递归,陷入了死循环 如下我 ...

  10. Lein: Exception in thread "Thread-3" java.net.ConnectException: Connection refused

    leiningen Leiningen是你的主要工具, 它用于: 启动一个 REPL 下载+安装类库 运行你的程序 启动一个服务器, 运行你所写的webapps 安装 brew install lei ...

随机推荐

  1. yii 日期插件

    ——controller     public $defaultAction = "income";    public function actionIncome(){      ...

  2. 60. vbe6ext.olb 不能被加载

    找到C:\Program Files\Common Files\Microsoft Shared\VBA\路径: 把VBA6文件夹下面的VBE6.DLL改为:VBE7.DLL (如果没有VBA6文件夹 ...

  3. leetcode235

    /** * Definition for a binary tree node. * public class TreeNode { * public int val; * public TreeNo ...

  4. Socket Error # 10013 Access denied

    --------------------------- Debugger Exception Notification --------------------------- Project xxx. ...

  5. mysql find_in_set排序

    假若有给定id数组(1,9,3,5,6);查询sql语句需要安装这个顺序排序 select * from tb where id in (1,9,3,5,6) order by find_in_set ...

  6. Java使用poi生成Excel,生成两种表格下拉框

    想要使用POI操作以xsl结尾的Excel,首先要下载poi相关的jar包,用到的jar有: poi-3.9.jar poi-ooxml-3.9.jar poi-ooxml-schemas-3.9.j ...

  7. 【转】.net 实现 语音搜索(仅限WebKit内核浏览器)

    <input type="text" class="text" name="value_2" id="value_2&quo ...

  8. DOM0和D0M2级事件

    1.DOM0级事件:on+事件类型 1.1.在html行内直接绑定, 1.2.在js中绑定 A.DOM0级事件和DOM0级事件相互之间会覆盖,比如以下代码执行后弹出jsDOM0级,js中绑定的事件 覆 ...

  9. c:forEach varStatus属性

    转自:https://blog.csdn.net/jzy23682891/article/details/7075904 c:forEach varStatus属性 current当前这次迭代的(集合 ...

  10. How to Pronounce T and D between Consonants

    How to Pronounce T and D between Consonants Share Tweet Share Tagged With: Dropped T What happens to ...