如何在eclipse插件中获取项目的输出类路径

时间:2023-02-05 17:56:46

I want to get the absolute path of the output folder. It may be a link to a folder outside the workspace.

我想获取输出文件夹的绝对路径。它可能是指向工作区外部文件夹的链接。

1 个解决方案

#1


If you want to get the system path of the output of a project programmatically (for an eclipse plugin), you could use IJavaProject:

如果要以编程方式获取项目输出的系统路径(对于eclipse插件),可以使用IJavaProject:

IPath path = project.getOutputLocation();
IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
IFolder folder = root.getFolder(path);
return folder.getLocation();

Also detailed here:

这里还详细说明:

ResourcesPlugin.getWorkspace().getRoot().findMember(javaProject.getOutputLocation()).getLocation();

#1


If you want to get the system path of the output of a project programmatically (for an eclipse plugin), you could use IJavaProject:

如果要以编程方式获取项目输出的系统路径(对于eclipse插件),可以使用IJavaProject:

IPath path = project.getOutputLocation();
IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
IFolder folder = root.getFolder(path);
return folder.getLocation();

Also detailed here:

这里还详细说明:

ResourcesPlugin.getWorkspace().getRoot().findMember(javaProject.getOutputLocation()).getLocation();