0

I am using the latest release of Eclispe (i.e. Eclipse Luna).

I have a web project set up and working. Now I want the real physical path of my web project. I have used the real path of my servlet context and it gives me the deployed path under .metadata folder of eclipse.

Is there any way of getting the physical path of my project under my workspace?

gprathour
  • 14,813
  • 5
  • 66
  • 90
Darshan Lila
  • 5,772
  • 2
  • 24
  • 34
  • 1
    Do you mean programmatically? – gprathour Jul 09 '14 at 07:44
  • Yes, I have used real paths and context path but all of them give me the deployed project path. – Darshan Lila Jul 09 '14 at 07:45
  • When you run a project, its WAR file is deployed to the server. So you will only get the context path. I just wonder why do you need the path of Workspace? Will you be having any kind of workspace on your live server? What do you want to achieve? – gprathour Jul 09 '14 at 08:03
  • Well in my project a user can upload a image file, like a profile pic, which is stored under img folder under webcontent. When I save the file, it is actually saved in workspace .metadata folder rather than the actual img folder under my project. – Darshan Lila Jul 09 '14 at 09:12
  • Then you should change your question. It does not make sense to get the workspace path. Where will you have workspace in your live server? You should put the code of File upload/save and post a new question. And delete this one. – gprathour Jul 09 '14 at 09:22

2 Answers2

1

You cannot reliably do so.

If you need information from your project, put it in resource files on the classpath.

Thorbjørn Ravn Andersen
  • 73,784
  • 33
  • 194
  • 347
0

I actually have the same problem. But I have solved with eclipse. Please try this.

Step 1: Select your project or file

Step 2: Now right click on it

Step 3: Go to properties

Step 4: Now go to resources

Step 5: See two path are there.

Path: relative path to your project

Location : Actual path from drive(Full path).

Sagar007
  • 848
  • 1
  • 13
  • 33