是否可以在工作区外运行一个类?

时间:2023-05-12 17:46:03

I want to run a class that is outside of the workspace that I work in.

我想运行一个在我工作的工作区之外的类。

I am working on Eclipse.

我正在研究Eclipse。

Is it possible to invoke a class that is outside of the workspace?

是否可以调用工作区外的类?

1 个解决方案

#1


Normally Eclipse knows little about files not present in the project tree of any project. However you can use "Configure Build Path", tab "Libraries", "Add External Class Folder" and specify the path to the folder where your class files exist. After that this folder will become a part of project classpath and you can specify any class from that folder as the main class in your Launch configuration.

通常,Eclipse对任何项目的项目树中不存在的文件知之甚少。但是,您可以使用“配置构建路径”,“库”选项卡,“添加外部类文件夹”并指定存在类文件的文件夹的路径。之后,此文件夹将成为项目类路径的一部分,您可以将该文件夹中的任何类指定为Launch配置中的主类。

#1


Normally Eclipse knows little about files not present in the project tree of any project. However you can use "Configure Build Path", tab "Libraries", "Add External Class Folder" and specify the path to the folder where your class files exist. After that this folder will become a part of project classpath and you can specify any class from that folder as the main class in your Launch configuration.

通常,Eclipse对任何项目的项目树中不存在的文件知之甚少。但是,您可以使用“配置构建路径”,“库”选项卡,“添加外部类文件夹”并指定存在类文件的文件夹的路径。之后,此文件夹将成为项目类路径的一部分,您可以将该文件夹中的任何类指定为Launch配置中的主类。