0

This may sound like a dumb question.

I received a (basic) web application developed by another person, using HTML and JavaScript. In this application he used his JavaScript file path as /javascripts/_FileName_.js. But when I tried to run it on a Tomcat (8.5) server, those JavaScript files didn't executed. But when I changed the path to javascripts/_FileName_.js (Without the / at the beginning), it worked fine.

This application was already ran in a server and it worked fine. What has to be the problem here ?

ThisaruG
  • 2,382
  • 5
  • 34
  • 50

1 Answers1

0

as @duffymo described in comments, the leading slash tells tomcat to start looking for that file at the root of the application context, which is the webapps folder in tomcat. But if we remove that leading slash, it searches for the file from the current folder.

That was the problem. I am posting this as an answer because he mentioned these in comments only.

ThisaruG
  • 2,382
  • 5
  • 34
  • 50