I'm not sure how may people this applies to, but I ran into the case where some of my web application packages have both Java and JavaScript files. I use Eclipse, and wanted to be able to take advantage of Eclipse JavaScript Development Tools (JSDT) that provide rich JavaScript functionality within Eclipse. Unfortunately, JavaScript validation (e.g., catching syntax bugs) only occurs by default if you create a "JavaScript" project. Since many of these projects have both Java and JavaScript code, I had to work around this following these steps:
- Ensure you have JSDT installed
- Top Menu -> Eclipse -> About Eclipse -> Installation Details -> Installed Software
- Exit Eclipse
- Add the org.eclipse.wst.jsdt.core.jsNature:
- vim $ECLIPSE_PROJECT_ROOT/.project
- To the natures section, add
org.eclipse.wst.jsdt.core.jsNature - Open Eclipse
- Enable the preference: JavaScript -> Validator -> Errors/Warnings -> Enable JavaScript semantic validation
- Adjust the validation preferences as needed.
- It's usually a good idea to set all of the "Resolution" preferences to ignore.
I couldn't find this documented anywhere on the web, so passing it on here in case it's of use.