日期:2014-05-20  浏览次数:20659 次

用ultraedit+jdk的小问题
有两个问题:
1、我用ultraedit+jdk开发java程序时,怎样才能将源文件(*.java)和类文件(*.class)放在两个不同的文件夹下呢?
2、在解释执行时,为什么当前路径必须是类文件目录呢?比如说我的类文件目录是d:\class,如果在dos下解释执行时,当前路径是其他的话,系统就会报错:noclassdeffounderror:类文件名。如果当前路径改为d:\class>的话,就可以执行了,这是怎么回事?

------解决方案--------------------
先回答第2问题
你的目录在d:\aaa下的时候,里面并没有xx.class文件当然不能执行(java xx)这个文件了,比如你有个文件放在c盘下,你打开d盘想执行,那怎么可能呢?

第1问题javac -d参数可以将class生成到不同目录下去.
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 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
-source <release> Provide source compatibility with specified release
-target <release> Generate class files for specific VM version
-help Print a synopsis of standard options