Showing posts with label intellij. Show all posts
Showing posts with label intellij. Show all posts

Monday, March 30, 2015

Failed to open or import Maven project in IntelliJ IDEA

I'm using IntelliJ IDEA 14 on Mac OSX Lion and I hadn't had any problems with opening or importing Maven projects before I updated Java from 1.6 to 1.8. The IDE started successfully but every time I opened or imported an existing Maven project, a popup appeared to display the progress of opening or importing process for a short time but after that nothing happened. Then, I opened the Console application and I see the log message below:
3/31/15 1:05:18.637 AM [0x0-0x8d38d3].com.jetbrains.intellij.ce:   Referenced from: /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/bin/java
3/31/15 1:05:18.637 AM [0x0-0x8d38d3].com.jetbrains.intellij.ce:   Reason: image not found
It means that IDEA was still using JDK 1.6 and it no longer existed on my machine after the update. I solved the problem by telling it to use the JDK 1.8 instead when starting and building projects. To do it, I did as followings:

1). Open the IDEA's configuration file:
open -e /Applications/IntelliJ\ IDEA\ 14\ CE.app/Contents/Info.plist 

2). Update the following key
<key>JVMVersion</key>
<string>1.7+</string>
I have both JDK 1.7 and 1.8 on my machine.

3). Restart the IDE



Reference

https://devnet.jetbrains.com/docs/DOC-197