f



java.io.File.getAbsolutePath() vs. java.io.File.getCanonicalPath()

What is the meaning of the term Canonical Path?
0
sathyaish (59)
3/5/2007 3:03:28 PM
comp.lang.java.programmer 52714 articles. 1 followers. Post Follow

4 Replies
1249 Views

Similar Articles

[PageSpeed] 8

The API makes it fairly clear does it not? ...https://java.sun.com/j2se/1.4.2/docs/api/java/io/File.html#getCanonicalPath()On Mar 5, 3:03 pm, "Sathyaish" <sathya...@gmail.com> wrote:> What is the meaning of the term Canonical Path?
0
nobrow
3/5/2007 3:13:10 PM
Thank you.Sorry, I hadn't scrolled down to the complete definition.
0
Sathyaish
3/5/2007 3:25:44 PM
Also tried out an example. Sorry for being lazy the first time. I wastrying to save some time.
0
Sathyaish
3/5/2007 3:38:02 PM
No harm in that.On Mar 5, 3:38 pm, "Sathyaish" <sathya...@gmail.com> wrote:> Also tried out an example. Sorry for being lazy the first time. I was> trying to save some time.
0
nobrow
3/5/2007 3:55:39 PM
Reply:

Similar Artilces:

java.io.File to java.lang.String
What's the best way to get the contents of a file represented by ajava.io.File object into a String? Benjamin wrote:> What's the best way to get the contents of a file represented by a> java.io.File object into a String?> You don't specify what you consider best so how about simple as best? Now for my curiosity, why would you want to do this?import java.io.*;public class test { public static void main(String[] args) throws Exception { ByteArrayOutputStream baos = new ByteArrayOutputStream(); File f = new File(args[0]); FileInputStream fis = new ...

Updating an existing image (converting from java.io.File to java.awt.Image)
Hi, I am working on a TV application which is based on jdk 1.1. here I draw an Image using: Image myImage = this.getToolkit().getImage(imagePath); (...and graphics.drawImage(myImage) in the paint() method) The problem comes when I get an Event telling me that the image is updated. From the event, I can get the source of the updated File (in this case, an Image). So, I can obtain the updated File (which is an Image) by doing: File updatedFile = (File)updateEvent.getSource(); When I try to cast the File to an Image, I get a ClassCastException If I try to re-instanciate the image after I get ...

Substituting Java API classes for enhanced functionality (e.g. java.io.File)
Hi, I have written a substitute for some java.io.* classes. My classes treat ZIP or JAR files exactly like directories, so that you can e.g. list ZIP files and arbitrarily read or write or delete their entries. My substitutes have the same name as in the java.io package, but live in their own package (e.g. de.schlichtherle.io.File instead of java.io.File). This provides 98% source code compatibility - most of the time a simple import statement at the top of a using class is enough to use the new functionality. To achieve 100% compatibility I would like to provide a modified classloader...

cast java.io.PushbackReader to java.io.Reader?
Hi all, I have a function in Matlab that makes a database call and returns a java.io.Reader instance. Matlab seems to automatically convert this to a PushbackReader. Is there a way to force it to remain as just a Reader, or cast it to a Reader after the fact? Here's what it looks like: try xmlReader = myDBClient.read(java.lang.String(myXMLDocumentIdentifierString)) ... catch display([lasterr]); end result: xmlReader 1x1 java.io.PushbackReader where DBClient.read() signature is: public Reader read(String xmlDocumentIdentifier) {} The XML document identifier i...

java.io.FileReader and java.io.FileWriter encoding
Hi, I recently changed the hosting for my website (from Linux to Linux) and now I'm experiencing some trouble with java.io.FileReader and java.io.FileWriter: their getEncoding() method returns ASCII (returned ISO8859_1 on the previuos host). I've set -Dfile.encoding=ISO-8859-1 but nothing has changed, except that javax.mail.internet.MimeUtility.getDefaultJavaCharset() effectively returns ISO-8859-1. Does anyone know how the default encoding is selected? I report some system properties: file.encoding.pkg: sun.io user.country: US java.runtime.version: 1.4.2_04-b05 os.version: 2...

