Get the project path using Java.
-
Hi, I have a problem on getting the project path of a web application. Reason on getting the project path is I'm uploading a PDF Files to the project path so that I can open it to the browser, I'm hoping to do this
http://localhost:8080/PDFviewer/UploadedFiles/sample.pdf
. I have found something in the Internet but the path is not in my project pathgetServletContext().getRealPath("/");
My project path is
D:\Java\Java Web Projects\PDFviewer
but the above code is giving meD:\Java\Java Web Projects\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\PDFviewer
Can anybody please suggest a way of getting the application path in java. Thanks... :thumbsup: -
Hi, I have a problem on getting the project path of a web application. Reason on getting the project path is I'm uploading a PDF Files to the project path so that I can open it to the browser, I'm hoping to do this
http://localhost:8080/PDFviewer/UploadedFiles/sample.pdf
. I have found something in the Internet but the path is not in my project pathgetServletContext().getRealPath("/");
My project path is
D:\Java\Java Web Projects\PDFviewer
but the above code is giving meD:\Java\Java Web Projects\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\PDFviewer
Can anybody please suggest a way of getting the application path in java. Thanks... :thumbsup:The path the system gives you is correct, because the web server is placed in the wtpwebapps folder. Try to deploy it and see if the path comes up correct on a test system. I assume so.
regards Torsten When I'm not working
-
The path the system gives you is correct, because the web server is placed in the wtpwebapps folder. Try to deploy it and see if the path comes up correct on a test system. I assume so.
regards Torsten When I'm not working
Thank you very much it work perfectly what I expected... :laugh: Even if its not in my Eclipse Web Project it can view the pdf. :thumbsup::thumbsup::thumbsup::thumbsup::thumbsup:
-
Thank you very much it work perfectly what I expected... :laugh: Even if its not in my Eclipse Web Project it can view the pdf. :thumbsup::thumbsup::thumbsup::thumbsup::thumbsup:
you're welcome. This can be confusing, one is never secure to not struggle on such things.
regards Torsten When I'm not working
-
you're welcome. This can be confusing, one is never secure to not struggle on such things.
regards Torsten When I'm not working
yes, I'm really confused... I can't see the uploaded files in my Eclipse App..