2014-03-03 25 views
0

我想獲得沒有IProject類的項目信息,因爲在Indigo中,沒有工作(不存在)。由於如何在Eclipse Indigo中獲取項目名稱?

+1

http://stackoverflow.com/questions/1206095/how-to-get-the-project-name-in-eclipse –

+2

你是什麼意思與「不存在」? IProject存在並且在每個eclipse版本中都有效。可能你應該改進你的問題。 – Arne

回答

1

項目名稱:

String fullprojpath = System.getProperty("user.dir"); 
int index = fullprojpath.lastIndexOf(File.separator); 
System.out.println(fullprojpath.substring(index+1));  
+1

應該使用'File.separator'來代替'File.pathSeparator'。 – uyuyuy99

+0

Rahul good work.yes @ uyuyu99 File.separator是正確的 –

+0

@ uyuyuy99是的它應該是'File.separator'。 – Rahul

-1
System.out.println(System.getProperty("user.dir").split("(.*\\" + File.separator + ")")[1]); 
+0

downvoter會關注評論嗎?我幾乎和拉胡爾完全一樣,但沒有任何錯誤。 – uyuyuy99