Showing posts with label eclipse. Show all posts
Showing posts with label eclipse. Show all posts

Monday, 27 May 2013

Hiding Javascript validation errors in Eclipse Juno

So you are working on a project that includes some third party Javascript libraries, and your editor is Eclipse (I'm on Juno, but no doubt this issue affects Indigo or even farther back...) - anyhow, you import the .js file into your nice clean project and bang! The Problems tab shows errors in the script

For example, I get errors with libraries like jquery.mobile-1.3.1.min.js
Syntax error on token "Invalid Regular Expression Options", no accurate correction available
and handlebars.js (1.0.0.rc4) raises three
Syntax error on token ",", delete this token
Syntax error on token ")", ( expected
Syntax error on token "]", delete this token
and of course the problem is not "real" - it is just Eclipse's implementation of the Javascript validator.

So if you are a braver coder than me you could edit these files and fix the issues and hope that doesn't break any other part of the library :/  OR you can suppress the errors in Eclipse.

However you don't want to suppress all Javascript validation because then you wouldn't see your own errors! (And I make plenty).  So here is how to exclude just the third party libraries...

1. You want to keep all your third party librarries in a different path to your own .js files - I use a js directory, below that I have a lib directory where jquery et al go.  So thats a path like
<PROJECT>/WebContent/js/lib/*
2. Right click on the Project, navigate thus Properties -> Javascript -> Include Path.

3. Click the Source tab, expand your WebContent node so you can see "Excluded".

4. Select Excluded, click the Edit button, then add an Exclusion pattern of
 js/lib/*
then click Finish, OK, then do a new build if one doesn't kick off automatically.

Now you should have no more phantom error reports from the third party libraries.

Tuesday, 7 February 2012

Fixing "Incompatible JavaHL library loaded" error on Mac OSX

So you use Eclipse on your Mac and you want to work with a Subversion version control system, so you installed Subclipse and everything seemed fine... and maybe it even used to work OK last time..., but now, today, when you need it most - you get an error that says:
Incompatible javaHL library loaded
and it probably says version 1.7 too.

Whats happening is that the subversion files you are trying to work with are at a more recent version than you have available locally. Here's how to fix it.

  1. Make sure you have latest Subclipse installed, go to the Subclipse site, click on Download and Install, grab the appropriate Eclipse update URL, then in Eclipse, go to Help, Install New Software, and add that URL as a new update site. After it loads, select everything it offers and finish the install. Here is the Eclipse update site for version 1.8
    http://subclipse.tigris.org/update_1.8.x
  2. Now we need to install Subversion client binaries on your machine, Collabnet don't have the latest but luckily UberSVN do, so go to the UberSVN download page, select the OSX tab, then click to download the Subversion Client 1.7.2. Note: it's not that big blue call to action button! It's the links below. Once you have the client, go ahead and install it.

  3. Quickly add Subversion to your path, I do this by editing ~/.profile and adding
export PATH=/opt/subversion/bin:$PATH
Restart Eclipse, and with an ounce of good fortune, Subversion and Subclipse now work again.

One last note: if, just like me, you found that big blue call to action button on UberSVN's download page just too tempting to resist... there is an unofficial (but seems to be written by a UberSVN's developer) Mac OSX UberSVN uninstaller script to tidy that up.
Worked a treat for me.