Topic: [Java SE] 需要把tools.jar和rt.jar加到Classpath中吗?

  Print this page

1.[Java SE] 需要把tools.jar和rt.jar加到Classpath中吗? Copy to clipboard
Posted by: why
Posted on: 2006-04-30 19:38

extracted from : http://www.cjsdn.net/post/view?bid=1&id=80536

Jove wrote:
jdk只会加载rt.jar
如果你的程序需要动态调用javac,就把tools.jar加上
C:\>java -verbose
[Opened E:\Java\j2sdk1.4.2_02\jre\lib\rt.jar]
[Opened E:\Java\j2sdk1.4.2_02\jre\lib\sunrsasign.jar]
[Opened E:\Java\j2sdk1.4.2_02\jre\lib\jsse.jar]
[Opened E:\Java\j2sdk1.4.2_02\jre\lib\jce.jar]
[Opened E:\Java\j2sdk1.4.2_02\jre\lib\charsets.jar]
[Loaded java.lang.Object from E:\Java\j2sdk1.4.2_02\jre\lib\rt.jar]
[Loaded java.io.Serializable from E:\Java\j2sdk1.4.2_02\jre\lib\rt.jar]
[Loaded java.lang.Comparable from E:\Java\j2sdk1.4.2_02\jre\lib\rt.jar]
[Loaded java.lang.CharSequence from E:\Java\j2sdk1.4.2_02\jre\lib\rt.jar]
[Loaded java.lang.String from E:\Java\j2sdk1.4.2_02\jre\lib\rt.jar]
[Loaded java.lang.Class from E:\Java\j2sdk1.4.2_02\jre\lib\rt.jar]
[Loaded java.lang.Cloneable from E:\Java\j2sdk1.4.2_02\jre\lib\rt.jar]
[Loaded java.lang.ClassLoader from E:\Java\j2sdk1.4.2_02\jre\lib\rt.jar]
...


不妨认识一下 %JAVA_HOME%\lib 底下的 tools.jar 和 dt.jar 是甚么咚咚,需要不需要:
http://java.sun.com/j2se/1.4.2/docs/tooldocs/windows/jdkfiles.html
http://java.sun.com/j2se/1.5.0/docs/tooldocs/windows/jdkfiles.html

又,如果不明白是否“程序需要动态调用javac”,那就当作不需要;IDE自己默认设定,阁下也默认好了。


c:\jdk1.5.0\lib
Files used by the development tools. These include tools.jar, which
contains non-core classes for support of the tools and utilities in the JDK.
Also includes dt.jar, the DesignTime archive of BeanInfo files that tell
interactive development environments (IDE's) how to display the Java
components and how to let the developer customize them for the application.
               jdk1.5.0
___________|____________________
| | |
bin lib jre
| | __________|_____________________
java.exe tools.jar | |
javac.exe dt.jar bin lib
javap.exe _____|____ __________ ________|_______ ________ ________
javah.exe | | | | | | | |
javadoc.exe java.exe client server rt.jar ext security applet fonts
java.dll | | charsets.jar |
awt.dll jvm.dll jvm.dll localedata.jar

2.Re:[Java SE] 需要把tools.jar和rt.jar加到Classpath中吗? [Re: why] Copy to clipboard
Posted by: pchj200606
Posted on: 2006-06-08 09:18

sun 为什么还要搞jdk和jre两个目录 啊?高手请进来。

3.Re:[Java SE] 需要把tools.jar和rt.jar加到Classpath中吗? [Re: why] Copy to clipboard
Posted by: gip
Posted on: 2006-06-12 23:31

...jdk是开发用的,jre是运行用的,开发的要大很多。

4.Re:[Java SE] 需要把tools.jar和rt.jar加到Classpath中吗? [Re: why] Copy to clipboard
Posted by: davidpike
Posted on: 2006-06-24 21:49

讲得很好!知识应该大家分享。

5.Re:[Java SE] 需要把tools.jar和rt.jar加到Classpath中吗? [Re: why] Copy to clipboard
Posted by: 藤真
Posted on: 2006-07-30 15:20

好呀,知道了。。。Smile

6.Re:[Java SE] 需要把tools.jar和rt.jar加到Classpath中吗? [Re: why] Copy to clipboard
Posted by: figoee
Posted on: 2006-08-27 10:00

了解……

7.Re:[Java SE] 需要把tools.jar和rt.jar加到Classpath中吗? [Re: why] Copy to clipboard
Posted by: cooper1919
Posted on: 2008-06-25 20:04

很有用的东西,谢谢了


   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