博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
JavaWS
阅读量:6811 次
发布时间:2019-06-26

本文共 3919 字,大约阅读时间需要 13 分钟。

 

http://www.w3school.com.cn/tiy/t.asp?f=jquery_ajax2

 

http://springinpractice.com/2008/02/26/annotation-based-autowiring-in-spring-2-5/

 

Java "class"-ic errors Few errors are so common (Frequently Faced Errors or FFEs?) - asked many times in forums, email lists (internal/external) - and it is frustating to face one of these "starting problems". I am talking about the classloading errors with
Java. I'll try to list few common errors and most probable reasons.
  • Error occurred during initialization of VMjava/lang/NoClassDefFoundError: java/lang/Object
    Two possible reasons:
    1. You are trying to run 64-bit JVM (SPARCv9 or AMD-64) with -d64 option. But, you did not install 32-bit JVM. Yes, to run 64-bit JVM you have to install a 32-bit JVM and then install 64-bit binary on the same directory
    2. You are playing with -Xbootclasspath option (why? - in most scenarios it is wrong!) and you didn't include rt.jar in boot class path
  • Exception in thread "main" java.lang.UnsupportedClassVersionError: Bad version number in .class file(or)Unsupported major.minor version 49.0
    Reason: You are trying to run a class compiled with newer version of JDK. For example, you have compiled the class with JDK 5.0 and try to run on JDK 1.4.2. Class file major/minor version evolves with major JDK releases. Each JDK version supports only upto a specific class file major.minor version.
    1. Java SE 6 class file version 50.0 or below
    2. JDK 5.0 class file version 49.0 or below
    3. JDK 1.4.2 class file version 48.0 or below
    While you can run a .class file compiled with past release of JDK, the other way around does not work. You can use option. Also, always check version of "java" used to run your program by using -version option.
  • Exception in thread "main" java.lang.NoClassDefFoundError: tmp/t (wrong name: t)
    Reason: The class name as in .class file is different from what is specified in command line. In the above error scenario, the .class file has the name "t" (in unnamed global package) but user attempted to load it as "tmp.t" (t in tmp package). You have to check package declaration in your source files and confirm that the files are under proper subdirectories (use javac's -d option to put .class files under correct subdirectories). Also you may want to check directory, file name case -- remember to do this on case insensitive file systems as well. It is better to use jar files whenever possible (rather than directories)
  • Exception in thread "main" java.lang.NoClassDefFoundError: x
    This is good (bad?) old error! It is better to check
    1. the value of CLASSPATH environment variable
    2. the value passed as -classpath or -cp option
    3. check that proper path separator (; on Windows, : on Unix - it is easy to miss or use wrong separator for your OS) is used in your classpath specification
    4. Remember that "." (the current directory) is included by default in classpath - but if you have specified CLASSPATH, then that overrides. i.e., With CLASSPATH specified, "." is not automatically added to classpath.
    5. With you can put all your all jar files in one or fewer directories and use to avoid typos in jar file names.
    6. When in doubt, check again before posting to forums :-) Yes, typos are quite common :-)
When you are out of starting troubles, you may still face other classloading issues. "unexpected" class is loaded etc. How can you debug that?
  • Turn on -verbose:class. This prints debug info on each class load. The source of the class file loaded (rt.jar , foo.jar) is also printed along that.
  • Check your configuration. There are many ways to pass arguments to running JVM. (command line argument, environment variables, config files of app/web servers). You may want to check what actual arguments were "seen" by the JVM. You can check these using
    The value of the System property java.class.path is the application classpath used. Similarly, the value of the System property sun.boot.class.path is value of bootstrap class path (Sun specific).
  

 

 

 

 

转载地址:http://piwzl.baihongyu.com/

你可能感兴趣的文章
Collections.sort方法对list排序的两种方式
查看>>
Synchronize Ultimate
查看>>
设计模式之模板方法模式
查看>>
关于配置
查看>>
如何更好的通过Inflate layout的方式来实现自定义view
查看>>
smali语法中文版
查看>>
快如闪电、超轻量级的基于.Net平台的依赖注入框架Ninject
查看>>
Oracle数据库的经典问题 snapshot too old是什么原因引起的
查看>>
linux 查看系统信息命令(比较全)
查看>>
[Bootstrap]modal弹出框
查看>>
14.7-2
查看>>
士兵杀敌(三)(线段树)
查看>>
类string的构造函数、拷贝构造函数和析构函数
查看>>
OC 消息机制本质
查看>>
BT.601与BT.656
查看>>
用css3让溢出内容显示省略号
查看>>
算法排序之冒泡排序
查看>>
IIS、Asp.net 编译时的临时文件路径(转载)
查看>>
Curvilinear structure detections
查看>>
[Android Pro] 临时关闭selinux模式 setenforce 0
查看>>