Tuesday, December 02, 2014

Mac OSX Won't Acknowledge New JDK, Set Java Version

Java on OSX has always been much messier than Java on Linux.  The very way that Apple finds the current JDK is simply in-elegant and to be honest, quite ugly.  I've been shifting Java JDK's and JVM's back and forth for quite a while now in my dev machine and ran into this problem many times.  I tried using the System Preferences to set the default Java to 1.7.  It stated that it was 1.7 but every time I went back to the Terminal, I ran "java -version" and
got the old 1.6.  I tried everything!!  Nothing seemed to work as promised.

After some research, I found this little tidbit of help that worked.  It seems that there is a file installed with OSX that tells the OS what version of Java to use.  The file is a symbolic link to the location of the Java you want to use.

To find what version of Java you have, open the Terminal and type "java -version".  The output will be something like this:

java version 1.6
Java (TM) SF Runtime Environment (build 1.6.0_22-b11)
Java HotSpot (TM) 64-Bit Server VM (build 1.6.0_22-b11 - mixed mode)

OK.  So you have already installed Java 1.7 and tried to set the JAVA-HOME environmental variable, tried the System Preferences and nothing works?  Try this.

1. Install the new version of Java.

2. Open System Preferences and click on the Java icon. Open it up and make sure that Java 1.7 is selected.



3. Open up your Terminal and navigate to /System/Library/Frameworks/JavaVM.framework/Versions/ .  This is done by using the command "cd /System/Library/Frameworks/JavaVM.framework/Versions/".

There is a file there named "CurrentJDK".  This is simply a symbolic link to the Java home directory. Do not delete it, but do the following:

4. In Terminal, type "sudo mv ./CurrentJDK ./CurrentJDK_old". This simply renames the file in case something goes wrong.  To execute a command with sudo, you will be asked for your password. This is the admin password to your computer. Go ahead and enter it.

The CurrentJDK symlink was pointing to an older Java version. Removing this file (directories are actually "files" in Unix systems)  and create a new one pointing to the new Java JDK.  Since the current directory is owned by a privileged admin, you will need to use the sudo command.

5. In the Terminal, type "sudo ln -s /Library/Java/JavaVirtualMachines/jdk1.7.0_55.jdk/Contents/ ./CurrentJDK" 

6. In the Terminal, type "ls -la" to make sure your new file was created and the old one is there, renamed.  You should see something like this:


That is it!  You may delete the old CurrentJDK_old file if you wish to.  If you now type in "java -version", you should see the new Java.

If this worked for you, please consider sharing this on Facebook or Twitter.  

Monday, December 01, 2014

Some Neo4J Training Spots Still Available!

Neo4j's Graph Academy Training provides you with the required skills to be effective with graph data and productive with Neo4j. You will gain key modeling and implementation skills to tackle graph data management on Neo4j with ease. While the course is offered using Neo4J, chosen because it is the world's most popular Graph Database, the skills learned would be applicable to other Graph Databases.

I will be leading two courses in Vancouver, BC at Hot Tomali Headquarters on December 9th and 10th of 2014.  Every course attendees will be provided with food and coffee as well as soft drinks and course materials.

The courses are as follows:

Neo4j Fundamentals - Dec 9

Who should attend? Developers, Administrators, DevOps engineers, DBAs, Business Analysts and students.

Executives and others who want an overview of the Neo4j technology. Skills taught An understanding of graph databases Install and operate Neo4j Use the Neo4j development tools productively Exploit the strengths of the Labeled Property Graph model and the Cypher query language Build confidence in building a graph enabled application.

Prerequisites: Bring a computer (laptop) and be prepared to learn.

Register Now

Graph Data Modeling with Neo4j - Dec 10

Who should attend? Developers, DBAs, Business Analysts and students.

Skills taught An understanding of the labeled property graph How to apply the property graph to common modelling problems Common graph structures for modelling sophisticated, connected data scenarios Criteria for choosing between different modelling options.

Learn how to modify an existing model to accommodate new requirements.

Prerequisites You will need some familiarity with Neo4j and Cypher.

The material from the Intro to Neo4j course is sufficient knowledge to understand this course.

Register Now