java.io.WriteAbortedException: writing aborted; java.io.NotSerializableException:
I have an application that came to a grinding halt yesterday for no apparent reason. After looking into it I discovered that the file system had reached its capacity. My java guru is on holidays and wont be back for a week so I have been left to try and resolve this in his absence. In the tomcat logs directory the file "localhost_log-YYY-MM-DD.txt" is growing to 45MB in size every day. When looking into the file it contains the same error message over and over again: java.io.WriteAbortedException: writing aborted; java.io.NotSerializableException: I have checked the Catalina.lo...

java.io.File
Can a java.io.File object use a OS file descriptor? I am trying to find the source of a fd leak in a application. Mark wrote: > Can a java.io.File object use a OS file descriptor? I am trying to > find the source of a fd leak in a[n] application. At some point, depending on the operations performed by the 'File' instance, there may be a file descriptor involved, and then the 'File' instance certainly does use it, at least indirectly via JVM system calls that proxy to OS system calls. From a Java perspective you should look for unclosed I/O streams/channels and packr...

Good abstraction of java.io.File
Hello, I think org.eclipse.core.resources provides with IFile, IFolder, IResourceVisitor etc. a very good abstraction of java.io.File: http://help.eclipse.org/help31/index.jsp?topic=/org.eclipse.platform.doc.isv/reference/api/org/eclipse/core/resources/IResource.html I'm writing a library that needs some functionality to traverse folders and to manipulate files. That library should be not depend on the whole Eclipse stuff (just a "JAR", not a plug-in for Eclipse). Is there any way to use org.eclipse.core.resources in that way? Anybody tried that? If it is not possible (I...

Java in Java
Is it possible to download a Java app (applet etc?) and run it inside a desktop Java app? -- Dirk http://www.transcendence.me.uk/ - Transcendence UK http://www.theconsensus.org/ - A UK political party http://www.onetribe.me.uk/wordpress/?cat=5 - Our podcasts on weird stuff Dirk Bruere at NeoPax wrote: > Is it possible to download a Java app (applet etc?) and run it inside a > desktop Java app? > Quite likely, but you won't necessarily get the same security model, unless you were careful about it. -- Daniel Pitts' Tech Blog: <http://virtualinfinity.net/wordpress/&g...

Java Java
Have my first Open Source Linux Java Project. Working on a second right now. Coming out with a distro called OPEN*WINDOWS. It will be at www.black-and-company.com tab wrote: > Have my first Open Source Linux Java Project. > Working on a second right now. > > Coming out with a distro called OPEN*WINDOWS. > > It will be at www.black-and-company.com > Wasn't that the whole point of Lindows? Oh, right, we didn't care for that either. tab wrote: > Have my first Open Source Linux Java Project. > Working on a second right now. > > Coming out with a ...

