Solved

get real path

Posted on 2011-02-15
2
405 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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
CSV file parsing thru Java 13 34
Java Restore security prompts not working 10 63
Notify sent to other threads in Java 9 33
Tagging and Merging on Branch 1 30
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:

829 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