当前位置: 代码迷 >> Java相关 >> Help!Why!
  详细解决方案

Help!Why!

热度:272   发布时间:2005-12-20 20:52:00.0
Help!Why!

help!help!
all the set path or classpath is ok but the error is only one , IS .....

C:\Documents and Settings\wl>cd c:\

C:\>cd jdk1.3.1_09

C:\jdk1.3.1_09>cd bin

C:\jdk1.3.1_09\bin>javac
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
-O Optimize; may hinder debugging or enlarge class file

-nowarn Generate no warnings
-verbose Output messages about what the compiler is doing
-deprecation Output source locations where deprecated APIs are us
ed
-classpath <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
-d <directory> Specify where to place generated class files
-encoding <encoding> Specify character encoding used by source files
-target <release> Generate class files for specific VM version


C:\jdk1.3.1_09\bin>javac Hello.java
error: cannot read: Hello.java
1 error

C:\jdk1.3.1_09\bin>java Hello.java
Exception in thread "main" java.lang.NoClassDefFoundError: Hello/java

C:\jdk1.3.1_09\bin>java Hello
Exception in thread "main" java.lang.NoClassDefFoundError: Hello

C:\jdk1.3.1_09\bin>

搜索更多相关的解决方案: Why  Help  

----------------解决方案--------------------------------------------------------
你的这个程序文件Hello.java 放在bin目录下了没有??

还是在其他地方重新建一个文件夹,把Hello.java放在那里

如在D盘建一个javatest的文件夹,把Hello.java放在 javatest文件夹里

编译的时候

C:\Documents and Settings\wl>d:

D:\ cd javatest

D:\javatest>javac Hello.java

----------------解决方案--------------------------------------------------------
在bin文件夹下的只有命令而已,需要把你的目录转到你的文件所在目录下
----------------解决方案--------------------------------------------------------
光有命令也不可以啊,首先得设置path和classpath,它才识别
----------------解决方案--------------------------------------------------------

再好好看看你弄的对不对吧!
就那几个地方好好看看有没有出错就是了啊!
path,classpath
只要这两个地方设对了就没有问题了啊!


----------------解决方案--------------------------------------------------------

你把hello.java文件放在bin 文件夹下了吗,要放在下面才能运行出来的.


----------------解决方案--------------------------------------------------------
晕,这是哪年的贴啊?!
----------------解决方案--------------------------------------------------------
你还可以在EditPlus2控制台下做的
----------------解决方案--------------------------------------------------------
小新仁兄,你终于浮出水面了,快帮我看看怎么办啊~~
----------------解决方案--------------------------------------------------------
不好意思,眼花了,
错误的原因很简单,
无法找到Hello.java文件,
建议你强行指定路径 javac <-classpath> Hello.java
----------------解决方案--------------------------------------------------------
  相关解决方案