path problem in tomcat

D

db

Hallo@all

I got a problem with Tomcat. I am developping a web service based on
jsf, and using tomcat as container.

My problem is if i start Tomcat in Eclipse, the default root path is
D:\Programme\Apache Software Foundation\Tomcat 5.5\webapps\myproject

however if i start tomcat through tomcat configuration directly, the
default root path changed to D:\Programme\Apache Software
Foundation\Tomcat 5.5\

Since in my program there are files are written and read, the path is
important. And i need to debug the code under eclipse. I can not change
the pathes each time when i switched back to eclipse.

I hope u understand what i mean. That must be a configure problem, but
i just can not figure it out.

I know the answer may be only several words, but plz dont save them, i
need them urgently!

Thanks!

db
 
J

Juha Laiho

db said:
I got a problem with Tomcat. I am developping a web service based on
jsf, and using tomcat as container.

My problem is if i start Tomcat in Eclipse, the default root path is
D:\Programme\Apache Software Foundation\Tomcat 5.5\webapps\myproject

however if i start tomcat through tomcat configuration directly, the
default root path changed to D:\Programme\Apache Software
Foundation\Tomcat 5.5\

Please clarify what you mean by "default root path"? Just "current
directory"/"default directory", or something else?

If you just mean that the default directory changes, then I have an
easy answer: don't use the default directory for anything.
Since in my program there are files are written and read, the path is
important. And i need to debug the code under eclipse. I can not change
the pathes each time when i switched back to eclipse.

I think you could use ServletContext.getRealPath() to properly handle
different directory layouts; see:
http://java.sun.com/j2ee/sdk_1.3/te...letContext.html#getRealPath(java.lang.String)
 
D

db

what i mean is if i attach a piece of code inside the bean, like
.....getRuntime().exec("pwd") to show the current path, the result is
different with start tomcat from eclipse or start it directly.

thanks for replying

db
 
J

Juha Laiho

db said:
what i mean is if i attach a piece of code inside the bean, like
....getRuntime().exec("pwd") to show the current path, the result is
different with start tomcat from eclipse or start it directly.

Yep, in that case you'd be much better off with picking the paths
in the way I described.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,074
Latest member
StanleyFra

Latest Threads

Top