Adriano Castro
Adriano Castro

Reputation: 1471

Add static folder to Tomcat in Netbeans

While configuring a maven application in Eclipse I can add a static folder to Tomcat Server. This static folder contains properties and config files used by the web application, even images and css files.

Unfortunatelly I can't move it to the web application resources folder because it's a legacy application.

My company is changing the IDE from eclipse to Netbeans and I'm concerned if there is a way to add this static folder in Netbeans's embedded Tomcat. Is it possible?

By the way, we're using Netbeans 7.1.2 and Apache Tomcat 7.0.22.0 with java 1.6.0_26.

Upvotes: 1

Views: 1482

Answers (2)

Adriano Castro
Adriano Castro

Reputation: 1471

I solved it by opening /conf/server.xml file and adding this line:

<Context docBase="C:/static" path="/static" reloadable="true"/>

Now, a file inside C:/static which name is test.jpg can be acessed through localhost:8080/static/test.jpg.

Thanks.

Upvotes: 0

stasha
stasha

Reputation: 11

Try: Tools -> Options -> Java -> Ant tab -> in the "Classpath" section add your static folder by clicking on "Add Directory" button.

Yesterday I had similar problem, and this worked for me.

Upvotes: 1

Related Questions