0
我在一个Java的Eclipse插件工作,我需要从插件 例如何在Java中获取项目路径..?
/家庭/用户/工作区/ PROJECT_NAME/
拿到项目条路,我不知道怎么办。
我试过,但没有奏效
if (window != null)
{
IStructuredSelection selection = (IStructuredSelection) window.getSelectionService().getSelection();
Object firstElement = selection.getFirstElement();
if (firstElement instanceof IAdaptable)
{
IProject project = (IProject)((IAdaptable)firstElement).getAdapter(IProject.class);
IPath path = project.getFullPath();
// System.out.println(path);
Runtime.getRuntime().exec("zenity --warning --text '"+path+"';echo $?");
}
}
尝试看看这个帖子[这里已经reposonded(http://stackoverflow.com/questions/13011892/how-to-locate-the-path-of-the-current-项目中的Java月食) – murthy