zoukankan      html  css  js  c++  java
  • Java programming problem in linux box: Exception in thread "main" java.lang.NoClassDefFoundError

    Most people always have the following problem when run their java programs under linux box:
    Exception in thread "main" java.lang.NoClassDefFoundError: *.java
    Even though these programs  really have no problem at all.
    Here are some solutions for you:
    1) Check your syntax that you are trying to run the java class and make sure it should be like this (assume the class file is foo.class):
    java  foo      instead of    java  foo.class

    2) Make sure your classpath contain the special path ".", actually this is most likely where the problem come from. 
    You can try to run your program as follows.

    java -cp .  foo   or
    java  -classpath  .  foo

    If it works, then you are suppose to add "." to you classpath.
    For example:
    export CLASSPATH=.:$JAVA_HOME/lib:JAVA_HOME/jre/lib

    3) Check it out if you compiled the java file without specifying the package that import in your file.

    What if all these works are done, but your still got the same problem?
    Well, in this case, you've got to have a look at your souce code......

    Good luck!

  • 相关阅读:
    python的gui库tkinter
    python图像处理库Pillow基本使用方法
    github配置SSH proxy
    python的pandas库读取csv
    学习app开发思路
    shell脚本中四则运算
    shell脚本实例三
    shell脚本实例二
    shell脚本实例一
    LINUX系统下的shell命令---grep、sed、awk
  • 原文地址:https://www.cnblogs.com/hnrainll/p/2186554.html
Copyright © 2011-2022 走看看