Search code examples
javaeclipsetomcatenterprisecontextpath

Eclipse, Tomcat project context root is eclipse folder


I'm having a little problem configuring my Tomcat Project. In short, I'm working on a Dynamic Web Page project but there seems to be some confusion as to from where I am running the application.

Running the following code

File f = new File("");
System.err.println(f.getAbsolutePath());

yields the output C:/Eclipse which happens to be where I run Eclipse. Normally I'd expect this to be the output catalog, but it is not the case this time.

My eclipse project is configured to have myProject/WebContent/WEB-INF/classes as output folder

How can I configure to the desired directory? Right now I need to use absolute paths which won't work for all members of the project.


Solution

  • Alright, I found a solution.

    It seems my default working directory was set to my eclipse folder for the project so i solved it by specifying the project root folder instead which normally is the case.

    I configured this here:

    Run configurations > Apache Tomcat Run configuration > Arguments tab, under "working directory" choose "other" and specify directory.

    Thanks for your comments!