ѡ ֻ | ʵ԰
ܰ ַл

ʶ̳-һ̳

ǵղءʶ̳Ͽעɣ
ע

վ˺ŵ½

QQ¼

ֻһٿʼ

ɨһɨ΢

ݵ
б
鿴: 26387|ظ: 0

dz̸Ϊʲôjavaclassļ쳣[5P]

[]
2017-7-26 09:45:55 | ʾȫ¥ |Ķģʽ

ժҪ

ÿһѧѧϰJavaʱտʼϰJavaдһHelloWordȻᰴ鱾ȥ룬Java򣬻ʱִгɹˣǵһѧϰ֪ʶʱѧðռͻдijƽ׳ʱóѧʱķȥʱܻ Exception in thread main java.lang.NoClassDefFoundError:

Ҿdz̸һ¶쳣ķԭͽ㿴֮JavaеĴڵ壡

Դ£

package com.study.mengyi.access;
/**
 * ڲdosjavaеʽг
 * @ClassName TestDosRunning
 * @Description
 * @Author Meng Yi
 * @Date 2017718 11:01:37
 */
public class TestDosRunning {
    public static void main(String[] args){
        System.out.println("Code is running!");
    }
}

ȻIDEг򣬾Ͳֿͷֵ쳣ΪѾˣȲϸ˵doscdԴļ·£javac Դ

ͼjavac ûгֱ˵ǵ·ȷɹ֮һ㶼ֱڵǰĿ¼½ java classļclassļΪļ籾 java TestDosRunning Ȼк󣬷ֻᱨ

Exception in thread "main" java.lang.NoClassDefFoundError: TestDosRunning (wrong name: com/study/mengyi/access/TestDosRunning)
        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)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
        at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:482)

쳣˵ǣ߳дһ쳣ûҵҪеļclassļWaitҾڵǰĿ¼½еİļҲ԰עСдôҲأ ٶһ°ɣ˵߰㣬˵һˣһ֣濴ΪʲôԼأ

Ȼ˵ļûҵӦõһʱ뵽ClassPath**·**ñָʾJVMִл·ҵҪеclassļ֮ǰأֶClassPathǶ˵Ǽ鷳飬Sun˾Java2JDk˸Ӵһ㣬úJavaл󣬾ͲClassPathJDKܵҵ·ĬϵclasspathӵǰĿ¼Ѱclassļ˵ص·ǶԵġų

ѵǵķʷʽ⣿ǵġȿӣ

/**
 * ڲdosjavaеʽг
 * @ClassName TestDosRunning
 * @Description
 * @Author Meng Yi
 * @Date 2017718 11:01:37
 */
public class TestDosRunning {
    public static void main(String[] args){
        System.out.println("Code is running!");
    }
}

WhatôУ ϸԱ֮ǰӷûд ҲΪʲôҸѧJavaʱdosУð֮ôͲˣ

˵ʲô JavaΪ˽ͻõģںһ࣬Щ๲ͬ⣬ʽдΪȫΨһģǴİҲΨһģԾͲͻ⡣ ͵һ JVMбȫǰ׺Ϳȷļ࣬壬java ִʱָȫ

дĻζĬϰеIJдһĬϰԲд£java TestDosRunningԱʶִС

˼ȻķʽǾʼĺijһDzlets go!

whatҰȫˣôа

˵˰õдҪвΣȻΨһʾһ࣬ļʼնҪ洢ڲϵͳУڲϵͳǾǿļĿ¼ṹͻģͨĿ¼ηֻֿͬ࣬packageƱֽΪϵһĿ¼

Javaй̾ǣȣclasspathĸ·ǶΪclassļĸĿ¼ӸĿ¼ʼİת· com.study.mengyi.access; ᱻתɸĿ¼/com/study/mengyi/accessaccessжȡҪصļ

ʽһ

ֱD:\JavaLearning\ThinkInJava\src\com\study\mengyi\accessĿ¼½ java TestDosRunning accessѰ/com/study/mengyi/accessȻûĿ¼ֶһĿ¼ṹclassļƹһ£

classļ·Ϊ

D:\JavaLearning\ThinkInJava\src\com\study\mengyi\access\com\study\mengyi\access

гɹȻDzһӾͶиˣֶĿ¼̫ۣǿڱʱ javac -d . TestDosRunning.java ͬʱΪɵĿ¼ṹ

ʽ

ȻĿ¼ṹǺβֳɵģǿԻ˵comĿ¼ֱ java com.study.mengyi.access.TestDosRunning ʱǰĿ¼Ϊ D:\JavaLearning\ThinkInJava\src

ȷʵ

ܽ

javaΨһԿռõ֤ ijȫʽӦӦĿ¼ṹ ſСjavaʽʾͰӦϵͳļĿ¼ṹգգ

 

ԣhttp://blog.csdn.net/dawn_after_dark/article/details/75303207

 

չĶ

̸̸Java - Classļṹ
javaеIO
Javaԭ
JavaĹԭ
һJava Classļ

ΪƼ

Javaϵṹ
Javaڴй¶ؼ⹤-- JVMع߽jstack, jconsole, jinfo, jmap, jdb, jstat
Greys JavaϹ
Ӧüжأû飨£ʹInotifyװĿ¼
ʹJmeterMySQLܡ(1)

Java
Java



һƪThreejs3Dͼʵܽ
һƪ10JavaScriptѵ
һԴƷԴƽ̨ǵһҪղվwww.gjdhjc.com ||||| ǵַwww.58q8.comʧЧԿһʱ䲹ĻظҲû취ˡ
ظ

ʹõ ٱ

б

QQ|QQȺ133515734|С|ֻ|վ|ٶ||ֻ|ʶ̳ ( ICP13037175 )

GMT+8, 2017-11-20 01:47

ٻظ ض б