Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Java > Java and JDK > Java Basics
|
Java Basics General beginning Java language questions that don't fit in one of the more specific forums. Please specify what version.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Java Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 12th, 2006, 03:56 AM
Authorized User
 
Join Date: Jan 2005
Posts: 32
Thanks: 0
Thanked 0 Times in 0 Posts
Default Reading the type of file system

Hi,

Does anyone know of any methods in Java that allow you to check what file system is being used by a particular operating system. or how one would go about coding it.

thanking you in advanced

scoobie



 
Old June 14th, 2006, 07:06 PM
Authorized User
 
Join Date: Jun 2006
Posts: 22
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Can u please eloborate further ?

 
Old August 18th, 2009, 09:28 PM
Registered User
 
Join Date: Aug 2009
Posts: 6
Thanks: 1
Thanked 0 Times in 0 Posts
Default

hello!

Does anyone has a java programming that read text file?
 
Old August 19th, 2009, 12:06 AM
jomet
Guest
 
Posts: n/a
Default

Quote:
Originally Posted by scoobie View Post
Hi,

Does anyone know of any methods in Java that allow you to check what file system is being used by a particular operating system. or how one would go about coding it.

thanking you in advanced

scoobie
you can identify os using
System.getProperty("os.name");

and can use code like

if(System.getProperty("os.name").indexOf("Windows" )!=-1)
{
filename = "c:\\test.txt";
}
else
{
filename = "/home/test.txt";
}
 
Old August 19th, 2009, 12:08 AM
jomet
Guest
 
Posts: n/a
Default

Quote:
Originally Posted by azaira View Post
hello!

Does anyone has a java programming that read text file?
just search google u can get lot of samples..
post your questions in separate thread!!

Sample

import java.io.*;

public class ReadFile{
public static void main(String[] args) throws IOException{
File f;
f=new File("myfile.txt");

if(!f.exists()&& f.length()<0)
System.out.println("The specified file is not exist");

else{
FileInputStream finp=new FileInputStream(f);
byte b;
do{
b=(byte)finp.read();
System.out.print((char)b);
}
while(b!=-1);
finp.close();
}
}
}

from http://www.roseindia.net/java/exampl...-by-line.shtml
 
Old August 20th, 2009, 02:35 AM
Registered User
 
Join Date: Aug 2009
Posts: 6
Thanks: 1
Thanked 0 Times in 0 Posts
Default

sorry I didn't mean to put my questions in your thread..I am a new member...





Similar Threads
Thread Thread Starter Forum Replies Last Post
Guidelines Item 3: Replace System.Type with Type Ixtlia BOOK: Professional .NET 2.0 Generics 0 August 19th, 2007 04:09 AM
Reading the GAC of remote system vikingsunil C# 2005 0 November 6th, 2006 06:25 AM
<input type="File"> - Specify File Type and Path gp_mk Classic ASP Basics 2 August 2nd, 2004 03:07 AM
unhandled exception of type 'System.Net.WebExcepti booksnore2 C# 0 June 26th, 2004 07:26 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.