java Exception in thread "main" java.lang.NoClassDefFoundError: main (wrong name: pm/main)
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)的更多相关文章
- Java中线程出现Exception in thread "Thread-0" java.lang.IllegalMonitorStateException异常 解决方法
代码 package thread; public class TestChongNeng { public static void main(String[] args) { Thread t1 = ...
- Exception in thread "http-bio-8081-exec-3" java.lang.OutOfMemoryError: PermGen space
前言: 在http://www.cnblogs.com/wql025/p/4865673.html一文中我曾描述这种异常也提供了解决方式,但效果不太理想,现在用本文的方式,效果显著. 目前此项目只能登 ...
- 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 ...
- 异常Exception in thread "AWT-EventQueue-XX" java.lang.StackOverflowError
今天太背了,bug不断,检查到最后都会发现自己脑残了,粗心写错,更悲剧的是写错的时候还不提示错. 刚才有遇到一个问题,抛了这个异常Exception in thread "AWT-Event ...
- web 环境项目(intellj部署的tomcat) 重启时报 Exception in thread "HouseKeeper" java.lang.NullPointerException (转)
Exception in thread "HouseKeeper" java.lang.NullPointerException at org.logicalcobwebs.pro ...
- exception in thread "http-apr-80-exec-24" java.lang.OutOfMemoryError:PermGen...
今天客户说项目访问不了了,我急忙看了下告警,发现上报:“exception in thread "http-apr-80-exec-24" java.lang.OutOfMemor ...
- 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 ...
- 项目启动时 Exception in thread "HouseKeeper" java.lang.NullPointerException
首先查看是否是端口冲突引起,在日志信息该错误位置往上找,如果再无错误信息,而只有该错误,则原因可能如下: 原因: This is because Proxool is not being shutdo ...
- Exception in thread "http-apr-8080-exec-1" java.lang.StackOverflowError
Exception in thread "http-apr-8080-exec-1" java.lang.StackOverflowError 可能执行了递归,陷入了死循环 如下我 ...
- Lein: Exception in thread "Thread-3" java.net.ConnectException: Connection refused
leiningen Leiningen是你的主要工具, 它用于: 启动一个 REPL 下载+安装类库 运行你的程序 启动一个服务器, 运行你所写的webapps 安装 brew install lei ...
随机推荐
- vim编程设置
在终端下使用vim进行编辑时,默认情况下,编辑的界面上是没有显示行号.语法高亮度显示.智能缩进 等功能的.为了更好的在vim下进行工作,需要手动设置一个配置文件:.vimrc.在启动vim时,当前用户 ...
- 折腾了几个小时,分享下zendstudio10的git使用
今天打开zend10,发现新建项目的地方有 from git,from github,就试了试,发现可以导出,也可以commit,但是没办法push. 就百度百度,发现zendstudio10的git ...
- sbt的安装测试
1.下载 wget https://github.com/sbt/sbt/releases/download/v0.13.15/sbt-0.13.15.tgz 2.安装 tar -zxvf sbt-0 ...
- 7. mybatis实战教程(mybatis in action)之八:mybatis 动态sql语句
转自:http://www.kyjszj.com/htzq/79.html 1. if 语句 (简单的条件判断) 2. choose (when,otherwize) ,相当于java 语言中的 sw ...
- IOS CFBundleIdentifier
CFBundleIdentifier CFBundleIdentifier 必须是com.12306.aaa 这样的格式吗 AppID 用通配符格式的AppID方便. AppSt ...
- AJAX服务器返回数据 连接数据库查询数据
getcustomer.asp" 中的源代码负责对数据库进行查询,然后用 HTML 表格返回结果: <% response.expires=-1 sql="SELECT * ...
- windows系统安装参数
winnt32 /dudisable /s:. /unattend:winnt.sif /makelocalsource /tempdrive:C /syspart:C 以上各参数解释如下: /dud ...
- as3的全屏功能的实现主要是舞台stage的displayState属性
StageDisplayState.NORMAL 正常 StageDisplayState.FULL_SCR ...
- as3 代码优化
1 代码写法 1 定义局部变量 定义局部变量的时候,一定要用关键字var来定义,因为在Flash播放器中,局部变量的运行速度更快,而且在他们的作用域外是不耗占系统资源的.当一个函数调用结束的时候,相应 ...
- Procedure-Function oracle
说明:SQL语言共分为四大类:数据查询语言DQL,数据操纵语言DML, 数据定义语言DDL,数据控制语言DCL. 0.调试 点击procedure名,右键选择调试.即可进入调试模式.找到procedu ...