aspose file tools*
The moose likes Java in General and the fly likes A Question in File searching Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "A Question in File searching" Watch "A Question in File searching" New topic
Author

A Question in File searching

Vasantha Prabha
Ranch Hand

Joined: Oct 02, 2003
Posts: 108
Hey can any one help me out
I have a question in file searching ?

Here is the example.. Please have look over this
******************
File fl=new File("/test.txt");
if(fl.exists())
{
System.out.println("Yes the file is present");
}
else
{
System.out.println("No the file doesn't exists");
}
Here is my problem ...
my file is in the directory c:\users\work\test.txt
but the programm search for the file in c:\test.txt
and produce the result "Not exists".
I what my program to search in the current dirctory on which the
program file exists
can any one help me out...
Regards,
Sangeetha


Regards,Vasantha<p>Great minds discuss ideas. Average minds discuss events. Small minds discuss people.
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24184
    
  34


A path starting with a slash is an absolute path from the root of the disk. If you want a path relative to the current directory, don't use the slash -- i.e.,


[Jess in Action][AskingGoodQuestions]
Vasantha Prabha
Ranch Hand

Joined: Oct 02, 2003
Posts: 108
Hey In the case If Iam working in weblogic server
If I consider I know only the virtual path like
http://localhost:7001/jsp/test.jsp
Here in this test.jsp file
**********test.jsp
<html>
<%@ page language="java" %>
<%@ page import="example" %>
<jsp:useBean class="example" scope="request" id="Bn" >
<jsp:......
This is how my jsp programm goes off

where in the class
Iam searching for a file work.txt in the directory
in the actual path
c:\weblogic\myserver\public_html\jsp\work.txt
But I want to Know whether I could searhc for file with
the virtual path
http://localhost:7001/jsp/

Regards,
Sangeetha
El Durango
Greenhorn

Joined: Oct 09, 2003
Posts: 23
I use

within my servlet to access virtual paths within tomcat.
You can then append the exact directory paths within the virtualpath.
hope that helps
Vasantha Prabha
Ranch Hand

Joined: Oct 02, 2003
Posts: 108
Thanks El Durango I'll with this ...
Regards,
Sangeetha
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: A Question in File searching