Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / March 2008

Tip: Looking for answers? Try searching our database.

file.getAbsoluteFile()

Thread view: 
zamba - 25 Mar 2008 18:29 GMT
Hi .. im working under SOLARIS, and i have this problem,....

when i write file = new File("/sgcv10/test","testing.xml"); and then i
do

file.getAbsoluteFile(); -> this shous me /usr/bin/ /sgcv10/test/
testing.xml ,,,,

i need to show /sgcv10/test/testing.xml   running under windows work
fine.....how can i do ????

Thanks everybody !!!!!!
Andrea Francia - 25 Mar 2008 18:38 GMT
> Hi .. im working under SOLARIS, and i have this problem,....
>
[quoted text clipped - 6 lines]
> i need to show /sgcv10/test/testing.xml   running under windows work
> fine.....how can i do ????

Are you sure that the "/usr/bin/ " part is not a spurious output of a
previous System.out.print(...) ?

Try this:
System.out.printf(">%s<%n", file.getAbsoluteFile().toString());

Also try to break your code:

  dir = new File("/sgcv10/test");
  file = new File(dir,"testing.xml");

  System.out.printf(">%s<%n",dir.getAbsoluteFile().toString());
  System.out.printf(">%s<%n",file.getAbsoluteFile().toString());

Signature

Andrea Francia
http://www.andreafrancia.it/

zamba - 25 Mar 2008 18:47 GMT
On 25 mar, 14:38, Andrea Francia
<andrea.fran...@gmx.ohohohioquestoèdatogliereohohoho.it> wrote:
> zambawrote:
> > Hi .. im working under SOLARIS, and i have this problem,....
[quoted text clipped - 24 lines]
> --
> Andrea Franciahttp://www.andreafrancia.it/

Andrea...first of all thanks for quick answer...when i said "to show"
mi real problem is  :

IN ONE METHOD CALLED getFile I HAVE

new File("/sgcv10/test","testing.xml")

return file.getAbsoluteFile()

IN ANOTHER METHOD

fileNotice = getFile()
writer = new PrintWriter(new BufferedWriter(new FileWriter(fileNotice),
9600),true);

this writes me the file under "/usr/bin/ /sgcv10/test/
testing.xml" ..of course i dont wanna this ....
Roedy Green - 25 Mar 2008 20:15 GMT
On Tue, 25 Mar 2008 10:47:15 -0700 (PDT), zamba
<CRISTIAN_FERRERO@hotmail.com> wrote, quoted or indirectly quoted
someone who said :

>i dont wanna this

ESL creates enough complications as it is. Please don't make it doubly
difficult with informal language and text speak.

See http://mindprod.com/jgloss/textspeak.html

Signature

Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com

Andrea Francia - 25 Mar 2008 20:32 GMT
> Andrea...first of all thanks for quick answer...when i said "to show"
> mi real problem is  :
[quoted text clipped - 13 lines]
> this writes me the file under "/usr/bin/ /sgcv10/test/
> testing.xml" ..of course i dont wanna this ....

Tip 1:
Is difficult help you if you don't post a SSCCE [*].

Tip 2:
Put some diagnostic code in your code to see if what happens is what you
think should happen.

In other words put in your getFile() method statements like the followings:

 System.err.println("file:" + file.toString());
 System.err.println("file abs:" + file.getAbsoluteFile().toString());

And check that result is that you expect.
When you found some unexplainable behavior produce a SSCCE that
reproduce the situations and try to ask in the newsgroup or (better)
check and double check the documentation about the methods your are using.

[*] http://mindprod.com/jgloss/sscce.html

Signature

Andrea Francia
http://www.andreafrancia.it/

Lew - 26 Mar 2008 02:47 GMT
>> Andrea...first of all thanks for quick answer...when i said "to show"
>> mi real problem is  :
[quoted text clipped - 16 lines]
> Tip 1:
> Is difficult help you if you don't post a SSCCE [*].

or even valid Java code in the snippets.

Signature

Lew



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.