Topic: package????? |
Print this page |
1.package????? | Copy to clipboard |
Posted by: snakejohe Posted on: 2003-01-20 21:15 导入自定义的package用不了,CLASSPATH设置: .;d\edit\java\jdk\package;d:\edit\java\jdk\lib\dt.jar;d:\edit\java\jdk\lib\tools.jar “package com.simple;"在两个编译文件的开头 两个编译好的class放在d:\edit\java\jdk\package\com\simple中 ,然后用”import com.simple.*;"却不能导入。系统提示 bad class: .\list.class class file contains wrong class:com.simple.list |
2.Re:package????? [Re: snakejohe] | Copy to clipboard |
Posted by: jamesji Posted on: 2003-01-23 04:39 目录结构应该如下, 输出类: d:\edit\java\jdk\package\classes d:\edit\java\jdk\package\classes\com\simple\list.class d:\edit\java\jdk\package\classes\yourmain.class 源代码: d:\edit\java\jdk\package\src d:\edit\java\jdk\package\src\com\simple\list.java d:\edit\java\jdk\package\src\yourmain.java In yourmain.java, you can ”import com.simple.*;". And in list.java, the 1st line should be "package com.simple;" The end, set classpath includes "d\edit\java\jdk\package\classes'", then i think everything would be fine. |
3.Re:package????? [Re: snakejohe] | Copy to clipboard |
Posted by: javachina Posted on: 2003-01-23 08:30 I like the idea to separate src and classes directories. However, my suggestion is do not put you own code under jdk directory. Keep jdk directory simple and clean. These is no law on this; it is just a suggestion. Another suggestion is using ant to do the entire building process. The learning curve is a little steep, but it will absolutely worth the time you spend. |
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 |