Extending java.io.File
Hi, Is it possible to extend java.io.File?javac (through Netbeans) gives me an error:cannot find symbol:symbol : constructor File()location: class java.io.Fileclass Dir extends java.io.File {1 errorBUILD FAILED (total time: 5 seconds)CheersLucas ufan100@gmail.com wrote:>Hi, Is it possible to extend java.io.File?Sure.>javac (through Netbeans) Learn Java, not (friggin') netbeans.>..gives me an error:So stop using it, and (please) stop whining.-- Andrew Thompsonhttp://www.athompson.info/andrew/Message posted via JavaKB.comhttp://www.javakb.com/Uwe/Forums.aspx/java-general/200707/1 uf...

java.io.BufferedWriter and java.io.PrintStream
Hi, I was just examining the SDK API and noticed this method in PrintStream: private void write(char buf[]) { try { synchronized (this) { ensureOpen(); textOut.write(buf); textOut.flushBuffer(); charOut.flushBuffer(); if (autoFlush) { for (int i = 0; i < buf.length; i++) if (buf[i] == '\n') out.flush(); } } } catch (InterruptedIOException x) { Thread.currentThread().interrupt(); } catch (IOException x) { trouble = true; } } I also noticed that there is no write method in BufferedWriter that takes a char array as its only argumen...

why cat *.java does list all java files
I tried using cat *.java to list all the files related to java but the file contents are printed on the console instead of only file names. CAn anybody tell me what happens when cat*.java is called ? Yadagiri Rao KP wrote: > I tried using cat *.java to list all the files related to java but the > file contents are printed on the console instead of only file names. > CAn anybody tell me what happens when cat*.java is called ? You meant echo *.java or ls *.java When you type cat *.java you are telling the shell to print the contents of all files ending in ..java. -- Eri...

java.lang vs java.util
Surprising to see something defined in java.lang <http://developer.android.com/reference/java/lang/Iterable.html> depend on something defined in java.util <http://developer.android.com/reference/java/util/Iterator.html>. Surely the hierarchy should go the other way? On 4/1/2011 9:11 PM, Lawrence D'Oliveiro wrote: > Surprising to see something defined in java.lang > <http://developer.android.com/reference/java/lang/Iterable.html> depend on > something defined in java.util > <http://developer.android.com/reference/java/util/Iterator.html>. > > Surely the hierarchy should go the other way? I think Iterable may make it into java.lang because of its significance in the foreach statement. Patricia On 04/02/2011 12:23 AM, Patricia Shanahan wrote: > On 4/1/2011 9:11 PM, Lawrence D'Oliveiro wrote: >> Surprising to see something defined in java.lang >> <http://developer.android.com/reference/java/lang/Iterable.html> depend on >> something defined in java.util >> <http://developer.android.com/reference/java/util/Iterator.html>. >> >> Surely the hierarchy should go the other way? Not if it wants to be consistent with http://download.oracle.com/javase/6/docs/api/ don't'cha think? And the so-called "hierarchy" of java.util and java.lang is that they are equal. The language reserves for itself the entire panoply of java.* and javax.* packages. > I think It...

How do I fix: "Incompatible type for constructor. Can't convert java.io.InputStream to java.io.Reader."
Hi, First, let me state "I am not a Java programmer.", but I need to write a Java stored procedure for use in an Oracle database instance. The code fragment I am having issues with is: Process p = Runtime.getRuntime().exec(cmd); BufferedReader r = new BufferedReader(p.getInputStream()); I have tried to understand the class hierarchy on java.sun.com, but I am lost. Can someone lend a hand, or point me to a source which will explain this to me? Thanks so much for your time. rr Ron Reidy wrote: > Hi, > > First, let me state "I am not a Java programmer.&qu...

Broken behavior of java.io.File()
I'm seeing several examples of broken behavior with java.io.File(): * mkdirs() sometimes returns false, despite succeeding (the directories exist afterward on the filesystem) * exists() and isDirectory() sometimes return false when called on a File object right after a mkdirs() after which the directory and its parents existed, as observed using Winblows Exploder. What is going on here? Is there even a way to test for the existence of a directory with 100% accuracy? Bah. My bad again -- the breakpoint was set on if(!dir.isDir()) { and not on the next line. So it was tripping when...

General use of java.io.File
I'm writing this routine that calls the length() member of java.io.File. Is this object generally available in most mainstream browsers, or do some of them lock it down? Hello, AFAIK, browsers would block Java File I/O by default. However this question is more relevant in comp.lang.java -- Elias "Jamie" <HeyJames_ca@hotmail.com> wrote in message news:355638ac.0312221932.4bb07e97@posting.google.com... > I'm writing this routine that calls the length() member of > java.io.File. Is this object generally available in most mainstream > browsers, or do some of th...

Matlab, java.io.File and the paths
Hi! I have a problem, working with Java file-objects in Matlab. When I create a file-object by an relative path like jFile=java.io.File('testDir\testFile.txt'); when I'm in the path C:\a\b\c\ to point to the existing file C:\a\b\c\testDir\testFile.txt. In some cases, the file don't point to that file, but to the file C:\q\w\testDir\testFile.txt. When I create another file-object by an relative path from another path (java.io.File('testDir2\testFile2.txt') in the directory D:\a2\b2\ to point to D:\a2\b2\testDir2\testFile2.txt), the command File#getAbsolutePath() show...

Extending java.io.File #2
Hi, excuse this silly question ... Are we permitted to extend java.io.File. javac (using Netbeans) gives me the following error: Hi - I think I'm making a basic mistake. cannot find symbol: symbol : constructor File() location: class java.io.File class Dir extends java.io.File { 1 error BUILD FAILED (total time: 5 seconds) Cheers Hi, ufan100@gmail.com wrote: > Hi, excuse this silly question ... > > Are we permitted to extend java.io.File. > > javac (using Netbeans) gives me the following error: > Hi - I think I'm making a basic mistake. > > cannot find...

run java mode for java.txt files...
i want emacs to be in java mode when i open file with *.java.txt suffix. How to do that? (i'll also need to do this for *.py.txt, *.pl.txt, *.scm.txt.) Thanks. Xah xah@xahlee.org =E2=88=91 http://xahlee.org/ Xah Lee wrote: | i want emacs to be in java mode when i open file with *.java.txt | suffix. | | How to do that? | | (i'll also need to do this for *.py.txt, *.pl.txt, *.scm.txt.) (setq auto-mode-alist (append '( ("\\.java.txt\\'" . java-mode) ("\\.py.txt\\'" . python-mode) ("\\....

non-java files with Java Web Start?
Can JWS handle updating non-java files as well as java? Part of a java program that I want to deploy has some .dll's for a browser component that I am using. Any info is appreciated. Thanks. Frank G. On Fri, 19 Sep 2003 22:33:38 -0400, Frank D. Greco <fgreco@REMOVEcrossroadstechNOSPAM.com> wrote or quoted : >Can JWS handle updating non-java files as well as java? >Part of a java program that I want to deploy has some .dll's >for a browser component that I am using. You can put the dlls in a jar, and use the nativelib tag in the JNLP file to get the contents put on ...

Charset names in java.io and java.nio
Hi guys, Why is character set Cp1047 known in java.io but not in java.nio.charset.Charset? Enclosed nio and io examples illustrate what I mean. Cheers, Vince NIO EXAMPLE public class NioTest { public static void main( String[] args) throws Exception { java.nio.charset.Charset.forName("Cp1047"); } } COMMENTS An exception is thrown: Exception in thread "main" java.nio.charset.UnsupportedCharsetException: Cp1047 at java.nio.charset.Charset.forName(Charset.java:486) at NioTest.main(NioTest.java:3) IO EXAMPLE import java.io.InputStreamReade...

java stored procedure java.io.IOException
Hello, i have a java stored procedure which read, write files. Since a few days i have problem if the file is greater 32K i get a java.io.IOException (write 32k is okay write next block with 16k -> Exception). I use sun solaris with oracle 8.1.7. There is enough space on the filesystem. I hope some one has an idea, Thanks. best regards Thomas ...

Non *.java files as java acociation in Eclipse
Hi, I'm using Eclipse and in project, that I'm working with use *.jcx and *.jws files, that are in fact regular *.java files. But I don't know, how to tell Eclipse to work with them as with regular java files (so that it provide syntax highlight, etc.). Can somebody help me? Thank you, Jindra On 2-8-2006 11:28, sarsonj@gmail.com wrote: > Hi, > > I'm using Eclipse and in project, that I'm working with use *.jcx and > *.jws files, that are in fact regular *.java files. But I don't know, > how to tell Eclipse to work with them as with regular java file...

Web resources about - java.io.File.getAbsolutePath() vs. java.io.File.getCanonicalPath() - comp.lang.java.programmer

Mocking External Services
Effective software development

How to take screenshots with Selenium WebDriver
If you want to take snapshots of the browser while running tests using Selenium Webdriver these are some ways to do it. Basically the only thing ...

Geek Reading August 13, 2014
... MarkupTemplateEngine - Javalobby How To Validate Your Business Idea By Testing A Hypothesis! - Hatchery Difference between getPath(), getCanonicalPath() ...

Resources last updated: 2/26/2016 3:39:41 AM