Topic: 求助…………………………………………………… |
Print this page |
1.求助…………………………………………………… | Copy to clipboard |
Posted by: tgl Posted on: 2004-02-21 17:18 照书上写了俩简单程序,主要是package和import的使用,一调试就出错!咋办? 程序一: package com.g.simple; public class Vector { public Vector(){ System.out.println("com.grantspace.until.Vector"); } public static void main(String [] args){ new Vector(); } } 程序二: import com.g.simple.*; //import com.g.simple.Vector; public class LibTest{ public static void main(String [] args){ Vector v =new Vector(); } } 错误提示: D:\project\LibTest.java:6: cannot access Vector bad class file: D:\project\Vector.java file does not contain class Vector Please remove or make sure it appears in the correct subdirectory of the classpath. Vector v =new Vector(); ^ 1 error 最晕的地方: 把程序二的“import com.g.simple.*;”注释掉,去掉“//import com.g.simple.Vector;”的注释 之后编译、运行都正常了,难道用".*"不可以?不过用别人的库可是没问题啊 该怎么办?>_<~~~~~~~~~~~~~~~~```````````` |
2.Re:求助…………………………………………………… [Re: tgl] | Copy to clipboard |
Posted by: potomac Posted on: 2004-02-21 17:30 把 Vector.java 放到路径 D:\project\com\g\simple 下 |
3.Re:求助…………………………………………………… [Re: tgl] | Copy to clipboard |
Posted by: tgl Posted on: 2004-02-21 21:18 多谢 问题出在java的搜索次序上吗? |
4.Re:求助…………………………………………………… [Re: tgl] | Copy to clipboard |
Posted by: daminggege Posted on: 2004-02-24 10:46 包的顺序其实就是目录层次,这个是必须遵守的 还有要注意的就是手动java,javac时,要是有包的结构还有加参数-classpath |
5.Re:求助…………………………………………………… [Re: tgl] | Copy to clipboard |
Posted by: yyd12345 Posted on: 2004-02-26 12:09 我认为程序1中的 new Vector();是不是可以改成 Vector f=new Vector(); 呢? |
6.Re:求助…………………………………………………… [Re: tgl] | Copy to clipboard |
Posted by: yyd12345 Posted on: 2004-02-26 12:10 我认为程序1中的 new Vector();是不是可以改成 Vector f=new Vector(); 呢? |
Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1 客服电话 18559299278 客服信箱 714923@qq.com 客服QQ 714923 |