Check this answer: Set CORS header in Tomcat
Note that you need Tomcat 7.0.41 or higher.
To know where the current instance of Tomcat is located try this:
System.out.println(System.getProperty("catalina.base"));
You'll see the path in the console view.
Then look for /conf/web.xml on that folder, open it and add the lines of the above link.