在Windows MyEclipse6.5下开发了一Java项目,现将其放到Suse Linux下
现在我需要运行的是DataCatcher.class文件
在终端下输入了java DataCatcher结果报错
Exception in thread "main" java.lang.NoClassDefFoundError: DataCatcher (wrong name: catcher/DataCatcher)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
于是改用javac DataCatcher出现以下错误
javac: invalid flag: DataCatcher
Usage: javac <options> <source files>
where possible options include:
-g Generate all debugging info
-g:none Generate no debugging info
-g:{lines,vars,source} Generate only some debugging info
-nowarn Generate no warnings
-verbose Output messages about what the compiler is doing
-deprecation Output source locations where deprecated APIs are used
-classpath <path> Specify where to find user class files
-cp <path> Specify where to find user class files
-sourcepath <path> Specify where to find input source files
-bootclasspath <path> Override location of bootstrap class files
-extdirs <dirs> Override location of installed extensions
-endorseddirs <dirs> Override location of endorsed standards path
-d <directory> Specify where to place generated class files
-encoding <encoding> Specify character encoding used by source files
-source <release> Provide source compatibility with specified release
-target <release> Generate class files for specific VM version
-version Version information
-help Print a synopsis of standard options
-X Print a synopsis of nonstandard options
-J<flag> Pass <flag> directly to the runtime system
请问怎么办呢?
现在我需要运行的是DataCatcher.class文件
在终端下输入了java DataCatcher结果报错
Exception in thread "main" java.lang.NoClassDefFoundError: DataCatcher (wrong name: catcher/DataCatcher)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
于是改用javac DataCatcher出现以下错误
javac: invalid flag: DataCatcher
Usage: javac <options> <source files>
where possible options include:
-g Generate all debugging info
-g:none Generate no debugging info
-g:{lines,vars,source} Generate only some debugging info
-nowarn Generate no warnings
-verbose Output messages about what the compiler is doing
-deprecation Output source locations where deprecated APIs are used
-classpath <path> Specify where to find user class files
-cp <path> Specify where to find user class files
-sourcepath <path> Specify where to find input source files
-bootclasspath <path> Override location of bootstrap class files
-extdirs <dirs> Override location of installed extensions
-endorseddirs <dirs> Override location of endorsed standards path
-d <directory> Specify where to place generated class files
-encoding <encoding> Specify character encoding used by source files
-source <release> Provide source compatibility with specified release
-target <release> Generate class files for specific VM version
-version Version information
-help Print a synopsis of standard options
-X Print a synopsis of nonstandard options
-J<flag> Pass <flag> directly to the runtime system
请问怎么办呢?
解决方案 »
- 关于子类继承父类static成员变量的疑问?
- new Random()和new Random(System.currentTimeMillis())两个构造方法到底是否等同?
- 为什么这个程序在编译时会出现这个问题????
- String.format在多线程下不可用
- 很的JAVA资料下载网站,快进!!!
- 两个List变量怎么刻隆(clone())!!在线等。。。。。。
- Java程序中如何处理tar.Z包?
- java的Borderlayout布局分为上下左右中5各区,能否将东边的区弄大点,西边小点,如何实现?谢谢
- 如何不用readline,从而实现读取文本的一行呢
- 在哪能找到java程序的sample,类似msdn的.
- Java未来将何去何从?大家进来讨论一下。
- google app engine for java
你可加上$JAVA_HOME再写:
$JAVA_HOME/bin/javac DataCatcher.java就应该没有问题了。
2.用javac时,要用javac DataCatcher.java
http://lavasoft.blog.51cto.com/62575/112312
看下你的DataCatcher.java是不是在哪个包下。
请问不能直接使用class文件吗?