Exception in thread "main" java.lang.NoClassDefFoundError,有导入对应jar包,但显示无法找到对应类? 5C

spring项目,main函数中调用ApplicationContext类


import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class Main {
    public static void main(String[] args) {
        ApplicationContext context = new ClassPathXmlApplicationContext("Beans.xml");
        TextEditor te = (TextEditor) context.getBean("textEditor");
        te.spellCheck();    
    }
}

也有导入相应jar包

图片说明

但是运行后会提示

图片说明

且报错如下

Exception in thread "main" java.lang.NoClassDefFoundError: org/springframework/context/ApplicationContext
    at java.lang.Class.getDeclaredMethods0(Native Method)
    at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
    at java.lang.Class.privateGetMethodRecursive(Class.java:3048)
    at java.lang.Class.getMethod0(Class.java:3018)
    at java.lang.Class.getMethod(Class.java:1784)
    at sun.launcher.LauncherHelper.validateMainClass(LauncherHelper.java:544)
    at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:526)
Caused by: java.lang.ClassNotFoundException: org.springframework.context.ApplicationContext
    at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:338)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    ... 7 more

请问应如何解决呢?

0

3个回答

jave 环境不布配

0

这个是JVM的问题,而不是JAR包的问题,通常情况下可以通过直接安装STS的方法解决(省的做这做那),只要配置好JAVA环境变量就行。

0
qq_38310070
???.BMP 回复qq_36074361: 这就触及到我的知识盲区了
6 个月之前 回复
qq_36074361
qq_36074361 您好,STS里面运行确实是没有问题的:-),但如果是JVM问题的话我其他spring项目为什么又是可以运行的呢
6 个月之前 回复

NoClassDefFoundError发生在JVM在动态运行,建议作者clean项目后重新编译一下试试。

