Eclipse 3.7, Ant, Java 1.7 - java

I went through and uninstalled all Java from my computer. Then I installed JavaSE JDK1.7. I then modified Eclipse configuration so it would start and opened it up. I have an Ant script to build my project and I want to build my project against 1.7, but whenever I run the script, it says
'Launching PROJECT build.xml' has encountered a problem.
Specified VM install not found: type Standard VM, name jdk1.6.0_21
The installed JRE in Eclipse is 1.7 and nothing else. I cannot for the life of me find how to change what Ant is looking for.

This is because you still have the old JDK configured as JRE in the External Tools Configuration" in eclipse - open it via the arrow menu next to this button in the toolbar: , then change it to the Java 7 JDK.

In Eclipse, click the ant file -- Run As -- External Tools Configuration and click on the JRE tab.
Select "Run in the same JRE as the workspace"

Delete the "C:\Users\%USERNAME%\workspace.metadata.plugins\org.eclipse.debug.core.launches\%PROJECT_NAME% build.xml.launch file"
That solved problem for me.

Related

Eclipse Mars with m2e can not change java compile path

While trying to do a maven compile goal on a jar project in eclipse it failed stating that there was no java compiler found. It showed that it was using the path to jre1.8.0_45. My configured java build path in eclipse is using jdk1.7.0_80 and is configured for the correct corresponding environment.
I tried to rename the jre directory while eclipse was open but it showed that something had a lock on it, and sure enough it was eclipse that was launching with jre1.8. If I renamed the jre1.8 directory while eclipse was closed, then it would not launch again complaining that it cant find the java directory.
I guess what I'm getting at here is, is this a bug with Mars? Or am I missing something because everything in Eclipse is pointed to 1.7.
Thanks,
Nate
You should point Eclipse to JDK installation.
Window -> Preferences -> Java\Installed JREs
click Add -> Select Standard VM, Next ->
and then in text box "JRE home" you should put path to JDK home,
it's quite misleading..
BTW you should specify java version in maven-compiler-plugin. M2E plugin will then recognize this settings and configure compiler appropriatelly
http://www.gamefromscratch.com/post/2011/11/15/Telling-Eclipse-to-use-the-JDK-instead-of-JRE.aspx
It's the launch configuration of any m2e build that should point to a full JDK, cf. http://help.eclipse.org/mars/topic/org.eclipse.jdt.doc.user/tasks/task-choose_config_jre.htm?cp=1_3_5_2 (except you will be using a Maven Build configuration, rather than a Java Application).
For most other situations using a JRE should be perfectly fine.

Eclipse IDE started and broken - cannot find any Java classes

I haven't started my Eclipse Java EE Kepler in a while, and now it ended up with the following error on every project in my workspace:
http://i62.tinypic.com/30rsfgm.png
I'm not sure what happened here.
Due to a recent Java update, the JRE settings for the projects in Eclipse got unbound.
To fix this, one must set the current JRE on their computer as the JRE for the project library on the build path (This can also be found by going to the Problems tab, right clicking the error "unbound classpath container", then press Quick Fix):
http://i62.tinypic.com/5a438i.png
Then click on the JRE System Library, edit, and set it as an Installed JRE:
http://i58.tinypic.com/14vntqp.png

How do I add execution environment 1.8 to Eclipse Luna?

I have jre8 installed and set as the default for the jre but under compiler compliance I can't find 1.8 and under execution environment I can't find javaSE 1.8. I'm using the latest build of Eclipse EE.
I took a look at this manual
http://help.eclipse.org/luna/index.jsp?topic=%2Forg.eclipse.jdt.doc.user%2Ftasks%2Ftask-add_new_jre.htm
But I couldn't find any .ee files in my jre8 or JDK1.8 installation directories.
Open Preferences and look in 'Java > Installed JREs'. If you don't have a Java 8 shown there click 'Add...' to add it. Close the preferences.
Open Preferences again and look in 'Java > Installed JREs > Execution Environments', select 'JavaSE-1.8' and make sure your Java 1.8 is checked as the Compatible JRE
If the eclipse version is old as #mike stated in his answer then you would be unable to view the JavaSE-1.8 on the Execution Environments list in your eclipse; You can do the following to use it even on older versions:
Help --> Install New Software
Place the following URL --> http://download.eclipse.org/eclipse/updates/4.3-P-builds/
Install the plugins and restart eclipse.
Now if you have JDK 1.8 on your computer and added it as an installed JRE you'd be able to view and use JavaSE-1.8
Or just download and use the latest eclipse
Older versions of Eclipse might not work with javaSE-1.8
You need to find out what version of Eclipse you have by going into its help menu and clicking on About Eclipse.
If your version is older than the one at https://www.eclipse.org/downloads/
then you need to uninstall your older version and install the latest version.
I had the same problem with my Eclipse on Linux Mint. And the only way I could solve it was by following above instructions.

Can't get Eclipse to run with Java FX

