|
|
|
|
复制本帖HTML代码
|
高亮:
今天贴
X 昨天贴
X 前天贴
X |
应该把两个.java文件都放在Shapes的目录里。package的结构应该和文件目录结构一样。javac和java都应该在最上一级目录里执行,即Shapes的上一级目录。正确的结构应该是这样的:
C:\home>dir
Volume in drive C has no label.
Volume Serial Number is 43C1-842F
Directory of C:\home
06/23/2006 12:06 AM <DIR> .
06/23/2006 12:06 AM <DIR> ..
06/23/2006 12:06 AM <DIR> Shapes
0 File(s) 0 bytes
3 Dir(s) 32,119,504,896 bytes free
C:\home>dir Shapes
Volume in drive C has no label.
Volume Serial Number is 43C1-842F
Directory of C:\home\Shapes
06/23/2006 12:06 AM <DIR> .
06/23/2006 12:06 AM <DIR> ..
06/23/2006 12:08 AM 0 BasicShape.java
06/23/2006 12:08 AM 0 Shape2D.java
2 File(s) 0 bytes
2 Dir(s) 32,119,504,896 bytes free
C:\home>javac Shapes\Shape2D.java
......
C:\home>java Shapes.Shape2D
......
当你编译Shapes\Shape2D.java时,javac会去找Shapes\Shape2D.class,找不到的话就会自动去找Shapes\Shape2D.java来产生Shapes\Shape2D.class。你遇到的问题就是javac无法找到Shapes\Shape2D.java,因为你没有把Shape2D.java放在Shapes\里。.
|
欢迎来到华新中文网,踊跃发帖是支持我们的最好方法! |
Put your OWN COOL signature here!
|
|