๐Ÿš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.api
Article #503

Re: current directory

#503
From: Alejandro Guzman
Date: Mon, 07 Jul 2003 17:32
66 lines
3432 bytes
Hi, I have a little problem using "User.dir" and getCanonicalPath. I'm using
TOMCAT, and I developed a web app (with JBuilder 6.0)  that have to read
information of a file. In my  computer when I call those function I get the
app directory, but when I run the App in the web server, I get other
directory (C:\WINNT\SYSTEM32)...
Does anybody know what wrong ??
What can I do ???

Thank in advance,
Alejandro.


"John McGrath [TeamB]" <ng-b@JPMcGrath.net> escribi๏ฟฝ en el mensaje
news:MPG.193dd750fc313c0598bfb6@newsgroups.borland.com...
> On Mon, 26 May 2003 12:35:42 +0300, terhi wrote:
>
> > is it possible to change the current directory of the application?
>
> No.
>
> > My java program prints to PDF-writer. PDF-Writer asks the path for
> > the pdf-file and changes the current directory to that location.
> > After printing, my java program's current directory has also been
> > changed to that given path and that couses problems. How can I
> > change it back? Current directory is different than "User.dir",
> > getAbsolutePath() and getCanonicalPath. I think it is some how
> > kept in the memory.
>
> Windows keeps track of that and I think using the Windows file open
> dialog can change the setting.
>
> I think it is generally not a good idea write code that depends on the
> current directory.  Instead, get the value of "user.dir" when you start
> the application and then explicitly specify that on all file opens.
> You will save yourself a lot of trouble that way.
>
> > I have tried to use Dos commands, but they did not work.
>
> That would change the current directory for the sub-process, but not
> for the process that spawned it.
>
> > Should I try to use win32 api functions from java? Is that the
> > only way?
>
> That would be the only other choice besides writing your code to not
> depend on the current directory.
>
> > Is it even possible?
>
> It should be using JNI.
>
> > Can I use them directly from the java code without creating a
> > c-code where to call win32 api?
>
> No, you will need to write a JNI wrapper.  Of course, it is possible
> that someone has done that already, so you might avoid writing the code
> yourself.
>
> --
> Regards,
>
> John McGrath [TeamB]
>
> ---------------------------------------------------
> Before sending me e-mail, please read:
>     http://www.JPMcGrath.net/newsgroups/e-mail.html
Technical Details
Message-ID: <3f09af43@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-01!sn-xit-08!supernews.com!news.tele.dk!news.tele.dk!small.news.tele.dk!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <3ed1dfee@newsgroups.borland.com> <MPG.193dd750fc313c0598bfb6@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII
X-Google-Thread: 1089d0,d0bad3e1a5d1d949
X-Google-Attributes: gid1089d0,public
X-Google-ArrivalTime: 2003-07-07 10:40:15 PST
From: "Alejandro Guzman" <aeguzmanv@hotmail.com>
Newsgroups: borland.public.jbuilder.java.api
References: <3ed1dfee@newsgroups.borland.com> <MPG.193dd750fc313c0598bfb6@newsgroups.borland.com>
Subject: Re: current directory
Date: Mon, 7 Jul 2003 13:32:57 -0400
Lines: 68
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.50.4807.1700
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
NNTP-Posting-Host: 64.241.170.26
Message-ID: <3f09af43@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1057599299 64.241.170.26 (7 Jul 2003 10:34:59 -0700)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-01!sn-xit-08!supernews.com!news.tele.dk!news.tele.dk!small.news.tele.dk!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail