Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Java
  4. Get the project path using Java.

Get the project path using Java.

Scheduled Pinned Locked Moved Java
javaasp-netsysadminhelp
5 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    H Offline
    hansoctantan
    wrote on last edited by
    #1

    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 path

    getServletContext().getRealPath("/");

    My project path is D:\Java\Java Web Projects\PDFviewer but the above code is giving me D:\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:

    T 1 Reply Last reply
    0
    • H hansoctantan

      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 path

      getServletContext().getRealPath("/");

      My project path is D:\Java\Java Web Projects\PDFviewer but the above code is giving me D:\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:

      T Offline
      T Offline
      TorstenH
      wrote on last edited by
      #2

      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

      H 1 Reply Last reply
      0
      • T TorstenH

        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

        H Offline
        H Offline
        hansoctantan
        wrote on last edited by
        #3

        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:

        T 1 Reply Last reply
        0
        • H hansoctantan

          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:

          T Offline
          T Offline
          TorstenH
          wrote on last edited by
          #4

          you're welcome. This can be confusing, one is never secure to not struggle on such things.

          regards Torsten When I'm not working

          H 1 Reply Last reply
          0
          • T TorstenH

            you're welcome. This can be confusing, one is never secure to not struggle on such things.

            regards Torsten When I'm not working

            H Offline
            H Offline
            hansoctantan
            wrote on last edited by
            #5

            yes, I'm really confused... I can't see the uploaded files in my Eclipse App..

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups