本文介绍了没有指定classpath时默认的类路径是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

想知道什么是未指定classpath选项时的默认类路径?

Wondering what will be the default classpath when not specifying classpath option?

推荐答案

当前工作目录()。

来自:



这是否包含子目录?



不,类路径中没有条目是递归的。您必须明确列出每个子目录(或jar)。但是,如果您有一个 Example.class 文件,表示类 pkg.subpkg.Example ,并使用默认的类路径,那么这个文件应该存在于 ./ pkg / subpkg / Example.class

Does this include subdirectories?

No, no entry in the classpath is "recursive". You have to list each subdirectory (or jar) explicitly. However, if you have an Example.class file representing class pkg.subpkg.Example, and the default classpath is used, then this file should live in ./pkg/subpkg/Example.class.

如果 java 尝试解析 pkg.subpkg.Example 它将查找 / pkg / subpkg 每个类路径条目。即您不必列出 pkg pkg / subpkg 在类路径中,只有

If java attempts to resolve pkg.subpkg.Example it will look in /pkg/subpkg of each classpath entry. I.e. you do not have to list ., pkg, and pkg/subpkg in the classpath, only ..

这篇关于没有指定classpath时默认的类路径是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-25 12:53