🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.language
Article #16907

Opening a file for reading specifying its relative location

#16907
From: asenator
Date: Thu, 31 Dec 1998 00:00
29 lines
1395 bytes
This is a very simple question :-)
I want to open a file while specifying its RELATIVE location rather
than ABSOLUTE location (that is specific to my machine).

The problem is that I can find  the file only when I specify  the
absolute loacation 9asssuming that the file's name is 'song')

f = new File ("d:/song");
  if (!f.isFile())
     throw new FileNotFoundException ();

If I don't specify the absolute location,like :
f = new File ("song") 
the file isn't found and an exception is thrown.
(The class resides within the same sub-directory where the file is.)

I tried all sotrs of forms like f = new File ("./song") ,in vain ...

What am I doing wrong when specifying the file and relative path ?

What is a safe approach when opening a file from an application or
from an applet that has permissions to open a file ?

In addition, I would be also glad if you can refer me to a good
article regarding that.
Thanks

Ari
asenator@hotmail.com
Technical Details
Message-ID: <368bf422.767343@forums.borland.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f74b3,dabc69fdecddc1b4,start
X-Google-Attributes: gidf74b3,public
From: asenator@hotmail.com
Subject: Opening a file for reading specifying its relative location
Date: 1998/12/31
Message-ID: <368bf422.767343@forums.borland.com>
X-Deja-AN: 427581320
Organization: Another Netscape Collabra Server User
Newsgroups: borland.public.jbuilder.java.language