0
weixin_44708092
weixin_44708092 回复qq_36074361: 请问解决了吗
3 个月之前 回复
qq_36074361
qq_36074361 并不是欸T T
6 个月之前 回复
qq_34872748
L星火燎原 回复qq_36074361: 你的包是不是maven管理的??如果是,那么请试试maven clean和maven install 命令看看
6 个月之前 回复
qq_36074361
qq_36074361 您好,clean之后似乎没有解决问题呐
6 个月之前 回复
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
Exception in thread "main" java.lang.NoClassDefFoundError:
编译通过rn在执行时出现如下错误是什么原因:rnException in thread "main" java.lang.NoClassDefFoundError:rnrnrn
java.lang.NoClassDefFoundError: Exception in thread "main"
刚开始学习并发 遇到一个问题,请高手帮忙解决rnrn//LiftOff.javarn public class LiftOff implements Runnablern protected int countDown=10;rn public static int taskCount=0;rn private final int id =taskCount++;rn public LiftOff()rn public LiftOff(int countDown)rn this.countDown=countDown;rn rn rn public String status()rn return "#"+id+"("+rn (countDown>0?countDown:"LiftOff!")+"), ";rn rn public void run()rn while(countDown-->0)rn System.out.println(status());rn Thread.yield();rn rn rn rn rnrn//MainThread.javarnpublic class MainThread rnrn public static void main(String[] args) rn // TODO 自动生成方法存根rn rn LiftOff launch=new LiftOff();rn launch.run();rn rn rnrnrn1在eclipse中运行输出java.lang.NoClassDefFoundError ,同一包中的其他程序运行无异常rn2使用命令编译运行无误rn怎么解决rnrnrn
Exception in thread "main" java.lang.NoClassDefFoundError
在myeclipse中运行如下程序:rnrnrnrn出现错误rnrnrnException in thread "main" java.lang.NoClassDefFoundErrorrn at com.ebay.sdk.ApiCall.executeByApiName(ApiCall.java:588)rn at com.ebay.sdk.ApiCall.execute(ApiCall.java:348)rn at com.ebay.sdk.call.GetSearchResultsCall.getSearchResults(GetSearchResultsCall.java:623)rn at layer_ebay.ebay.getInfo(ebay.java:109)rn at layer_ebay.ebay.main(ebay.java:39)rnrn问题出在哪???请各位高手指教rnrnrn/*rn * Bay.javarn *rn * Created on November 25, 2005, 2:46 PMrn *rn * To change this template, choose Tools | Options and locate the template underrn * the Source Creation and Management node. Right-click the template and choosern * Open. You can then make changes to the template in the Source Editor.rn * The type javax.xml.bind.annotation.XmlAccessType cannot be resolved. It is indirectly referenced from rn required .class filesrn */rnpackage layer_ebay;rnimport Util.ebay_info;rnimport com.ebay.sdk.call.GetSearchResultsCall;rnimport java.util.*;rnimport java.net.URI;rnrnrnrnimport com.ebay.sdk.*;rnimport com.ebay.sdk.call.GetItemCall;rnimport com.ebay.soap.eBLBaseComponents.*;rnimport com.ebay.sdk.util.eBayUtil;rnimport com.ebay.sdk.helper.ConsoleUtil;rnimport com.ebay.soap.eBLBaseComponents.ItemTypeFilterCodeType;rnpublic class ebay rn// public static void main(String args[])rn// ebay e = new ebay();rn//// java.util.ArrayList books = ebayBooks.getInfo(ISBN);rn// rnrn //Main methodrn rn public static void main(String args[])rn// ebaypriceinfo ebay = new ebaypriceinfo();rn String ISBN = "978-7-111-25611-3";rn// double price =ebay.getBookPrice(ISBN);rn ebay e = new ebay();rn java.util.ArrayList array = e.getInfo(ISBN);rn System.out.println("ok");rn rn public static java.util.ArrayList getInfo(String ISBN) rnrn String input;rn java.util.ArrayList bookList = new java.util.ArrayList();rn try rn rn System.out.print("\n");rn System.out.print("+++++++++++++++++++++++++++++++++++++++\n");rn System.out.print("+ Welcome to eBay SDK for Java ! +\n");rn System.out.print("+ Sample - ConsoleViewItem +\n");rn System.out.print("+++++++++++++++++++++++++++++++++++++++\n");rn System.out.print("\n");rn System.out.println("===== [1] Collect Account Information ====");rn rn rn /**Defines API context under which the API call will be made.rn To successfully make eBay API call, rn you need both API account and a normal eBay account. rn ApiContext also controls additional things like logging, CallRetry etc.rn **/rn ApiContext apiContext = new ApiContext();rn /**rn * Defines credentials to be used for making eBay API call. Set either eBay token (seteBayToken()) rn * or ApiAccount plus eBayAccount since they are exclusive to each other. rn */rn ApiCredential cred = apiContext.getApiCredential();rn ApiAccount ac = cred.getApiAccount();rn eBayAccount ec = cred.geteBayAccount();rnrn //String token = "AgAAAA**AQAAAA**aAAAAA**Cf2GQw**nY+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VrFI1eWGFw67AZMPfZfPfnD/HdQHXhd9bjTCkffVEdYIqY72oGWe5sXkEhQ4r4x/EpLzw8nqpB0YC0b10Y8/md+pAC8TgPrqmAmWgM3yc2ta1gkd93Qig8sHqtmBxPoSIYfWd9268EYW+JTaRKP7+mqKwa/0TI+66XMxwRcZJ1QaNo/Z+XUiddHi0oBsLPb6oCf4jmTkkSO55YwJm6ZfeVKJylm8jnhRdhwl88z7g2nvpSyk3za4zg0ysxnG/BN5DSOIzySjErGpUCXt2bIc+O6YTr43GDRNlZylAaCAlbuD670M/2T4DBs00C13YhCrskTjkCNc95IKMjPUJf9+XO8nBemLY1I2I3mKIq//pzRq6aA+7/xfui+TQv0My5hXKehPVm+H/uebu3f6mv96hUahpNdd0GJd3tgYgEceu8jolKGd7ge8C/9acvh/KkvKmPxh/1s2MhL0Z/P52vudOGf5HWEBxdFTG";rn String eBaySOAPURL = "https://api.ebay.com/wsapi";rn rn String itemIDStr ;rnrn apiContext.setApiServerUrl(eBaySOAPURL);rn cred.seteBayToken(token);rn apiContext.setRouting("New");rn GetSearchResultsCall api = new GetSearchResultsCall(apiContext);rnrn //api.setQuery("dell");rn //Contains an ISBN(概述国际标准书号) value, EAN value, UPC(条形码) value, ticket keywords, or eBay catalog product ID, plus other meta-data.rn ExternalProductIDType externalProductIDType = new ExternalProductIDType();rn externalProductIDType.setType(ExternalProductCodeType.ISBN);rn externalProductIDType.setValue(ISBN);rn api.setExternalProductID(externalProductIDType);rn // Search flagsrn ArrayList al = new ArrayList();rnrn SearchFlagsCodeType flags[] = new SearchFlagsCodeType[al.size()];rn for(int i = 0; i < al.size(); i++ )rn flags[i] = (SearchFlagsCodeType)al.get(i);rnrn if( flags.length > 0 )rn api.setSearchFlags(flags);rnrn api.setItemTypeFilter(com.ebay.soap.eBLBaseComponents.ItemTypeFilterCodeType.ALL_ITEMS);rnrn PaginationType pt = new PaginationType();rn rn System.out.println(pt);rn rn pt.setEntriesPerPage(new Integer(10));rn pt.setPageNumber(new Integer(1));rn api.setPagination(pt);rnrn // Call eBay.rn SearchResultItemType[] items = api.getSearchResults();rn rn if (items==null) return bookList;rn for(int i = 0; i < items.length ; i++ )rn rn ItemType it = items[i].getItem();rn itemIDStr = it.getItemID(); //.getValue();rnrn GetItemCall gc = new GetItemCall(apiContext);rn DetailLevelCodeType[] detailLevels = new DetailLevelCodeType[] rn DetailLevelCodeType.RETURN_ALL,rn DetailLevelCodeType.ITEM_RETURN_ATTRIBUTES,rn DetailLevelCodeType.ITEM_RETURN_DESCRIPTIONrn ;rn rn gc.setDetailLevel(detailLevels);rn// ItemIDType itemID = new ItemIDType(itemIDStr);rn// ItemType item = gc.getItem(itemID);rn // [2] Create item object.rn ItemType item = gc.getItem(itemIDStr);rn rn rn rn SellingStatusType sst = item.getSellingStatus();rn ListingDetailsType listingDetails = item.getListingDetails();rn // org.apache.axis.types.URI url1 =listingDetails.getViewItemURL();rn rn rn rn String url1 =listingDetails.getViewItemURL();rn Calendar cal = listingDetails.getEndTime();rn Date dat = cal.getTime();rn rn ebay_info book = new ebay_info();rn book.url = url1.toString();rn book.BidCount=sst.getBidCount();rn book.CurrentPrice =sst.getCurrentPrice().getValue();rn book.ItemType = item.getListingType().toString();rn book.PrimaryCategory = item.getPrimaryCategory().getCategoryID();rn book.Quantity = item.getQuantity();rn book.QuantitySold = sst.getQuantitySold();rn book.StartPrice = item.getStartPrice().getValue();rn book.Title =item.getTitle();rn book.date =dat; rn bookList.add(book);rn rn rn rn catch(Exception e) rn e.printStackTrace();rn rn return bookList;rnrnrnrn rn
exception in thread "main" java.lang.NoclassDefFoundError:***
我想运行程序的话就提示这样:rnexception in thread "main" java.lang.NoclassDefFoundError:***rn是不是类库的问题,还是什么问题?
Exception in thread "main" java.lang.NoClassDefFoundError:***
同样的class在别的机器上可以RUNrn为什么到了我的机器上就出现这个提示啊rn我的PATH和他们的是一样的
Exception in thread "main"java.lang.NoclassDefFoundError
出错Exception in thread "main"java.lang.NoclassDefFoundErrorrn代码如下:rn-----------------------rnpackage hello;rnpublic class Hellorn public static voidrn main(String arg[]) rn System.out.println(new String("Hello, World!"));rn rn
Exception in thread "main" java.lang.NoClassDefFoundError: 为什么?
我写了一个JAVA程序,编译成功,当我执行的时候却出现下列错误,为什么?rnException in thread "main" java.lang.NoClassDefFoundError: e:\ConnectSocketrnrn程序如下:rnrnimport java.io.*;rnimport java.net.*;rnimport java.util.*;rnimport java.sql.*;rnrnclass ConnectSocketrn//与服务器连接rnpublic static void main(String[] args)rnSocket socket;rnString len;rnInputStream Is;rnOutputStream Os;rnDataInputStream DIS;rnPrintStream PS;rntryrn//向主机名为args[0]的服务器申请连接rn//注意端口号要与服务器保持一致:1001rnsocket=new Socket("10.21.5.19",1001);rnrnrncatch(Exception e)rnSystem.out.println("连接Error:"+e);rn rnrn
Exception in thread "main" java.lang.NoClassDefFoundError:Hello
在我的电脑磁盘G盘里有Hello.java文件,内容如下:rn public class Hellornrn public static void main(String[] args)rn rn String str = "hello";rn System.out.println(str);rn rnrnrnrn我在Dos下运行命令:rnrnG:\>javac Hello.java (编译正常)rnG:\>java Hellornrn出现问题:rnException in thread "main" java.lang.NoClassDefFoundError:Hellornrnrn这段代码在eclips里运行完全正常。
Exception in thread "main" java.lang.NoClassDefFoundError: Exception2
设计方法boolean prime(int n),用来判断数n是否为素数,若为素数,返回ture;若不是素数,返回false;若n<0,抛出ArgumentOutOfBound异常。 [code=Java][/code]class ArgumentOutOfBoundException extends Exception rnArgumentOutOfBoundException() rnSystem.out.println("数据异常"); rn rn rnpublic class appp12_16 rnpublic static boolean prime(int n) throws ArgumentOutOfBoundException rnint j,k; rnboolean flag; rnflag=false; rnk=n/2; rnif(n<0) rn rnthrow new ArgumentOutOfBoundException(); rn rnelse rnfor(j=2;j<=k;j++) rnif(n%j==0) return flag; rnif(j>k) flag=true; rnreturn flag; rn rnpublic static void main(String args[]) rntry rnint n=Integer.parseInt(args[0]); rnSystem.out.println(prime(n)); rn rncatch(ArgumentOutOfBoundException e) rn rnSystem.out.println(e.toString()); rn rn rn rn
Exception in thread "main" java.lang.NoClassDefFoundError:Hello ???
什么意思?rnjdk1.4要设环境变量吗?
Exception in thread "main" java.lang.NoClassDefFoundError: Welcome
下面是javac 编译的Welcome.java 代码rnrnJava code[code=Java]rnpublic class Welcome rn rnpublic static void main(String args[])rn rnSystem.out.println("I am a student");rn rn[/code ]rnrn rnrnrnrn下面是错误:可以编译,但不能运行 帮忙指点一下rnMicrosoft Windows XP [版本 5.1.2600]rn(C) 版权所有 1985-2001 Microsoft Corp.rnD:\JDK\lesson1>javac Welcome.javarnD:\JDK\lesson1>java WelcomernException in thread "main" java.lang.NoClassDefFoundError: WelcomernCaused by: java.lang.ClassNotFoundException: Welcomern at java.net.URLClassLoader$1.run(URLClassLoader.java:202)rn at java.security.AccessController.doPrivileged(Native Method)rn at java.net.URLClassLoader.findClass(URLClassLoader.java:190)rn at java.lang.ClassLoader.loadClass(ClassLoader.java:307)rn at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)rn at java.lang.ClassLoader.loadClass(ClassLoader.java:248)rnCould not find the main class: Welcome. Program will exit.rnrnD:\JDK\lesson1>
java.lang.NoClassDefFoundError:run Exception in thread"main"”
在虚拟机的XP系统下安装vxworks6.5时会出现java.lang.NoClassDefFoundError:run Exception in thread"main"”,是什么意思啊?该怎么解决?我是新手,很多不懂得,请高手指点一二!!!!
eclipse Exception in thread "main" java.lang.NoClassDefFoundError:
突然eclipse 就出问题了。。。求解rnrnException in thread "main" java.lang.NoClassDefFoundError: 实验/Duck (wrong name: 实验/DUck)rn at java.lang.ClassLoader.defineClass1(Native Method)rn at java.lang.ClassLoader.defineClass(Unknown Source)rn at java.security.SecureClassLoader.defineClass(Unknown Source)rn at java.net.URLClassLoader.defineClass(Unknown Source)rn at java.net.URLClassLoader.access$100(Unknown Source)rn at java.net.URLClassLoader$1.run(Unknown Source)rn at java.net.URLClassLoader$1.run(Unknown Source)rn at java.security.AccessController.doPrivileged(Native Method)rn at java.net.URLClassLoader.findClass(Unknown Source)rn at java.lang.ClassLoader.loadClass(Unknown Source)rn at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)rn at java.lang.ClassLoader.loadClass(Unknown Source)rn at sun.launcher.LauncherHelper.checkAndLoadMain(Unknown Source)rnrnrn
Exception in thread "main" java.lang.NoClassDefFoundError: Demo
public class Demornrn public static void main(String[] args)rn rn System.out.println("hello world!");rn rnrnrn我用text写了这个java小程序,但是用cmd运行的时候rnrn先 javac Demo.javarnrn然后 java Demorn就报错:Exception in thread "main" java.lang.NoClassDefFoundError: Demo
请教:Exception in thread "main" java.lang.NoClassDefFoundError:...!!
运行时总报Exception in thread "main" java.lang.NoClassDefFoundError:...!!rnrn环境变量设置如下:rnrnclasspath:.;C:\Java\jdk1.5.0_06\lib\tools.jar;C:\Java\jdk1.5.0_06\bin;%JAVA_HOME%/lib;rnrnpath:%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;C:\Java\jdk1.5.0_06\bin;%PATH% rnrnJAVAHOME:C:\Java\jdk1.5.0_06
"Exception in thread "main" java.lang.NoClassDefFoundError: helloworld "?????
rnC:\java>java helloworldrnException in thread "main" java.lang.NoClassDefFoundError: helloworldrnrnC:\java\pathrnPATH=C:\j2sdk1.4.1_04\bin;rnrnrn请问各路神仙怎么回事?环境变量都设好了,rn另外,注册表显示有两个jdk,我新装的是1.4.2,还有一个1.4不知从哪里冒出来的,rn而查找java.exe的时候,发现有n个java.exernrn(昨天还可以运行的,今天就...,)rnrn
Exception in thread "main" java.lang.NoClassDefFoundError: jb
从sun.com上下载了一个jdk1.4.0,装了,编译如下的一个文件 jb.java:rnpublic class jbrnrnrn public static void main(String[] str)rn rn System.out.println("hello to java 1.4.0");rn rnrnrn用javac jb.java编译成功了,然后用java jb运行,出现错误:rnException in thread "main" java.lang.NoClassDefFoundError: jbrnrn不解!!!rnrn
Exception in thread "main" java.lang.NoClassDefFoundError运行报错
我配置的环境变量rnrnclasspath:.;%JAVA_HOME%\lib;%JAVA_HOME%\lib\tools.jar;%JAVA_HOME%\lib\tools.jar;rnrnpath:%JAVA_HOME%\bin;rnrnJAVA_HOME:D:\Java\jdk1.6.0_27rnrn代码:rnpackage file;rnrnimport java.io.*;rnrnpublic class InputStreamReaderTest rnrn /**rn * @param argsrn */rn public static void main(String[] args) rnrn InputStreamReader isr = new InputStreamReader(System.in);rn BufferedReader br = new BufferedReader(isr);rn String s=null;rn try rn s = br.readLine();rn while(s!=null)rn if(s.equalsIgnoreCase("exit"))rn break;rn System.out.println(s.toUpperCase());rn s=br.readLine();rn rn catch (IOException e) rn e.printStackTrace();rn rn rnrnrn
Exception in thread "main" java.lang.NoClassDefFoundError: –jar
路径:/www/b2c/plugins/payment/lib/JavaBridge.jarrnrn#cd www/b2c/plugins/payment/lib/rnrn[root@orange3c lib]# java –jar JavaBridge.jar SERVLET_LOCAL:8080 3 VMBridge.log &rn[1] 14670rnYou have new mail in /var/spool/mail/rootrn[root@orange3c lib]# Exception in thread "main" java.lang.NoClassDefFoundError: –jarrnCaused by: java.lang.ClassNotFoundException: –jarrn at java.net.URLClassLoader$1.run(URLClassLoader.java:202)rn at java.security.AccessController.doPrivileged(Native Method)rn at java.net.URLClassLoader.findClass(URLClassLoader.java:190)rn at java.lang.ClassLoader.loadClass(ClassLoader.java:307)rn at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)rn at java.lang.ClassLoader.loadClass(ClassLoader.java:248)rnCould not find the main class: –jar. Program will exit.rnrn[1]+ Exit 1 java –jar JavaBridge.jar SERVLET_LOCAL:8080 3 VMBridge.logrnrn我是在虚拟机上面弄的,之前都用的好好的,后面重启一下虚拟机就出现这个错误了,VMBridge.log也是空的,自己写hello world程序能编译出来,jar是银行给的,照理说也不会出错,应该是哪里的环境搞错,有高手可以帮忙看一下问题吗?
Exception in thread "main" java.lang.NoClassDefFoundError: hw
public class HWrnrnpublic static void main(String[] args)rnrn System.out.println("Kill");rnrnrn运行时提示:rnException in thread "main" java.lang.NoClassDefFoundError: hwrn为什么?
Exception in thread "main" java.lang.NoClassDefFoundError: PrintPen
Exception in thread "main" java.lang.NoClassDefFoundError: PrintPenrn是什么意思rn该怎么样解决rn程序如下:rnclass Penrnrn int redValue,greenValue,blueValue;rn void getRGColor(int red,int green,int blue)rn rn red=redValue;rn green=greenValue;rn blue=blueValue;rn System.out.println("red = " + red +rn ", green = " + green +rn ", blue = " + blue);rnrnrnrnpublic class PrintPenrnrnpublic static void main(String[] args)rnrnPen pen=new Pen();rnint r = -1, g = -1, b = -1;rnpen.getRGColor(r, g, b);rnSystem.out.println("red = " + r +rn ", green = " + g +rn ", blue = " + b);rnrnrn
Exception in thread "main" java.lang.NoClassDefFoundError:alysor
Exception in thread "main" java.lang.NoClassDefFoundError:alysorrn这是什么错误,是不是类路径设置有错!
为什么Exception in thread "main" java.lang.NoClassDefFoundError
我刚学JAVA,照着教程上的范例做一个基于C/S的简单程序,编译通过了,运行时出现下面的错误,特向论坛的老鸟高手们求救,望指点rnrnC:\Documents and Settings\Administrator>java I:\JAVA\helloServerrnrnException in thread "main" java.lang.NoClassDefFoundError:I:\JAVA\helloServerrnrn
Exception in thread "main" java.lang.NoClassDefFoundError: TextFile
我的一个TextFile.javarn能够javac编译成功rn但是java的时候出现上面题目的错误rnrn?rnjdk配置classpath C:\jdk1.2.2\lib\tools.jar;C:\jdk1.2.2\lib\dt.jarrnpath C:\jdk1.2.2\binrn偶用的xprn在环境变量里设的rn
Exception in thread "main" java.lang.NoClassDefFoundError: xunhuan
javac xunhuan.java没错误,rn但java xunhuan就出现了如标题中的错误,还望大虾帮忙!
错误:exception in thread "main" java.lang.NoClassDefFoundError:
exception in thread "main" java.lang.NoClassDefFoundError: rnrn运行java的类文件时,出现如上的错误地错误提示,如何解决? rnrn以前一直是好的,但是在安装了textpad4之后,就不能够运行application了,但是applet 能够正常运行的。 rnrn请大虾帮忙!
Exception in thread "main" java.lang.NoClassDefFoundError: MainFrame
写的是j2se 窗口程序,导出jar 包的时候已经指出的main方法所在的类名,可双击就是没反应,但在eclipse环境中又能运行,估计是和用了File类有关,我把用到的文件放在项目文件夹下,用File(fileName)得到文件,我写过不用File类的简单的窗口程序,用eclipse export 成jar 包,指定main方法所在的全路径名,然后双击jar包是可以运行展示出窗口的,这样的情况问题是出在哪里呢?rnException in thread "main" java.lang.NoClassDefFoundError: MainFrame
Exception in Thread "main" java.lang.NoClassDefFoundError:Welcome
我用java解释器执行Welcome.class文件时出错!rnrn如下:rnrnexception in thread "main" java.lang.NoClassDefFoundError:Welcomernrn代码如下:rn/*rn*this is my first applicationrn*/rnrnpublic class Welcomernrnpublic static void main(String[] args)rnrnSystem.out.println("这是我的第一个java程序!")rnrn
Exception in thread "main" java.lang.NoClassDefFoundError的问题
一个很简单的JAVA程序,在屏幕上输出几个字符rn在我的PC上(windows),能够成功执行rn我将编译后的.class文件上传到LINUX服务器后,就不能成功执行rn显示:Exception in thread "main" java.lang.NoClassDefFoundError这样的错误信息rn请问各位为什么?rn在两台机器上,我都用java命令来执行。
Exception in thread "main"java.lang.NoClassDefFoundError:helloWorld
求救rn谢谢rn
Exception in thread "main" java.lang.NoClassDefFoundError: test01
连接SQLSERVER2000,第4种类型驱动已经安装。rn代码rnimport java.sql.*;rnpublic class test01rnrnpublic static void main(String agrs[])rnrn String driver="com.microsoft.jdbc.sqlserver.SQLServerDriver";rn String url ="jdbc:microsoft:sqlserver://192.168.1.37:1433";rn String user ="sa";rn String pass ="msdn";rn tryrn rn Class.forName(driver);rn rn catch(Exception E)rn rn System.out.println("can not find driver");rn E.printStackTrace();rn rn tryrn rn Connection con=DriverManager.getConnection(url,user,pass);rn if(!con.isClosed())rnimport java.sql.*;rnpublic class test01rnrnpublic static void main(String agrs[])rnrn String driver="com.microsoft.jdbc.sqlserver.SQLServerDriver";rn String url ="jdbc:microsoft:sqlserver://192.168.1.37:1433";rn String user ="sa";rn String pass ="msdn";rn tryrn rn Class.forName(driver);rn rn catch(Exception E)rn rn System.out.println("can not find driver");rn E.printStackTrace();rn rn tryrn rn Connection con=DriverManager.getConnection(url,user,pass);rn if(!con.isClosed())rn
Exception in thread "main" java.lang.NoClassDefFoundError: HelloWorld
Exception in thread "main" java.lang.NoClassDefFoundError: HelloWorld
Exception in thread "main" java.lang.NoClassDefFoundError: Hello/class
怎么回事?
常见问题解答: Exception in thread "main" java.lang.NoClassDefFoundError: HelloWorld
常见问题解答: Exception in thread "main" java.lang.NoClassDefFoundError: HelloWorldrn(这个问题问的人越来越多,希望这个帖子对大家有帮助... rn ps:放到faq里去吧.......)rnrnrn1.首先,配置你的classpath和path,JAVA_HOMErnJAVA_HOME=c:\jdk (把这里替换为你的jdk所在目录)rnPath=.;$JAVA_HOME\bin;$JAVA_HOME\jre\bin;rnClasspath=.;$JAVA_HOME\lib\dt.jar;$JAVA_HOME\lib\tools.jar;$JAVA_HOME\lib;$JAVA_HOME\jre\lib;rnrn2.重启机器rnrn=================================================================================================================rn一.不带package的程序rnrn1.编写helloworld.javarnclass helloworldrnrn static void main(String args[])rn rn System.out.println("o...o...o...");rn rn;rnrn2.保存在c:\myclass中,rn 编译 rn c:\myclasses> javac helloworld.javarnrn3.运行 c:\> java -cp c:\myclass helloworld (指定了classpath后,在任何目录下都可以运行此程序)rn 或者 c:\myclasses> java helloworld (不指定classpath,只能用classpath中的"."来定位程序,所以必须到程序所在目录下)rnrn 如下运行报错:rn c:\> java helloworld (Exception in thread "main" java.lang.NoClassDefFoundError: helloworld) rnrn==================================================================================================================rn二.带package的程序rnrn1.编写helloworld2.javarnrnpackage dir1.dir2;rnclass helloworld2rnrn static void main(String args[])rn rn System.out.println("o...o...o...2");rn rn;rnrn2.保存在c:\myclass\dir1\dir2中,rn 编译rn c:\myclass\dir1\dir2> javac helloworld2.javarnrn3.运行 c:\> java -cp c:\myclass dir1.dir2.helloworld2 (指定了classpath后,在任何目录下都可以运行此程序)rn 或者 c:\myclasses> java dir1.dir2.helloworld2 rn (不指定classpath,只能用classpath中的"."来定位程序,所以必须到程序中package指定的顶级目录的父目录下执行命令,即:rn dir1的父目录,myclasses)rnrn 如下运行报错:rn c:\> java dir1.dir2.helloworld2 (Exception in thread "main" java.lang.NoClassDefFoundError: rn helloworld2) rnrnrnps:不要把你的目录名/子目录名设为一些敏感词,eg:"java",这会导致报错!rnrn=================================================================================================================rnrn如有错误/疏漏之处,请大家批评指正..............rn
这是什么问题?---exception in thread "main" java.lang.NoClassDefFoundError: ***
-
Exception in thread "main" java.lang.NoClassDefFoundError:test 是怎么回事!
public class Testrnrn public static void main(String[] args)rn rn System.out.println("HelloWorld");rn rnrn
Exception in thread "main" java.lang.NoClassDefFoundError: LibTest?why?
package com.bruceeckel.simple;rnpublic class Listrn public List()rn System.out.println("com.bruceeckel.util.List");rn rn rnrnrnpackage com.bruceeckel.simple;rnpublic class Vectorrn public Vector()rn System.out.println("com.bruceeckel.util.Vector");rn rn rnrn两个包运行正常,用别的程序import也可以!可是为什么下边的程序出这个问题?rn找不到原因!希望大家帮忙!rnimport com.bruceeckel.simple.*;rnpublic class LibTestrn public static void main(String args[])rn Vector v=new Vector();rn List l=new List();rn rn rnrn编译正常,运行出错!rnE:\java\homework>java LibTestrnException in thread "main" java.lang.NoClassDefFoundError: LibTest
Exception in thread "main" java.lang.NoClassDefFoundError: javax/activation/DataSource
Exception in thread "main" java.lang.NoClassDefFoundError: javax/activation/DataSourcernrnrn遇到这个问题应该怎么解决?同一段代码在jbuilder2006 下我以前的工程下用javamail 1.4就会出错,新建立的文件里却没有问题?
新手 为什么提示 Exception in thread "main" java.lang.NoClassDefFoundError:
import java.util.Random;rnpublic class shuijirnrn public static void main(String[] args) rn rn while(true)rn rn Shuiji SJ=new Shuiji();rn new Shuiji().start(); rn rn rnrnrnclass Shuiji extends Threadrnrn public void run()rn rnrn int[] randoms = 0,1; rn Random rnd = new Random(); rn int x = 0; rn //int count = 0; rn while(true) rn rn x = rnd.nextInt(2); rn //if(randoms[x] != -1) rn // rn //return randoms[x]; rn System.out.print(randoms[x]);rn //tryThread.sleep(500);catch(Exception e)e.getLocalizedMessage();rn rn //randoms[x] = -1; rn //count++; rn // rn rn rnrnrn这个程序 编译通过了 为什么运行的时候说Exception in thread "main" java.lang.NoClassDefFoundError:rn我其他的程序都可以运行的啊 请教啊这是为什么啊???????
相关热词 c# 线程顺序 c#昨天当前时间 c# 多进程 锁 c#mysql图片存取 c# ocx 委托事件 c# 读取类的属性和值 c# out 使用限制 c#获取url的id c#怎么进行分页查询 c# update 集合