Your JAVA_HOME is invalid

I’m having the same issue. I still get the following messages after i’ve got everything setup:
Error: Failed to run “javac -version”, make sure that you have a JDK installed.
You can get it from:
Your JAVA_HOME is invalid: /Library/Java/JavaVirtualMachines/jdk1.8.0_102.jdk/Contents/Home

I have tried many versions of jdk and node and there was no success. Does this have anything to do with /System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK being pointed to /Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents in El Capitan?

Could anyone please point me to the right direction?

This is my ionic info:

Cordova CLI: 6.3.0
Gulp version: CLI version 3.9.1
Gulp local:
Ionic Framework Version: 1.3.1
Ionic CLI Version: 1.7.16
Ionic App Lib Version: 0.7.3
ios-deploy version: Not installed
ios-sim version: 3.1.1
OS: Mac OS X El Capitan
Node Version: v4.4.7
Xcode version: Xcode 7.3.1 Build version 7D1014

Many thanks

Add Java JDK and JRE path to default path folder and also set JAVA_HOME system variable with correct path in your system.
To verify open any drive other than C: in command prompt and execute java -version command to check if every thing is set properly