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 ...
随机推荐
- mysql 忽略某个错误 继续执行
执行如下存储过程: CREATE PROCEDURE `aa`()BEGINcall RealtimeData_9035();call RealtimeData_9504();call Realti ...
- spring boot 整合 (全)
参考: https://github.com/spring-projects/spring-boot/tree/master/spring-boot-samples
- jap_spring
jar包 applicationContent.xml <?xml version="1.0" encoding="UTF-8"?> <bea ...
- leetcode937
public class Solution { public string[] ReorderLogFiles(string[] logs) { var list1 = new List<str ...
- go遍历目录
package main import ( "fmt" "io/ioutil" "os" "path/filepath" ...
- MySQLNonTransientConnectionException: No operations allowed after connection closed
原因分析 查看了Mysql的文档,以及Connector/J的文档以及在线说明发现,出现这种异常的原因是: Mysql服务器默认的"wait_timeout"是8小时,也就是说一个 ...
- Docker之My sql 之旅
要用到mysql 数据库,本来想在本机装,后来想想还是有点污染环境,既然有docker为什么不用呢? 于是开启了采坑之旅,与其说采坑,倒不如说看文档不仔细看. docker pull mysql:5. ...
- 必备 .NET - C# 脚本
作者:Mark Michaelis | 2016 年 1 月 Link: https://msdn.microsoft.com/zh-cn/magazine/mt614271.aspx 随着 Visu ...
- 分类模型评估之ROC-AUC曲线和PRC曲线
http://blog.csdn.net/pipisorry/article/details/51788927 在样本分布及其不均匀的情况下,建议用PRC...可以看下这个精确率.召回率.F1 值.R ...
- 根据条件决定是否为input设置只读属性
代码如下: <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <tit ...