Alright so basically, I'm trying to run Eclipse with JavaFX, but then it gives me this error:
You are not running your eclipse instance with Java7 or Java8. The JavaFX tooling is disabled because of this.Make Java7/8 the default system java or adjust your eclipse.ini to pass -vm pointing to your Java7/8 install.
In case you want to turn off this check open your preferences and go to General > Startup and Shutdown and uncheck 'JavaFX Tooling Java Check'
Now I know it isn't pointing to the right SDK, but I have no idea how to change it, since I'm kind of new to this this stuff. I've already downloaded JDK 7.40 as well. I'm also using Ubuntu on a virtual machine, if that even matters anyway. Can anyone help me, I'd appreciate it.
Pre-requirements:
Install Java™ 8.
Install Kepler SR2 (4.3.2) .
The Kepler is still not supporting Java8. What to do?
Open Eclipse
Help > Install New Software…
Enter the following URL into the ‘Work with’ field:
http://download.eclipse.org/eclipse/updates/4.3-P-builds/
Press ‘Enter’
Select category ‘Eclipse Java 8 Support (for Kepler SR2)’
Click ‘Next’
Click ‘Next’
Accept Licence Agreement
Click ‘Finish’
Now jre8 is correctly located.
Now configure JavaFx
Open Eclipse
Help > Install New Software…
Enter the following URL into the ‘Work with’ field:
http://download.eclipse.org/efxclipse/updates-released/0.9.0/site
Press ‘Enter’
Select category ‘Eclipse Java 8 Support (for Kepler SR2)’
Click ‘Next’
Click ‘Next’
Accept Licence Agreement
Click ‘Finish’
It looks like the default java on your system is not java7. What do you get when opening a shell and execute java -version? Solution is to:
A) make java7 the default java
B) start eclipse with -vm
Apparently, you have installed 32bit Eclipse and 64bit JRE/JDK on a 64bit OS. Please use 64bit Eclipse and the problem will be solved. Please make sure JAVA_HOME And JRE_HOME is present in environment variables.
I had the same issue. I tried re-installing Eclipse, but it wouldn't work. I had to completely remove the project and delete all the project files. After that, I re-started eclipse and created the project again. However, this time I made sure the project path included the Java FX library as shown in the screen shot.
Java Build Path
I did this while I was creating the project and then I was able to create the project without any issues. Give this a try.

Running Ant Build.xml getting: Java Virtual Machine Launcher: Could not find the main class. Program will exit

I am writing my code in eclipse, the code is running fine but when I try to build it in ant by running build.xml. I am getting
Java Virtual Machine Launcher: Could not find the main class. Program will exit.
Any suggestions?
if you are using java 1.6 and upgraded eclipse, it's more likely caused by eclipse the solution is to go to Run as → External tools configuration… → JRE where the default was set to “Separate JDK”: jdk1.6.0_31 and change this to “run in the same JRE as the workspace” (1.7/1.8), and it should works.
Bug fix would be to provide a working default configuration with setup. Configuration should be in a way it does not break if the user adds additional JDKs to Preferences.
for more details you can see Bug 472599
You need to verify few things
1) Is the path to java bin directory set properly?? (To check this you need to write command javac in command prompt(cmd) and you will get a list of instructions on cmd console) 2) Open the eclipse and go to Window-> Preferences-> Ant-> Runtime in the Classpath tab, see Ant Home Entries pointing to the wrong directory (it still points to the last directory, this directory does not exist) you have to do is to change the Ant Home pointing to the correct directory, to point Ant Home button select Ant Home directory, for example, I use Eclipse 3.3.1, Ant Home is the Eclipse plugin directory org.apache.ant_1. 7.0.v200706080842.
Right click on the build.xml file and select Run As --> External tool configurations --> Jre --> Select Run in the same JRE as the workspace.
If you are using Java 1.5 (that is, it is specified in your workspace, project or ant configuration as the JVM to use), it is also caused by a bug/feature in Eclipse: Java 1.5 is no longer supported. You need to upgrade to Java 1.6.
See: Eclipse bugs 421423
The version of ant you're using may not be compatible with the version of java you are using. I have ant 1.9.4 and was trying to run with java 1.4 and got this same error. Running with java 1.7 fixed it for me!
Error I was facing :
"Could not find the main class :
org.eclipse.ant.internal.launching.remote.internalAntRunner. Program will exit."
To compile my code with JDK 1.8, i have added external ANT to my eclipse, which was working fine. But compiling the code with JDK 1.6 with same ANT version was not working.
Solution : I restored the ANT in to its default value by selecting " Restore Default Entries " ( ANT --> Run as --> External Tools configurations --> classpath" ), after that ANT with JDK 1.6 is working fine.
Above error was happening for me when i added external ANT to my eclipse which was compatible with JDK 1.8 usage. Ant was working with JDK 1.8, the same was not working with 1.6 JDK. Once i restored ANT classpath settings to its default eclipse values which was JDK 1.6 compatable, above error was gone.

Categories

Resources