利用android应用开发揭秘(全) 提供的源代码调试 :第8章 的Examples_08_05例子时:
首先在命令行中输入 javac Server.java,然后在输入java Server时出现以下错误:Exception in thread "main" java.lang.NoClassDefFoundError: Server(wrong name:com/yarin/android/Example_08_05/Server)
  .
  .
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.loadClass(Unknown Source)
  .
  .
Could not find the main class: Server.  Program will exit.
VM Arguments:
jvm_args: -Dfile.encoding=GBK -Xbootclasspath:D:\android-sdk-windows\platforms\android-8\android.jar 
java_command: com.yl.android.Server
Launcher Type: SUN_STANDARDEnvironment Variables:
JAVA_HOME=D:\Java\jdk1.6.0_25
CLASSPATH=.;D:\Java\jdk1.6.0_25\lib\tools.jar;D:\Java\jdk1.6.0_25\lib\dt.jar;
PATH=C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\Program Files (x86)\Common Files\Microsoft Shared\Windows Live;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Common Files\Thunder Network\KanKan\Codecs;C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL Server\100\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\VSShell\Common7\IDE\;C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\PrivateAssemblies\;C:\Program Files (x86)\Microsoft SQL Server\100\DTS\Binn\;C:\Program Files (x86)\Windows Live\Shared;D:\Java\jdk1.6.0_25\bin;D:\android-sdk-windows\platform-tools;D:\apache-tomcat-7.0.11\bin
USERNAME=yl
OS=Windows_NT
PROCESSOR_IDENTIFIER=Intel64 Family 6 Model 23 Stepping 10, GenuineIntel---------------  S Y S T E M  ---------------OS: Windows NT 6.1 Build 7600 CPU:total 2 (2 cores per cpu, 1 threads per core) family 6 model 23 stepping 10, cmov, cx8, fxsr, mmx, sse, sse2, sse3, ssse3Memory: 4k page, physical 4157944k(1815112k free), swap 8313992k(5238628k free)vm_info: Java HotSpot(TM) 64-Bit Server VM (20.0-b11) for windows-amd64 JRE (1.6.0_25-b06), built on Apr 14 2011 00:44:38 by "java_re" with MS VC++ 8.0 (VS2005)time: Wed May 18 15:53:07 2011
elapsed time: 0 seconds

解决方案 »

  1.   

    类是有的,貌似你的bin路径没加
      

  2.   

    不用通过命令行启动程序,可以在eclipse里面直接执行java应用程序如果要通过命令行,需要把文件路径加到环境中
      

  3.   

    在server类上右键 -> run as -> java application 在console上输入错误信息JRE version: 6.0_25-b06
    # Java VM: Java HotSpot(TM) 64-Bit Server VM (20.0-b11 mixed mode windows-amd64 compressed oops)
    # An error report file with more information is saved as:
    # D:\workspace\Examples_08_04\hs_err_pid3044.log
    #OS: Windows NT 6.1 Build 7600 CPU:total 2 (2 cores per cpu, 1 threads per core) family 6 model 23 stepping 10, cmov, cx8, fxsr, mmx, sse, sse2, sse3, ssse3Memory: 4k page, physical 4157944k(2572112k free), swap 8313992k(6401796k free)vm_info: Java HotSpot(TM) 64-Bit Server VM (20.0-b11) for windows-amd64 JRE (1.6.0_25-b06), built on Apr 14 2011 00:44:38 by "java_re" with MS VC++ 8.0 (VS2005)time: Tue May 24 16:19:15 2011
    elapsed time: 0 seconds
      

  4.   


    我在server类上右键 -> run as -> java application 但在console上输入错误信息