如何獲取項目在String變量LogPath中的應用程序路徑。 LogPath稍後用於創建項目的日誌文件。我使用Eclipse進行編碼。獲取應用程序路徑以創建新文件
4
A
回答
4
使用
String AbsolutePath = new File(".").getAbsolutePath();
說明:File(".")
代表當前目錄和getAbsoultePath()
回報絕對路徑到當前目錄。
希望它有幫助:-)
1
此調用:new File(".").getAbsolutePath()
爲您提供應用程序的當前工作目錄。我希望這回答了你的問題。
4
1
您正在使用哪種語言?
的Java:
File directory = new File (".");
System.out.println ("Current directory's canonical path: " + directory.getCanonicalPath());
System.out.println ("Current directory's absolute path: " + directory.getAbsolutePath());
相關問題
- 1. 新文件創建路徑
- 2. 在Centennial應用程序中獲取文件的文件路徑
- 3. Java - 獲取「程序文件」路徑
- 4. 如何用路徑創建新文件?
- 5. 獲取應用程序路徑
- 6. 獲取應用程序的路徑
- 7. mono c#獲取應用程序路徑
- 8. 獲取應用程序路徑
- 9. wxWidgets:獲取應用程序路徑
- 10. 獲取應用程序文件路徑在Windows窗體應用程序
- 11. 從文件路徑獲取最新創建的目錄
- 12. 以編程方式獲取應用程序支持文件夾的路徑
- 13. 如何獲取Web應用程序的war文件的路徑?
- 14. 如何獲取winforms應用程序中的文件路徑
- 15. 從觸發應用程序的文件獲取路徑
- 16. 從其他應用程序獲取文件的路徑
- 17. VB.NET獲取文件路徑應用程序teamviewer
- 18. 獲取當前應用程序設置文件的路徑
- 19. 獲取IIS應用程序文件系統路徑
- 20. 在MeteorJS上獲取應用程序文件夾路徑?
- 21. 在Cocoa應用程序中獲取文件夾的路徑
- 22. 獲取Android應用程序下載的文件路徑
- 23. 獲取應用程序內的文件路徑的問題
- 24. 在rcp應用程序中獲取.xslt文件的路徑
- 25. 如何獲取ClickOnce應用程序的文件夾路徑
- 26. 無法讀取文件絕對路徑(以應用程序包)
- 27. Dropwizard路徑:獲取應用程序中的所有路徑
- 28. IntelliJ創建路徑,忘記新文件
- 29. Android應用程序文件路徑
- 30. 如何獲取應用程序路徑和讀取文本文件Windows Phone 7
你是什麼意思的應用程序路徑? – Azodious
應用程序路徑是我運行源項目的地方。 – Gapchoos