Multiple JRE issue

I recently switched from JDeveloper to Intellij. I am trying to port all my projects to Intellij Idea 9.0.2. I have some 1.4.2 Java projects as well as 1.5/1.6 projects. I think I started porting with 1.4.2 projects. Now with 1.5+ whenever I try to run my run-configuration, the IDE throws an error message:
Run Error: Cannot Find JRE 1.4

However, this does not happen 100% of my 1.5+ projects. After playing with SDK version selections, I have got some 1.5+ projects running fine. Now I am completely on 1.5+ projects and I very often run into this issue which very annoying. Any idea on how to get rid of this error?

Thanks,
Arvin

3 comments
Comment actions Permalink

I'm not able to reproduce that error message. But it sounds like some of your projects are not configured to use the correct JDK. Are the projects that are not working using the same JDK definition (not necessarily the JDK,  but the JDK definition in IDEA) as the projects that are working? Also check the module(s) associated with the project (File Project Structure | select Modules (on let) | Dependencies tab) and make sure the module SDK is set to either the Project SDK or a correct valid JDK definition.

You may want to look at creating a fresh new JDK definition (on the "SDKs" panel in the Project Structure dialog)  for each version of Java you are using. Make sure the definition points to a valid JDK installation that has the jre directory present in it. Then change your projects, to use the new definitions. Then delete the old ones.

Also, once you have a good definition, you can change the definition used by default by changing the project Template. Go to File | Settings | Other Settings | Template Project Structure. Select "Project" on the left and then set the Project SDK to a good definition. That will become the default definition used. Also be sure to update the "Project Language Level" as needed.

Hope that helps.

0
Comment actions Permalink

Thanks for the response. I had to go to each module individually and re-confirm my JDK and JRE-Maven-Runner (I forgot to mention about Maven in the question previously which was also causing my problem) versions that I need. Now I don't get the error I was getting previously. But I still feel the JDK version set for the project should have been picked up in Maven runner as well without having to reconfirm in the settings dialog.

0
Comment actions Permalink

Hello Arvin,

I'm glad to hear your problems have been resolved. Note that you can set the default Maven Runner JRE used when a project is created by going to File | Other Settings | Template Settings, on the left select Runner under Maven and then set the JRE to use. If you set this setting to the same setting as the same value as the value as the default JDK used in the Template Project Structure settings (as I mentioned in the previous response) your new maven projects will then run under the same JRE as your project. There is not an option to set the Maven Runner JRE to "Project JDK" or such. But that might be a good option to request be added. You can open feature requests at http://youtrack.jetbrains.net if desired.

Best Regards,
Mark

0

Please sign in to leave a comment.