I am Getting Launch Error when I am trying to run java program in Eclipse IDE - eclipse

Problem : While I am trying to run java application on Eclipse I get Launch Error.
Warning : Build path specifies, execution environment JavaSE 1.8 There are no JRES installed in the workspace that are strictly compatiable with this environment.
Which is Giving "Launch Error"
I tried to set the system variables and path etc in envi variables. tried all ways but it still showing the Launch error

There are different versions of Java available. The "Execution Environment" (a section in the Eclipse Preferences under "Java" and "Installed JREs") specifies what version of Java is required. Your application is using an execution environment that specifies Java 8, or "jdk 1.8".
Besides installing Eclipse, you have to have an appropriate version of Java installed. Typically, Eclipse comes with its own Java installation. We can't tell what version of Eclipse you have. It's possible you have a very old version installed, which was released before Java 8 was released.
You can go to the following web site to get Java distributions for installation: https://jdk.java.net/8/
Once you install it, you can register that "Installed JRE" in the Eclipse preferences.

Related

Java Development Kit (JDK) is required rather than a JRE . creating welogic server

i am creating weblogic server in eclipse to deploy web dynamic project but i am facing problem "Java Development Kit (JDK) is required rather than a JRE"
creating weblogic server in eclipse
A JDK contains the javac compiler and other tools that a JRE doesn't contain. Maybe weblogic needs them.
You can download the JDK from http://www.oracle.com/technetwork/java/javase/downloads/index.html
Make sure you pick a version compatible with your weblogic server.
After installation, in Eclipse, open Preferences > Java > Installed JREs and add it (and maybe choose it as default).
It maybe necessary to choose it in Preferences > Java > Installed JREs > Execution Environments in the Execution Environment you use in you project, or directly in you project, or maybe in the run configuration you use.

Spring STS 3.7.2 "No Java virtual Machine Found" on Mac OS X Yosemite

I have been using Spring STS 3.7.2 for a few months on my Mac laptop (Mac OS X Yosemite 10.10.5). But suddenly the STS IDE is not starting up. I suspect that one of the automatic OS update may have changed something, since I noticed that I don't see java any more on my path setting.
I manually added the following entries to my .bash_profile and updated using source command:
export PATH=$PATH:/Library/Java/JavaVirtualMachines/jdk1.8.0_65.jdk/Contents/Home/jre/bin
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_65.jdk/Contents/Home
But STS stubbornly not working. It keeps giving me the error message in a dialog box:
A java runtime environment (JRE) or Java development kit (JDK) must
be available in order to run STS. No Java virtual machine was found
after searching ....
I am confused. I am able to invoke java from any terminal window, as well as JAVA_HOME environment variable is set.
Any ideas what may be going on?
After quite a bit of searching online, I figured out the problem, and resolved it for myself. It basically boils down to JDK upgrade to versions beyond 1.6.
The following link provided a solution:
https://apple.stackexchange.com/questions/178647/jdk-platform-not-recognized-running-eclipse-or-mvn
Here are the steps:
Revert back to JDK 1.6: Download and install JDK 1.6 from this Apple site: https://support.apple.com/kb/DL1572?locale=en_US
Change the PATH variable to point to the 'bin' directory of where JDK is installed. On my Mac, it was installed at: /Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/bin
Go to the STS application installed directory and run the command "open -a STS.app". This will open the STS IDE successfully.
Exit STS.
Now, if you want to use Java 8, then change the PATH variable to the Java 8 directory. On my Mac, it was at: /Library/Java/JavaVirtualMachines/jdk1.8.0_65.jdk/Contents/Home/bin
Launch the STS app again, and voila!, the problem solved.

ANT script error after installing newer version of JDK on my system

After installing the newer version of the JDK 6 (1.6.0_41) from 1.6.0_37, I went into Eclipse and updated the Installed JREs in the Java section under the preferences menu. I then went into my ANT script to test some changes I made and when I tried to run the ANT script I got this error:
Specified VM install not found: type Standard VM, name jdk1.6.0_37
The specified VM is not the jdk1.6.0_41. This has also been updated in the PATH and JAVA_HOME environment variables.
Any suggestions as to WHERE else to make a change so that ANT sees this?
Here is the error I'm getting:
Thanks.
After additional hunting around in Eclipse, I found in the ANT view an External Configuration Tools option when right clicking my Ant script name and under the JRE tab is where the setting was. I changed the setting to use the same JRE as the workspace and then all was fine.
Just in case anyone else ran into this same problem I thought it might be helpful to post my findings.
Ant won't mind the new jdk version as long as its name stays unchanged under Preferences / Java / Installed JREs.

