If you run Tomcat from said folder (C:\Program Files\Apache Software
Foundation\apache-tomcat-7.0.22\) all u need is to find the current
working directory.
I think System.out.println(new File(".").getAbsolutePath()) will print
the working directory. It will have the "." at the end (at least in
windows), remember to remove it.
On 10/11/2011 1:28 PM, Paul Joseph wrote:
Hi Andy,
Thank you very much for your crystal clear explanation, I get it now.
Following your suggestion, I traced back the code and find that the
function below is the culprit. I wrote it in an attempt to return the
"root directory" of the Tomcat application, and it has somehow managed
to work in 32 bit Tomcat over numerous installations.
i.e. the function below, typically returns: "C:\Program Files\Apache
Software Foundation\apache-tomcat-7.0.22\", but is not working
apparently for this present 64 bit install, though on looking at it
after seven years, I must say I wonder how it has worked so long.
Is there a more direct way to get this same info.? Once I get this
string, I simply tack on the remaining part of the path to where I
would like to write the file.
Thanks much!
Paul
private static final String FILE_SEPARATOR = File.separator;
private String getRootDirAbsolutePath() {
SystemUtils systemBean = new SystemUtils();
String javaClassPath = systemBean.JAVA_CLASS_PATH;
String osName = systemBean.OS_NAME;
if(osName.equals("Linux")){
int index = javaClassPath.lastIndexOf(":");
javaClassPath=javaClassPath.substring(index+1,
javaClassPath.length());
}
String oneDirUp =
javaClassPath.substring(0,javaClassPath.lastIndexOf(FILE_SEPARATOR));
String twoDirsUp =
oneDirUp.substring(0,oneDirUp.lastIndexOf(FILE_SEPARATOR));
String rootDirAbsolutePath = twoDirsUp + FILE_SEPARATOR
return rootDirAbsolutePath;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@cocoon.apache.org
For additional commands, e-mail: users-h...@cocoon.apache.org