java classpath配置-菜鸟学习java第五天笔记
classpath配置
问题1:能在任意路径下执行Demo吗?能,像bin目录设置环境变量(已添加到Path)一样,将.class文件路径设为变量classpath。
比如set classpath=d:\java0217\day01 ,如果要清空set classpath=
- - - - - - - - - - - - - - - - - - - - - - - - - -
问题2:当前路径和classpath都有Demo.class,先执行哪个?classpath,先找classpath,再找当前路径。
set classpath=c:\;
末尾有分号,先找classpath,再找当前路径。
末尾无分号,只找classpath。
- - - - - - - - - - - - - - - - - - - - - - - - - -
问题3:配置classpath时,末尾是加分号好,还是不加好?不加的好。因为没找着,就该报错,而不该出现结果。
为和Path保持一致的查找顺序。(.表示当前路径)这么配就先找当前路径了。如set classpath=.;c:\;d:\
- - - - - - - - - - - - - - - - - - - - - - - - - -
问题4:环境变量Path的查找顺序?
与classpath顺序相反:先找当前路径,再找Path
本文来源 我爱IT技术网 http://www.52ij.com/jishu/5521.html 转载请保留链接。
- 评论列表(网友评论仅供网友表达个人看法,并不表明本站同意其观点或证实其描述)
-
