No JDK specified error message for maven project.
已回答
Hi,
I've just imported a new maven project but can't run any of the goals.
I get a Run Error dialog that says "Error running jboss-seam-booking-parent [test]: No JDK specified".
I'm not sure what this error message means as I have a valid JDK configured for the project. Is there somewhere else that I need to specifiy a JDK for?
Thanks in advance.
John
请先登录再写评论。
I hope you've managed to figure it out by now. If not, try setting the environment variable JDK_HOME and JAVA_HOME to the directory where your JDK is installed. I use Ubuntu 8.04 with bash as my shell so mine is set to (in my $HOME/.profile):
export JDK_HOME=/usr/lib/jvm/java-6-sun
export JAVA_HOME=$JDK_HOME
After you do this, make sure that you are able to view these environment variables from an xterm or a DOS window (if you're using MS-Win) and then restart IntelliJ.
Also, inside IntelliJ, you should set your JDK if these settings don't get picked up by IntelliJ. Use ctrl-alt-shift-S and then select JDKs in the left panel. In the right panel, configure it accordingly (select the directory where the JDK is installed on your box). I'm attaching a screenshot to give you some perspective. Hopefully it's useful. All the best.
Attachment(s):
Screenshot-Project Structure.png
Hi Viraf,
Thanks for your reply.
Unfortunately, your suggestions have not worked.
I am running on Mac OS X. My maven project works fine from bash, but not in idea.
I had the JAVA_HOME environment variable set already but not JDK_HOME. I set JDK_HOME to point to my jdk installation but this made no difference.
In Idea, I have my project JDK set to my jdk 1.6 installation and all my modules inherit this setting.
I really can't think why this isn't working and can't figure out why Idea gives "No JDK specified" when there definitely is a JDK specified for the project.
Any other suggestions/help would be much appreciated.
Thanks,
John
John:
Can you please post a sample project (zip file which includes Maven POM) with just one class so I can try to reproduce this problem. Unfortunately I don't have access to Windows or Mac. Both my machines at home (desktop and laptop) are powered by Ubuntu Linux.
Ensure that your maven plugin for IntelliJ is configured correctly:
Navigate to File > Settings
Select Maven under the Project Settings section of the tree menu
Select Runner from the Maven subgroup
Select the appropriate JRE or environment variable pointing to one
Navigate to File -> Project Structure
Select the appropriate value under "Project SDK"