Solved

get real path

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

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

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…
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
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:
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.

762 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now