GlassFish in Eclipse complains "GlassFish v3 requires a JDK 1.6 and not a JRE"

I am running:
Eclipse Java EE IDE for Web Developers.
Version: Helios Service Release 2
Build id: 20110218-0911
I have also installed Java EE 6 SDK Update 2 which includes:
GlassFish Open Source Edition 3.1
Java EE 6 Code Samples
Java EE 6 API Documentation
Java EE 6 Tutorial
Your First Cup: An Introduction to the Java EE Platform
I have registered GlassFish with Eclipse but when I try to start the server, I get the following error:
GlassFish v3 requires a JDK 1.6 and not a JRE. Please add/select the correct JDK in the Server properties 'Runtime Environment' section.
I have searched here for an answer but none so far seem to work. Can anybody suggest how I would sort this error out?
I had the same issue and actually i got the solution from this link ( The above answers really didnt gave me the solution
https://forums.oracle.com/forums/thread.jspa?messageID=7033028
1) make sure the jdk is installed. Look in C:\Program Files\Java\jdk1.6.XXXX (mine says 0_16). If that has stuff in it the jdk probably was installed, if not you can grab just the jdk from http://java.sun.com/javase/downloads/index.jsp
2) This is where the error message kinda foobars ya...
- Get eclipse started, ignore the message.
- Go to Window>Preferences
- Then under +Java+Installed JREs hit Add.
- Select 'Standard VM' then Next
- JRE Home = C:\Program Files\Java\jdk1.6.XXXX the rest should fill in automagically. Hit Finish.
- MOST IMPORTANT!!! Click the check box back in the Preferences Window for the new jdk runtime...I don't know why it's necessary, but it definitely is...
3)Still in Preference Window.
- Get to +Server, Runtime Environments
- Select the Glassfish SRE, hit Edit...
- From the JRE drop down grab the JDK and hit Finish
- Hit Okay.
4)Go to the Servers Veiw (probably down by the Console View).
Right click on the Bundled Glassfish...Server and hit restart/start...
Yes, you downloaded (or pointed Eclipse to) a JRE, but it needs a JDK. The latter has all the Java tools: javac.exe, java.exe, jar.exe, etc.
If you look at the directory where you told Eclipse to look for a JDK, you must see a /bin directory with those .exe files in it. If you don't, you know why the error message.
Make sure you downloaded a JDK and point Eclipse to it.
One more check: see if you can start Glassfish without Eclipse. You're ignorant of two things if you're learning both at the same time. Leave one unknown out of the equation until you can make Glassfish run on its own.
You need a JAVA_HOME environment variable. What's it pointing to? If you don't have one, create it.
For other people like me who still have a problem, try to be careful in your JRE Definition :
Don't use this : C:\Program Files\Java\jdk1.6.0_29\jre
but this : C:\Program Files\Java\jdk1.6.0_29
and Glassfish will eventually work.
It took me a while to find where this is configured in eclipse so I'll note it here for everyone:
Window menu > Preferences dialog > Server section > Runtime Environments subsection.

How is the Eclipse JDK setting affecting the system's JDK setting

I was trying to compile a Grails application referencing third party JARs on Mac OSX. Although my system's JRE and JDK is set to Java 1.6 I always got a Compilation error: java.lang.UnsupportedClassVersionError: Bad version number in .class file
when accessing classes in the JAR. Also when testing an existing Grails app the default stats of the app where showing that it's running with Java 1.6. So I really didn't have more ideas than to try to change the Java settings in Eclipse - I thought that's stupid as I'm not using Eclipse for the devlopment of this application - but voila - now the compilation of my app on the command line works just fine!
Can anyone explain me what Eclipse is doing here behind the scenes?
I've had set the JAVA_HOME manually before with no effect.
The JDK (JAVA_HOME) used to launched eclipse is not necessarily the one used to compiled your project.
To see what JRE YOU y 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: