Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Path Of A FIle

Status
Not open for further replies.

benaam

Programmer
Jan 11, 2001
20
US
I am running my application from JWS(java work shop). I have put my source in c:/somedir. When i run my application from JWS it takes c:/Java-WorkShop20/jws/intel- win32/bin/ as the current directory instead my source code directory. SO i want to get the path of my source code(ie c:/somedir) at runtime. How to do this? If I run my application from a App Server will I get the above problem?

 
> get the path of my source code(ie c:/somedir) at runtime

File f = new File(".");
String spath = f.getAbsolutePath();
spath = spath.substring(0,spath.length()-1);
System.out.println("Current folder: " + spath);

> If I run my application from a App Server will I get the above problem?

An app server should provide a method to obtain paths of interest to your app server "appication". The method(s), might be / should be, part of the J2EE API. I don't know what they are.

Hope this helps
-pete
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top