Exception in thread "main" java.lang.NoClassDefFoundError

在eclipse中编辑的java源码,编译成功后,产生的class文件在项目的bin文件夹中。但是进入class文件所在夹中,运行java 类名 命令显示结果,却出现标题显示的错误。解决的方法是将文件的路径带入,在eclipse中包和源码的结构对应的了文件夹的结构,所以在CMD中返回到bin文件夹,运行java 包名/类名 就可以正确显示,不会出现标题错误了。

时间: 2024-10-18 15:26:08

Exception in thread "main" java.lang.NoClassDefFoundError的相关文章

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory

MyEclipse运行的时候报错,菜鸟不理解是什么意思,最后找了一些资料才知道是因为缺少commons-logging.jar包 Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory at org.apache.commons.httpclient.HttpClient.<clinit>(HttpClient.java:66) at c

Exception in thread &quot;main&quot; java.lang.NoClassDefFoundError: Demo (wrong name: com/zhangyun/Demo)解决办法

介绍一个Java初学者可能会遇到的问题 首先,创建一个类,如下: 文件名:Demo.java package com.zhangyun; public class Demo { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub System.out.println("Hello World!"); } } 然后我找到对应在磁盘的位置,如下: E

MyEclipse8.5集成Tomcat7时的启动错误:Exception in thread “main” java.lang.NoClassDefFoundError org/apache/commons/logging/LogFactory

今天,安装Tomcat7.0.21后,单独用D:\apache-tomcat-7.0.21\bin\startup.bat启动web服务正常.但在MyEclipse8.5中集成配置Tomcat7后,在MyEclipse启动Tomcat服务则出现如下错误提示: Exception in thread “main” java.lang.NoClassDefFoundError: org/apache/juli/logging/LogFactoryat org.apache.catalina.star

Exception in thread &quot;main&quot; java.lang.NoClassDefFoundError: org/jaxen/NamespaceContext

使用dom4j的xpath查询节点,报如下错误: Exception in thread "main" java.lang.NoClassDefFoundError: org/jaxen/NamespaceContext at org.dom4j.DocumentFactory.createXPath(DocumentFactory.java:230) at org.dom4j.tree.AbstractNode.createXPath(AbstractNode.java:207) a

Exception in thread &quot;main&quot; java.lang.NoClassDefFoundError: org/apache/hadoop/yarn/util/Apps Hadoop2.6.0编程问题与解决

从hadoop 1.2.1升级到 Hadoop2.6.0,调试写代码,还是遇到一些问题的.这里记录一下,后续如果自己再遇到类似问题,那也好找原因了. 在eclipse里编译运行 WordCount,出现以下错误. Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/hadoop/yarn/util/Apps at java.lang.ClassLoader.defineClass1(Native M

Java 控制台执行带自定义包定义的类,出现“Exception in thread &quot;main&quot; java.lang.NoClassDefFoundError: ConnectSQLServer (wrong name: sine/ConnectSQLServer)”

1.先说明一下代码实现:自定义package sine, 源代码保存路径为:E:\JSP\HibernateDemo\HibernateDemoProject\src\sine\ConnectSQLServer.java 1 package sine; 2 import java.sql.*; 3 4 public class ConnectSQLServer { 5 6 public static void main(String args[]){ 7 String url="jdbc:sql

dom4j使用xpath报异常 Exception in thread &quot;main&quot; java.lang.NoClassDefFoundError: org/jaxen/NamespaceContext

Exception in thread "main" java.lang.NoClassDefFoundError: org/jaxen/NamespaceContext at org.dom4j.DocumentFactory.createXPath(DocumentFactory.java:230 ) at org.dom4j.tree.AbstractNode.createXPath(AbstractNode.java:207) at org.dom4j.tree.Abstrac

java Exception in thread &quot;main&quot; 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.

【异常】idea执行Main方法出现 Exception in thread &quot;main&quot; java.lang.NoClassDefFoundError: javax/servlet/http/HttpServletRequest

一.异常复现步骤 1)首先得是一个Spring MVC项目 注:Spring Boot项目有内置的web 容器,不会出现该问题 2)main方法存在于使用HttpServletRequest类的类中 3)项目POM中引入有javax.servlet-api坐标或没有 <!-- Servlet --> <dependency> <groupId>javax.servlet</groupId> <artifactId>javax.servlet-ap

Exception in thread &quot;main&quot; java.lang.NoClassDefFoundError: org/springframework/boot/context/embedded/ServletRegistrationBean

异常信息 2017-09-02 18:06:37.223 [main] ERROR o.s.boot.SpringApplication - Application startup failed java.lang.IllegalStateException: Could not evaluate condition on org.springframework.boot.actuate.autoconfigure.EndpointWebMvcAutoConfiguration$Endpoint