Solved

get real path

Posted on 2011-02-15
2
404 Views
Last Modified: 2012-05-11
I had the below folder structure

Main_Project_folder
  -> Content
       -> old_content
            -> file2.txt
  -> file2.txt

i.e., in main project folder there is a folder content and a file file2.txt and in that content folder there is a folder old_content and in that there is a file with same name file2.txt

to get file2.txt
I wrote in the below way
String path= request.getRealPath("//file2.txt");

how to write for getting file2.txt in the old_content folder

I tried in the below way but it is still pointing file2.txt
String scpath = request.getRealPath("//Content//old_content//file2.txt");
0
Comment
Question by:shragi
  • 2
2 Comments
 
LVL 92

Accepted Solution

by:
objects earned 250 total points
ID: 34902168
assuming main_project_folder is your apps root directory then it should be:

String scpath = request.getRealPath("Content/old_content/file2.txt");
0
 
LVL 92

Expert Comment

by:objects
ID: 34902395
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question