[java-dev] [Fwd: A strange error...]
Siska Ádám
sadam at startvox.hu
Sat Jun 30 13:26:32 MDT 2007
- Previous message: [java-dev] A strange error...
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Some info I figured out in addition:
If I put the file named in Constants.SETTINGS_FILE to the root folder of
the filesystem, everything works fine in mxj. So it seems that it's
seeking for the file in the root folder (if only the file name is
specified). Now there are two things that I dont understand with this.
1) Before the code supplied in my prior post, there is a part in my
program that sets the current directory with System.setProperty (
"user.dir", newPath ) to the default path of Max with
MaxSystem.getDefaultPath() (actually I removed the last slash from the
output of getDefaultPath(), because System.setProperty expects a path
without the ending slash). So, how is it possible that after this, the
program tries to get the file from the system root, and not from the
default path recently set?
2) Before I put the file in the root folder, I got the "doesn't exist"
error message with the canonical path set to the current default path,
in my case:
* error: /Users/admin/Music/MaxMSP/Test/settings.xml: Doesn't exists!
Now, how is it possible, that the File variable returned the above path
by invoking getCanonicalPath(), but actually it was seeking for the file
/settings.xml?
I'm not sure if this problem should be really posted to this list, maybe
these problems are much more related with the java.io.File class. But
these errors only happen to me when running the class from mxj.
Thank you,
Adam
-------- Original Message --------
Hello Everyone,
I'm getting some very strange error, and I have no idea what can cause
it. I'm trying to open a file with the following code:
File settings = new File ( Constants.SETTINGS_FILE );
if ( ! settings.exists ( ) ) {
System.err.println ( settings.getCanonicalPath ( ) + ": Doesn't
exist!" );
}
if ( settings.canRead ( ) ) {
( ... )
( ... )
( ... )
}
Now, if running this from Eclipse, everything works fine, I get the file
and I can do the operations standing after the canRead() test. But, if
running the same code from mxj, I get the "Doesn't exist" error. The
funny is, that the filename returned with getCanonicalPath() points to a
file in my filesystem that exists! And I'm sure it exists, because the
same code in Eclipse should point to the same file, I suppose (and also
because I looked it 100 times in Finder, and there are no misspellings
in the file name).
Do you have any ideas?
Thank you,
Adam
________________
Siska Ádám
+36 (70) 207-63-85
http://apocalypse.rulez.org/~sadam
--
________________
Siska Ádám
+36 (70) 207-63-85
http://apocalypse.rulez.org/~sadam
- Previous message: [java-dev] A strange error...
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
