• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Paul Clapham
  • Devaka Cooray
  • Bear Bibeault
Sheriffs:
  • Junilu Lacar
  • Knute Snortum
  • Liutauras Vilda
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Piet Souris
Bartenders:
  • salvin francis
  • Carey Brown
  • Frits Walraven

Is a file ??

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a small program:

import java.io.*;
public class A{
public static void main(String a[]){
File f = new File("d:\\joe\\GenerateJar.class_rename");
System.out.println("f.isFile() d:" +f.isFile());
f = new File("\\10.102.7.180\\d\\joe\\GenerateJar.class_rename");
System.out.println("f.isFile() 10.102.7.180:" +f.isFile());
}
}
///its out put is
---------- java ----------
f.isFile() d:true
f.isFile() 10.102.7.180:false

Output completed (0 sec consumed) - Normal Termination
//
// d:\\joe\\GenerateJar.class_rename is local drive
// \\10.102.7.180\\d\\joe\\GenerateJar.class_rename is also local machine
//but it is showing different output why??

please any help
Vivek s
 
vicky baba
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
it is working for windows enviornment but not working for linux or sun soalris.
 
author and iconoclast
Posts: 24203
43
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A path which includes the machine name with extra slashes and all is a Windows concept; there's no standard equivalent on non-Windows systems. Not to mention, of course, that UNIX doesn't have the concept of drive identifiers, nor does it use backslashes for path separators. What exactly are you trying to do, here?
 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
The problem over here is that unix system doesnt the take the path as specified and do not use backslashes for pathseperator .There is basically difference between windows and non-windows environment.My suggestion is that you would use the method such as System.getproperty().(pathseperator or .homedir etc)
 
I claim this furniture in the name of The Ottoman Empire! You can keep this tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
    Bookmark Topic Watch Topic
  • New Topic