Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Obtaining directory from with the source file

Reply
Thread Tools

Obtaining directory from with the source file

 
 
mshetty@mail.com
Guest
Posts: n/a
 
      01-17-2007
Hi,

We are new Java. We have a hierachy <Inst Dir>/CNV/src/com/xyz/abc for
the source code and <Inst Dir>/CNV/lib/com/xyz/abc for the class files.
The jars are created in CNV. There are some shell scripts in CNV to
execute the class files.
We want to do the following:
1. Create logs in CNV.

The <Inst Dir> could vary from one installation to another. Is there a
way of finding out this path from the java file in <Inst
Dir>/CNV/src/com/xyz/abc

Thanks and Regards,
M Shetty

 
Reply With Quote
 
 
 
 
Andrew Thompson
Guest
Posts: n/a
 
      01-17-2007
http://www.velocityreviews.com/forums/(E-Mail Removed) wrote:

> ..We have a hierachy .. <Inst Dir>/CNV/lib/com/xyz/abc for the class files.

....
> We want to do the following:
> 1. Create logs in CNV.


That is not a good place to put the logs.

A better place might be something like..
{$user.home}/com/xys/abc/ourapplication.log

Or, better yet, let the user choose the location for
themselves, and simply store a string naming the
path to it, in..
{$user.home}/com/xys/abc/logpath.txt

Andrew T.

 
Reply With Quote
 
 
 
 
Manish Pandit
Guest
Posts: n/a
 
      01-18-2007

Andrew Thompson wrote:
> (E-Mail Removed) wrote:
>
> > ..We have a hierachy .. <Inst Dir>/CNV/lib/com/xyz/abc for the class files.

> ...
> > We want to do the following:
> > 1. Create logs in CNV.

>
> That is not a good place to put the logs.
>
> A better place might be something like..
> {$user.home}/com/xys/abc/ourapplication.log
>
> Or, better yet, let the user choose the location for
> themselves, and simply store a string naming the
> path to it, in..
> {$user.home}/com/xys/abc/logpath.txt
>
> Andrew T.


I completely agree with Andrew.

Log files do not belong in the application directory - almost always
there is a separate path (often separate drive which gets backed up,
etc.) for logs. Anyway, if you still insist on putting the logs in
installation folder, try this :
new File(".").getAbsolutePath( );
to get the "current" location as seen by the class calling this API.
Take a look at java.io.File API, there are methods to get parent
folder, etc. in there.

-cheers,
Manish

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
System.IO.Directory.GetDirectories() and System.IO.Directory.GetFiles() are not returning the specified directory Nathan Sokalski ASP .Net 2 09-06-2007 03:58 PM
Obtaining source for 1.8.5 and 1.9? znmeb@cesmail.net Ruby 1 08-07-2006 02:18 PM
Portable way of obtaining current working directory...... Shaun Heveron C++ 6 10-28-2004 12:06 AM
Obtaining Webpage Source with Python Ryan Kaskel Python 4 06-24-2004 10:37 PM
is there a way to "include" source file B.html in source file A.html? Cloud Burst HTML 11 01-09-2004 02:49 AM



Advertisments