Can't locate JDK x64 in intellijIDEA - java

I am starting a new project, and the client requires us to work in IntelliJIdea. I installed it and tried to do the ant build. It turns our I need 64 bit jdk for the build. So I installed it. Now, however I need to configure it in IntelliJIdea. Here is the message I get:
JDK (1.6_x64) needed to run this ANT target is not configured. Please
update your settings in the Project | Libraries menu.
Can somebody help me locate this Project | Libraries menu menu please?

Press ctrl+alt+shift+s, and on the left hand side you'll see Project Settings -> Libraries.

Q: Where do I configure project JDK?
A: In the Project Settings dialog.
To add a JDK to project, press Ctrl+Alt+Shift+S, under Platform
Settings click JDKs and specify JDK path. After that, you can click
Project and specify which of JDK you have configured is used in the
current projects. Remember that JDKs are configured at IDE level, so
when you create another project, you won't need to add the same JDK
again.
reference :
http://www.jetbrains.com/idea/documentation/migration_faq.html

Related

Get the JDK version which is eclipse using to compile my current projects

I want to know which JDK is eclipse using to compile my current projects.
Is there a way to know that from eclipse itself.
Eclipse has its own Java compiler, it does not use the JDK compiler.
The 'Preferences > Java > Compiler' preferences set which language level the Eclipse compiler uses.
You can also override this for individual projects in the 'Java Compiler' Property page for the project.
The 'JRE System Library' setting in the 'Java Build Path' properties for a project determine which JRE is used for the Java system library Jar files.
Open the project and look next to its JRE System Library folder to see the version. For example in one project mine is JDK1.7.0_51. If that does not work, then right click on the project name, select Build Path/Configure Build Path and see the configured JDK version in the window that pops up. Each project can be independently configured to use a different JDK, but one of them is the default and that can be configured in the Configure Build Path app.

what broke up in my eclipse?

For some reason, whenever I create a new Java project, I can't compile anything and I get the following errors:
The project cannot be built until build path errors are resolved
Unbound classpath container: 'JRE System Library[OSGi/Minimum-1.2]' in project 'MyProject'
This didn't use to ever happen, and it used to be very easy to create new Java projects.
Open Properties by Right clicking on your project
Select Java Build Path
Under the Libraries, select JRE System Library under the Libraries.
Then click Edit...
select Alternate JRE under System library
If any, select JRE from the drop down and click finish
If none, click installed JREs...
Under installed JRE Types, select Standard VM, and click next.
Set your JRE home and JRE name and click finish.
Under the install JREs select your newly added JRE and click OK
After that, Repeat step 6.
1.Check whether JRE is properly installed in your system and it is added in Eclipse.
You can try re-installing JDK in your system and
Add JRE to Eclipse from Window -> Preferences -> Java -> Installed JREs.

JRE version is 1.6.0; version 1.7.0 or later is needed to run Google Plugin for Eclipse

I have 3 versions of Java installed on my system: 6, 7, and 8... I am required to have JRE6 available for a product my company develops, so I cannot get rid of it... But despite copying my Eclipse install to a new folder for another project I need to work on and removing JRE6 from this version alltogether, I still cannot get it to work.
How can I get the google plugin for Eclipse to work in my scenario?
If you have created a shortcut to start eclipse, you can add a parameter to tell it to use the jre of your choice like this -
C:\eclipse\eclipse.exe -vm "C:\Programs\jdk\jdk1.7.0_55\bin\javaw.exe"
I have used "javaw" executable from a jdk installation, but you may point to the same executable within a JRE installation as well.
This will resolve the error.
Keep in mind that there is a separation between the JVM that Eclipse itself is running in and the various JREs that you can configure in Eclipse to run your programs/applications. You need to specify to Eclipse what JVM you want it to run under, using eclipse.ini.
That's separate from the Installed JREs configuration you show in your screen shot above.
Add Java 7.0 to Eclipse if you haven't: Window -> Preferences -> Java -> Installed JREs.
Next add Java 7.0 library to your project: Right click on project -> Properties -> Java Build Path -> Libraries tab -> Remove JRE 1.6 and add New Library (JRE System Library, 1.7.0).
Last set Java 7.0 compliance level: Right click on project -> Preferences -> Java Compiler -> Compiler compliance level: 1.7
Also since you can use different Java to run applications, you also have to change this in the Run configuration which you use to start AppEngine related tasks.

How to change JDK version for an Eclipse project

I need to write a project that's only compatible with Java 1.5. I have Java 1.6 installed. Is there some form of backwards compatibility to get Eclipse to compile with 1.5?
Do I have to install Java 1.5 to get it to show here? Or maybe there is another way?
.
Click on the Add Library button. It brings your screen to point to the Java location.
Select "Directory", button right besides JRE home and point to the installed folder location.
Even though you want to just 1.5 compiler project, you can achieve it by changing compiler settings in Eclipse instead of removing 1.6 JRE and add 1.5 JRE.
GOTO -->JAVA--Compiler---> and change compiler level to `1.5` instead of `1.6`
As davidfmatheson suggested,
Just be careful, especially if you're setting this up for a team of people to work on. If anyone uses anything that is new or changed in 1.6, it will compile, but not run in an environment with JRE 1.5.
Click on the Window tab in Eclipse, go to Preferences and when that window comes up, go to Java → Installed JREs → Execution Environment and choose JavaSE-1.5. You then have to go to Compiler and set the Compiler compliance level.
Right click project -> Properties -> Java Build Path -> select JRE System Library click Edit and select JDK or JRE after then click Java Compiler and select Compiler compliance level to 1.8
If you are using maven build tool then add the below properties to it and doing a maven update will solve the problem
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
In the preferences section under Java -> Installed JREs click the Add button and navigate to the 1.5 JDK home folder. Then check that one in the list and it will become the default for all projects:
Eclipse - specific Project change JDK Version -
If you want to change any jdk version of A specific project than you have to click ---> Project --> JRE System Library --> Properties ---> Inside Classpath Container (JRE System Library) change the Execution Environment to which ever version you want e.g. 1.7 or 1.8.
The JDK (JAVA_HOME) used to launch Eclipse is not necessarily the one used to compiled your project.
To see what JRE you can select for your project, check the preferences:
General → Java Installed JRE
By default, if you have not added any JRE, the only one declared will be the one used to launched Eclipse (which can be defined in your eclipse.ini).
You can add any other JRE you want, including one compatible with your project.
After that, you will need to check in your project properties (or in the general preferences) what JRE is used, with what compliance level:
(source: standartux.fr)
See the page Set Up JDK in Eclipse. From the add button you can add a different version of the JDK...
As I was facing this issue minutes ago, in case you are trying to open an existing project in an environment with a newer JDK, make sure you pdate the JDK version in Project Properties -> Project Facets -> Java.

IntelliJ, Maven and Java 7

So I opened an existing project in IntelliJ 10.5 as a maven project. I had first added the JDK 7 to my list of SDKs in order to try out the features. However for some reason my mvn commands would fail, so I switched the maven runner back to 1.6. But I'm getting a weird error where some maven commands are still being run with Java 7.
In the Maven Projects view when I right click on a lifecycle in the module and select Run Maven Build everything works correctly, however when I select Run " clean" it still uses the 1.7 JDK. I have removed the JDK 7 from my list and now I get an error saying it can't find JRE '1.7'.
I honestly have no idea how to fix this, but if anyone has any suggestions that would be great.
In the Maven Projects panel press the Settings button (or open Settings | Maven | Runner).
Make sure that JRE is set to the existing JRE configuration (1.6).

Categories