Configuring Java version for ANT in eclipse - java

In IntelliJ if I want to configure the version of Java my ANT script uses I can just right click and set the properites for ANT and select the JDK I want to use.
In Eclipse I don't see any such option. Do I need to hard code the version of Java into my Script or is there any way to tell ANT what version I want it to use?

You can do this in the Run Configuration. Right click your ant file ant select Run as -> Ant Build.... On the JRE tab you can switch to any JRE.
Maybe you have to add the concerning JRE to eclipse first by clicking Installed JREs... this opens the Eclipse preferences dialog where you can add it.

Related

Eclipse and Java Runtime Environment Portable

I want to run eclipse and java portable, for this i did the following steps:
Download and install Eclipse Portable
Download and install the Portable Java Runtime Environment
Open the Eclipse settings file ../EclipsePortable/App/Eclipse/eclipse.ini
Set the -vm as your portable Java installation at the beginning
Eclipse is running now, but when i want to add a new project, there is no Java Project.
Does anyone know how to fix this?
Taken from this answer, you need to do below steps
Go to "Help" -> "Install new software"
Select your eclipse version by clicking the small arrow next to "Add"
search for "java" in the search bar
Tick "Eclipse Java Development Tools" and hit finished.
after installation click on "restart eclipse"

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.

Groovy and grails jdk issue

I wish I could give you guys more information on what's going on, but I really have no idea. I am trying to install groovy and grails tools suite from springsource and I am having trouble configuring it to work properly. I have the most up to date JDK, and the preferences show it, but I still get warnings and it does not build. I have posted some pictures below to show what is going on.
on your GGTS go to window
select java
select installed JREs
add-> Standard VM
jRE home select directory up to C:\Program Files\Java\jdk1.6.0_18
select jdk1.6.0_18 from installed JREs
I faced a similar issue (I am sure it is the exact issue) - Here are the steps to ensure it works correctly, I struggled with initially but this got it going.
Install JDK from http://www.java.com ,in a directory where there are NO SPACES in the path
Set JAVA_HOME to your JDK installation
Ensure %JAVA_HOME%\bin; is in your PATH variable.
On the command prompt run java -version, it should give you the path where JDK is installed
Install STS Springsource Tool suite.
Run your STS and create a new grails project and run it.
Let me know if that does not work.
It might be that you are launching Eclipse with a JRE even though you have a JDK installed as one of the compilers in your workspace. To find out if you are launching with a JRE or JDK, go to Help -> About GGTS -> Installation details -> Configuration
Look for the -vm option and make sure it is a JDK not a JRE.

Can't locate JDK x64 in intellijIDEA

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

Categories