I want to get the absolute path of a .exe and I used file.getAbsolutePath()
but give me
Users/Username/Documents/workspaceN/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/NameProject/lib/name.exe
but I only want this:
/Users/Username/Documents/workspaceN/NameProject/lib/name.exe
How can I do this? It runs correctly in Java application but in web application it doesn't.
but I only want this:
/Users/Username/Documents/workspaceN/NameProject/lib/name.exe
How can I do this? In Java application run correctly but in web application not.
First of all web application is a Java (EE) application.
Second: /Users/Username/Documents/workspaceN/NameProject/lib/name.exe
is not the real path of your file. You are getting the real path where the .exe
file is placed into the packaged application; WAR
file.
If you want another path you must use the .exe
file as an external resource and reference it directly from the code, don't include it in the war package.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.