Java开发网 Java开发网
注册 | 登录 | 帮助 | 搜索 | 排行榜 | 发帖统计  

您没有登录

» Java开发网 » Java SE 综合讨论区  

按打印兼容模式打印这个话题 打印话题    把这个话题寄给朋友 寄给朋友    该主题的所有更新都将Email到你的邮箱 订阅主题
flat modethreaded modego to previous topicgo to next topicgo to back
作者 关于类的连编大问题!望高手指引迷津!
rainv





发贴: 12
积分: 1
于 2005-12-28 14:03 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
我在无意中使用了cmd下的javac命令编译两个类.在一个包里.
public class test1{
public static void main(String[]args){
test2 t2=new test2();
System.out.println(t2);
}
}

public class test2{
test1 t1=new test1();
public String toString(){
return "test2";
}
}
test1类引用test2类,test2类引用test1类.
一直用着JCreator工具来编译test1,都行,它会把test2连编.
在命令行下javac编译test1不行,说找不到test2.
用javac -classpath [类目录] test1.java 可以,但是,我的问题是.
当我编译其他类时在环境变量设置的其他类找不到了.如servlet包的类.
头大了.为什么javac会找不到同包下的类呢.



作者 Re:关于类的连编大问题!望高手指引迷津! [Re:rainv]
bluecrystal





发贴: 2788991
积分: 48
于 2005-12-28 17:12 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
servlet包不在你自定义的包路径下,当然找不到
要在javac -classpath中指定



Just Software & Travel
-- 我的blog -- 技术点滴/经验分享
作者 Re:关于类的连编大问题!望高手指引迷津! [Re:rainv]
rainv





发贴: 12
积分: 1
于 2005-12-28 21:57 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
那怎么同时引用两个包呀
这样么?
javac -classpath d:\test;${servlet.jar的路径}
斑竹~



作者 Re:关于类的连编大问题!望高手指引迷津! [Re:rainv]
why

問題兒童

总版主


发贴: 4629
积分: 388
于 2005-12-28 22:23 user profilesend a private message to usersend email to whysearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
Why don't you try it instead of asking? Question

javac -classpath d:\test;X:\YourServletJarFolder\servlet.jar

Hopefully there's no spaces in the folder name. Otherwise you would have to put the folder list in quotes.




flat modethreaded modego to previous topicgo to next topicgo to back
  已读帖子
  新的帖子
  被删除的帖子
Jump to the top of page

   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