默认情况下,当前路径`.` 是否在类路径中? [英] Is the current path `.` in the classpath by default?

查看:40
本文介绍了默认情况下,当前路径`.` 是否在类路径中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

第二条命令是否将当前路径添加为另一条搜索路径?

Do the second command add the current path as another path for searching?

javac -cp /home/tim/program_files/programming/java/junit-4.11.jar MyTest.java

javac -cp .:/home/tim/program_files/programming/java/junit-4.11.jar MyTest.java

用冒号分隔多条路径是否正确?

Is it the correct way to separate multiple paths, by a colon?

当前路径不是一直默认在ClassPath中,不需要显式指定吗?

Isn't the current path always in ClassPath by default, and thus no need to explicitly specify?

谢谢.

推荐答案

来自 Oracle 的 页面关于设置类路径:

From Oracle's page on setting the class path:

默认的类路径是当前目录.设置 CLASSPATH 变量或使用 -classpath 命令行选项覆盖该默认值,因此如果要在搜索路径中包含当前目录,则必须包含."在新设置中.

The default class path is the current directory. Setting the CLASSPATH variable or using the -classpath command-line option overrides that default, so if you want to include the current directory in the search path, you must include "." in the new settings.

对于 Windows 使用 ;,对于类 Unix 操作系统使用 : 作为多个路径的分隔符.

Use ; for Windows and : for Unix-like operating systems as a separator for multiple paths.

这篇关于默认情况下,当前路径`.` 是否在类路径中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