Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Linux Archive
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 07-19-2008, 02:10 PM
Juggler's Avatar
Member
 
Join Date: Jul 2008
Location: Chennai,India
Posts: 16
Juggler is on a distinguished road
File Search
hello friends
Idevelop the project using file concept please any one help me to how to search the file in windows OS
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 07-19-2008, 03:31 PM
Mir Mir is offline
Senior Member
 
Join Date: Mar 2008
Posts: 447
Mir is on a distinguished road
Quote:
Originally Posted by Juggler View Post
hello friends
Idevelop the project using file concept please any one help me to how to search the file in windows OS
if you search with the name then this code help you fiend the file path..I am not sure it help you or not..
Code:
import java.io.*; public class FileNameReferToSameFile{ public static void main(String args[]){ File file1 = new File("./file.txt"); File file2 = new File("file.txt"); System.out.println("Actual fileName1 = " + file1 + "\n"); System.out.println("Actual fileName2 = " + file2 + "\n"); // It returns false if Filename paths are not equal boolean b = file1.equals(file2); System.out.println("It checks whether the file name paths are equal or not" + b); // Normalize the paths try { file1 = file1.getCanonicalFile(); // c:\tapan\filename file2 = file2.getCanonicalFile(); // c:\tapan\filename System.out.println("Actual path of filName1 = " + file1 + "\n"); System.out.println("Actual path of fileName2 = " + file2 + "\n"); } catch (IOException e) { System.out.println("IOException is "+ e); } // It returns true if Filename paths are equal b = file1.equals(file2); System.out.println("the file name are now equal" + b); System.out.println("Actual path of fileName1 = " + file1 + "\n"); System.out.println("Actual path of fileName2 = " + file2 + "\n"); } }
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 07-19-2008, 06:09 PM
Juggler's Avatar
Member
 
Join Date: Jul 2008
Location: Chennai,India
Posts: 16
Juggler is on a distinguished road
Thanks..... dude i try this code.....
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Search in text file mark-mlt New To Java 4 04-12-2008 09:33 PM
how to search xml file data based on the given keyword from html form? nicemothi XML 0 04-04-2008 11:36 AM
Search Gilgamesh New To Java 5 11-26-2007 05:45 AM
Web Search Marcus Enterprise JavaBeans 2 07-02-2007 08:51 AM
File Upload - Single to allow the search of .txt files Daniel Advanced Java 1 06-06-2007 06:20 AM


All times are GMT +3. The time now is 02:53 AM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org