Java Runtime Environment not found error when I open an application - java

I have Windows 7 64bit OS Installed on my laptop... When I open an application an error occurs:
"Java runtime environment not found"
in an error dialogue box.
I have tried to solve the issue by re-installing of JRE and Java. But error remain same.
Can somebody help me out.
Thank You.

There are couple of applications which are developed in Java and they run on JRE x86 and couple of them need JRE x64. Don't think too much on this, simply install both versions of JRE i.e JRE x86 and x64. I am sure that will fix the issue

You should check your "Path" environment variable. Try opening a command prompt and checking to see if it's finding java.
java -version
You could also try running your software via a *.bat file to make sure it's looking in the right place, as follows:
#echo on
SET PATH=C:\Program Files\Java\jre7\bin
java -jar MySoftware.jar
PATH
#echo off

Related

Eclipse finds Java from CMD prompt but not from desktop click

I have multiple versions of Java installed on Windows 7 Home Premium 64-bit system. In order to install
Eclipse Java 2018-12
I have had to install the Java 11 JDK from the Oracle website. Despite setting JAVA_HOME and updating PATH in environment variables the only way to install and also run this version of Eclipse was to open a command prompt and
C:>set path=c:\program files\java\jdk11.0.1\bin
and then run Eclipse installer or installed instance.
The problem persists if I reboot my computer.
I want to be able to start eclipse by simply clicking on the desktop icon link.
The error I get when I try to run eclipse from the desktop link is:
Version 1.7.0_79 of the JVM is not suitable for this product. Version 1.8 out greater is required.
My C:\Program Files\Java\
contains folders
jdk1.0.7_79
jdk-11.0.1
jre7
I think I need all of these because I have some programs which I think retire java 7 so I don't think uninstalling java 7 is an option and don't think java 11 would replace it, or should I just get rid of java 7, is that what's causing the problem despite environment variables set correctly?
How can I fix this problem?
Thanks.
Add c:\program files\java\jdk11.0.1\bin to your Windows Environment PATH
The system was running C:\Windows\System32\javaw.exe
I fixed it by adding the Java 11 bin directory at the beginning of the Path environment variable instead of at the end of the string, separated by a semicolon.
First set JAVA_HOME then update path in environmental, refer screenshots attached.

Eclipse Kepler, Java was Started but returned Exit code=13 [duplicate]

I am trying to get my first taste of Android development using Eclipse. I ran into this problem when trying to run Eclipse, having installed version 4.2 only minutes ago.
After first trying to start Eclipse without any parameters to specify the Java VM, I got an error message saying it couldn't find a Java VM called javaw.exe inside the Eclipse folder, so I found where Java was installed and specified that location as the parameter in the shortcut's target. Now I get a different error, Java was started but returned exit code=13.
Similar questions seem to indicate that it's a 32-bit/64-bit conflict, but I'm 99% positive that I downloaded 64-bit versions of both Eclipse and Java (RE 7u5), which I chose because I have 64-bit Windows 7.
If anyone knows how to confirm that my Eclipse and Java are 64-bit,
that'd be appreciated.
If you think my problem is a different one, please help!
Please speak as plainly as you can, as I am totally new to Eclipse
and Java.
Shortcut Target: "C:\Program Files\Eclipse-SDK-4.2-win32-x86_64\eclipse\eclipse.exe" -vm "C:\Program Files (x86)\Java\jre7\bin\javaw.exe"
Full error code...:
Java was started but returned exit code=13
C:\Program Files (x86)\Java\jre7\bin\javaw.exe
-Xms40m
-Xmx512m
-XX:MaxPermSize=256m
-jar C:\Program Files\Eclipse-SDK-4.2-win32-x86_64\eclipse\\plugins/org.eclipse.equinox.launcher_1.30v20120522-1813.jar
-os win32
-ws win32
-arch x86_64
-showsplash C:\Program Files\Eclipse-SDK-4.2-win32-x86_64\eclipse\\plugins\org.eclipse.platform_4.2.0.v201206081400\splash.bmp
-launcher C:\Program Files\Eclipse-SDK-4.2-win32-x86_64\eclipse\eclipse.exe
-name Eclipse
--launcher.library C:\Program Files\Eclipse-SDK-4.2-win32-x86_64\eclipse\\plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.200.v201205221813\eclipse_1503.dll
-startup C:\Program Files\Eclipse-SDK-4.2-win32-x86_64\eclipse\\plugins/org.eclipse.equinox.launcher_1.30v20120522-1813.jar
--launcher.overrideVmargs
-exitdata 1e30_5c
-vm C:\Program Files (x86)\Java\jre7\bin\javaw.exe
-vmargs
-Xms40m
-Xmx512m
-XX:MaxPermSize=256m
-jar C:\Program Files\Eclipse-SDK-4.2-win32-x86_64\eclipse\\plugins/org.eclipse.equinox.launcher_1.30v20120522-1813.jar
Your version of Eclipse is 64-bit, based on the paths and filenames.
However, the version of Java that it's picking up is 32-bit, as indicated by where it is coming from, on this line:
-vm C:\Program Files (x86)\Java\jre7\bin\javaw.exe
Program Files (x86) is the folder where 64-bit Windows places 32-bit programs.
Program Files is the folder where 64-bit Windows places 64-bit programs.
This can happen when a system has more than one JVM installed, as is often the case on Windows 64-bit (for example, the JRE download page uses the bit-ness of the browser to determine what bit-ness download to offer you, and many people use(d) 32-bit browsers even though they run 64-bit Windows).
The best way to fix this, assuming you do in fact have 64-bit JRE or JDK on your system, is to specify in eclipse.ini exactly which JVM you want it to use. The instructions are detailed in the Eclipse wiki page, but basically you have to specify the -vm option in the ini file - make sure to read the wiki page carefully as the format is very specific.
Specifying the JVM path in eclipse.ini is strongly recommended because doing so isolates Eclipse from any potential changes to your system PATH that some program installers might make (I'm talking to you, Oracle!).
Another option would be to download and use 32-bit Eclipse instead of 64-bit, but it's still strongly recommended to specify the path to the JVM in eclipse.ini.
Left for historical reference:
To check your version of Java, run
java -version
in a console (command prompt). On Windows 7 with 64-bit Java 6 I get:
java version "1.6.0_27"
Java(TM) SE Runtime Environment (build 1.6.0_27-b07)
Java HotSpot(TM) 64-Bit Server VM (build 20.2-b06, mixed mode)
Note the 3rd line, which shows that this is a 64-bit version.
On a 32-bit version you'll get something like:
Java HotSpot(TM) Client VM (build 20.1-b02, mixed mode, sharing)
If you are on a 64-bit machine, then you can install the 64-bit JDK and uninstall the 32-bit one. For instance on Windows 10, just go to Settings and under Apps, you will find Java. Click on it and you will find all the different versions. Now you can select which one to uninstall.
I got this error and found that my PATH variable (on Windows) was probably changed. First in my PATH was this entry:
C:\ProgramData\Oracle\Java\javapath
...and Eclipse ran "C:\ProgramData\Oracle\Java\javapath\javaw" - which gave the error. I suspect that this is something that came along with an installation of Java 8.
I have several Java versions installed (6,7 and 8), so I removed that entry from the PATH and tried to restart Eclipse again, which worked fine.
If it's doesn't work for you, you'll need to upgrade your JDK (to the Java versions - 8 in this case).
Instructions on how to edit PATH variable
There are working combinations of OS, JDK and Eclipse bitness. In my case, I was using a 64-bit JDK with a 32-bit Eclipse on a 64-bit OS. After downgrading the JDK to 32-bit, Eclipse started working.
Use one of the following combinations.
32-bit OS, 32-bit JDK, 32-bit Eclipse (32-bit only)
64-bit OS, 32-bit JDK, 32-bit Eclipse
64-bit OS, 64-bit JDK, 64-bit Eclipse (64-bit only)
If you have recently installed Java 8 and uninstalled Java 7, install JDK 8 and retry.
For me the solution was to go into (on Windows 8.1):
System > Advanced system setting > Environment Variables
Under 'System variables' in the 'Path' variable there was the following first:
C:\ProgramData\Oracle\Java\javapath;
I removed this and Eclipse worked again!
I had the same issue, Java was started but returned exit code=13.
My solution was to create an environment variable to Windows properties variable name = PATH variable value = C:\Program Files\Java\jdk1.7.0_02\bin, not to C:\Program Files (x86)\Java\jre7\bin.
Next I added a line to file eclipse.ini → C:\Program Files\Java\jdk1.7.0_02\bin\javaw.exe.
That worked for me.
The issue was fixed by doing the following steps.
Eclipse finds the JAVA executables from
'C:\ProgramData\Oracle\Java\javapath'
The folder structure will contain shortcuts to the below executables,
i. java.exe
ii. javaw.exe
iii. javaws.exe
For me the executable paths were pointing to my Program Files(x86) (home for 32 bit applications) folder location
I corrected it to Program Files (which homes 64-bit applications) and the issue got resolved
Please find the screenshot for the same.
Adding vm argument to .ini file worked for me
-vm
C:\Program Files\Java\jdk1.7.0_65\bin\javaw.exe
Adding more details to this
for sts 3.9.18 release I was getting error Java was started but returned exit code=13 and for latest release same
issue just the returned exit code was 14. This was due to default java chosed was of 32 bit and this version of sts/eclipes is for 64 bits. resolved this by setting 64 bits version of java in STS.ini file as
-vm
C:\Progra~1\Java\jdk1.8.0_131\bin\javaw.exe
This is before vmargs parameters in the file.
The strangest fix ever. Look at your Eclipse path, and make sure you do not have strange characters (like !, #, and #). It worked for me.
Locate eclipse.ini:
Often at C:\Users\xxx\eclipse\jee-neon\eclipse, add
-vm
C:\Program Files (x86)\Java\jre7\bin\javaw.exe
after
--launcher.appendVmargs
I uninstalled Java update 25, and the issue was solved.
A clean reinstall of the Java JDK did the trick in my case. I am running Eclipse 4.4 (Luna) like a charm now.
You have to go to the folder where eclipse is installed and then you have to change the eclipse.ini file.
You have to add
-vm
C:\Program Files\Java\jdk1.8.0_202\bin\javaw.exe
Your eclipse.ini file will look like the below screenshot
It turned out I only had the 32-bit Java runtime installed.
C:\Program Files (x86)\Java\jre1.8.0_45\
All Eclipse really wanted was for me to install the 64-bit Java runtime. <= SOLVED
Java SE Runtime Environment 8u45 jdk-8u45-windows-x64.exe
http://www.oracle.com/technetwork/java/javase/downloads/jre8-downloads-2133155.html
Confirm your installation by checking you now have this folder
C:\Program Files\Java\jre1.8.0_45\
The solution is simple: Put the "eclipse" folder on "C:/Program Files". If it does not work, put it in "C:/Program Files (x86)".
I had this message when I had forgot to install the JDK.
The best answer here is too long. I cannot comment so I added my answer.
Go here:
http://www.oracle.com/technetwork/java/javase/downloads/index.html
Download the latest SDK (of course for x64 if your computer is x64)
Install it
Now the party is finished, and it's time to work with Eclipse ;)
I had the same problem. I was using Windows 8 with a 64-bit OS. I just changed the path to Program Files (x86) and then it started work. I put this line in the eclipse.ini file:
-vm
C:\Program Files (x86)\Java\jre7\bin\javaw.exe
Make sure you don't have special characters (%, $, #, etc.) at Eclipse path.
If you install a 64-bit Eclipse version on a PC with a 32-bit JRE this is guaranteed to occur.
So the solution is quite straightforward: You need to synchronise them by updating either one. This shall happen when downloading Oracle Fusion middleware and Eclipse expects a 32-bit environment while your JRE is 64-bit and your JAVA home is pointing to a 64-bit JDK.
Under system environment variables, make sure "C:\ProgramData\Oracle\Java\javapath" is removed.
Under system environment variables, make sure "C:\Program Files\Java\jdk1.8.0_131\bin" is added.
I had this issue. I installed Java 8 update 25 via Chrome, and therafter attempting to start Eclipse gave the mentioned error.
Uninstalled that update, and Eclipse works again.
I tried some of the solutions, but not worked for me.
Finally, I found another way, ...
Go to Environment Variables → System Variables
Set C:\Program Files\Java\jdk1.7.0_02\bin\javaw.exe to the path in the system variables.
Try it. It worked for me...
I tried the following solution:
I created a shortcut of javaw.exe from path C:\Program Files\Java\jdk1.7.0_71\bin and pasted it into the path C:\ProgramData\Oracle\Java\javapath.
After that, I launched Eclipse, and it worked for me.
I also encountered the same issue. It turned out that the environment variable Path was pointing to an incorrect Java version.
Please check the environment variable and point it to the correct Java. For example:
C:\Program Files (x86)\Java\jdk1.6.0_17\bin
To check the environment variable, go to:
Computer → properties → Advanced system settings → Advanced -> Environment variables
I have just solved the same issue upon setting up my Windows 8.1 PC. Exactly like #George Papatheodorou mentioned above (sorry I cannot add a comment), Eclipse and JRE must be both 64 bit or 32 bit.
However, it seems for Windows 8/8.1 environment, you are going to get 32-bit JRE by default (and I do not know where to change that default for the download), as explained here: http://java.com/en/download/faq/win8_faq.xml
I was using 64-bit Eclipse so there was a discrepancy. I then installed 32-bit Eclipse and everything works fine this time.
So before bothering changing any environment variables, check your JRE and Eclipse version.
Of course you can use 64-bit JRE with 64-bit Eclipse. Just make sure they match because Windows 8.1 will give you 32-bit by default.
I had a similar error after installing Java 8 on my Windows 7 system, 64 bit system.
Changing environment variables, etc. did not help. So I tried to remove the Java Update 8, but that too did not help. Downloading and installing the 64-bit version of Java 8 SDK fixed my problem. I hope this helps.
I had the same issue after I upgraded my JDK from 1.7 to 1.8. I'm using Eclipse 4.4 (Luna). The error is gone after I degrade JDK to 1.7.
Please check whether you have set two JAVA paths in the Environment Variable section. If you already installed two versions of the JDK, it might be, then double check you have put PATH for Java like below.
PATH --> C:\ProgramData\Oracle\Java\javapath
and also
JAVA_HOME ---> C:\Program Files\Java\jdk1.7.0_02\bin
If both are there, then this sort of error may occur.
If it's OK, then check in the ".ini" file the below area is OK or not.
Open ".ini" file and check
-VM path is C:\Program Files\Java\jdk1.7.0_79\bin\
If not, please set it like that and run again.
It could be due to too little memory. You can modify the eclipse.ini file to increase the memory. Something like this might help you: FAQ How do I increase the heap size available to Eclipse?

Java program Not running in Eclipse [duplicate]

I'm trying to install Java to use Eclipse (I followed all instructions to install Java and Eclipse) but my Eclipse is not starting due to some bad configuration I guess. I can't figure out why it's not working for me.
Eclipse Installation:
Extracted Eclipse at C:\eclipse
Created a shortcut to my desktop having target C:\eclipse\eclipse.exe
When I try to run Eclipse with this shortcut, I see following Eclipse splash screen for a second and it disappears. Eclipse does not start at all.
JAVA Installation:
Installed JDK at C:\Program Files\Java\jdk1.7.0_10
Installed JRE at C:\Program Files\Java\jre7
Environment Variables Configuration:
JAVA_HOME = C:\Program Files\Java\jdk1.7.0_10
PATH = C:\Program Files\Java\jdk1.7.0_10\bin;
I tested my Java installation using the console and figured out this issue but I don't know how to fix it, and I guess this is causing Eclipse not to start.
Problem:
Go to Eclipse folder, locate eclipse.ini file, add following entry (before -vmargs if present):
-vm
C:\Program Files\Java\jdk1.7.0_10\bin\javaw.exe
Save file and execute eclipse.exe.
please try to execute java from
C:\Program Files\Java\jdk1.7.0_10\bin
i.e from the location where java is installed.
If it is successful, it means that the error lies somewhere in the classpath.
Also, this guy seems to have had the same problem as yours, check it out
Check that downloaded eclipse/JDK/JRE is compatible with your processor/OS architecture that is are they 32bit or 64bit?
Not able to run Appium {“message”:”A new session could not be created. (Original error: ‘java -version’ failed
I used Jdk 1.8 and JRE 1.8, Classpath is also set properly but I observed that Java command gives Error to initialization of VM (java/lang/NoClassDefFoundError: java/lang/Object)
Solution:
Uninstalled JRE and JDK completely
Installed JRE 1.8 then
Installed JDK 1.8
Set Classpath
check Java command works or not and its working
also able to execute the Appium program thru Eclipse Kepler Service Release 2 with JDK1.8 support
I had the same error in my case was when I needed to update jdk 7 to jdk 8, and my bad was just I installed jdk8 and I never installed jre8, only that, the error was solved immediately when I installed jre8.
Try placing the desired java directory in PATH before not needed java directories in your PATH.
I had the same issue on Windows 7 and I had to install both JDK and JRE and it's a success.
I faced the same problem,Eclipse splash screen for a second and it disappears.Then i noticed due to auto update of java there are two java version installed in my system. when i uninstalled one eclipse started working.
Thanks you..
I've observed this with STS and Eclipse and running java from CMD too on Windows 7/8/10 and following was my simple solution:
Actually, when I installed JDK 8 and STS/Eclipse it created one directory i.e. C:\ProgramData\Oracle\Java\javapath with the following files:
C:\ProgramData\Oracle\Java\javapath\java.exe
C:\ProgramData\Oracle\Java\javapath\javaw.exe
C:\ProgramData\Oracle\Java\javapath\javaws.exe
Along with that, it appended Path Environment variable of System with this location C:\ProgramData\Oracle\Java\javapath
I've just removed above entry from Path Environment variable of System and added the location of the actual JDK instead i.e. C:\Program Files\Java\jdk1.8.0_131\bin
Now that is not necessary to add that -vm option in eclipse.ini or
SpringToolSuite4.ini either.
I just spent about 1 hour to figure out possible solution for the same error.
So what I did under MS WIndows 7 is following
Uninstall all Java packages of all versions.
Download last packages Java SE or JRE for your 32 or 64 Windows and install it.
First install JRE and second is Java SE.
Open text editor and paste this code.
public class Hello {
public static void main(String[] args) {
System.out.println("test");
}
}
Save it like Hello.java
Go to Console and compile it like
javac Hello.java
Execute the code like
java Hello
Should be no error.
sometime you missed some file like I missed my one file rt.java
so better to check yours .........
C:\Program Files\Java\jdk1.8.0_112\jre\lib
0
I just spent about 1 hour to figure out possible solution for the
same error.
So what I did under MS WIndows 7 is following
Uninstall all Java packages of all versions.
Download last packages Java SE or JRE for your 32 or 64 Windows and
install it.
First install JRE and second is Java SE.
List item
Below error is thrown when there are multiple versions of jdk on your machine:
error occurred during initialization of VM
java/lang/NoClassDefFoundError: java/lang/Object
so for this Just use below:
set PATH="JDK bin path" in cmd
I had a same issuse, my file location was in D-drive, and then i shifted to the c-Drive and it works.

Eclipse only sees JDK with sudo

I have to start by saying that I have just switched to Ubuntu from Windows and I am new to Linux in general. Coming from Windows, I really am not familiar with how exactly the permissions work, the Linux file system, where I am able to create folders that I can use without the sudo command etc.
I use eclipse on a daily basis for android development and other simple java swing projects. I was able to download and extract the latest available version of eclipse (kepler) to this path: /opt/eclipse. Inside this directory is the eclipse executable and other eclipse related files.
I also installed the JDK and verified with the java -version command. It says:
java version "1.7.0_25"
Java(TM) SE Runtime Environment (build 1.7.0_25-b15)
Java HotSpot(TM) 64-Bit Server VM (build 23.25-b01, mixed mode)
I am running on a 64 bit CPU architecture so both programs are the 64 bit version.
Now, my problem is that if I open eclipse from the Unity dash or from the file explorer, it give me this error:
However if I run sudo eclipse in the terminal, everything runs just fine as long as I do it as the super user. I have a hunch that the JDK is installed in a folder that is restricted to normal users and only works if I run the sudo command but this is just a hunch. As I said, I am new to Linux and I am not really sure what I am doing wrong here, I am learning as I go. I need a good explanation as to how to make it start from the Unity dock without the sudo command. Thanks in advance!
You'll want to use the chmod command from the terminal to change the permissions on the Java folder. See this link for more information:
http://www.linux.org/threads/file-permissions-chmod.4094/
Well after running the which java cmd, I noticed that the path to the JDK from the eclipse.ini file was not pointing to the correct location. I fixed the path and now it works. I don't know how the sudo cmd overrides the eclipse.ini path to JDK but well, it works

Eclipse crashes at startup; Exit code=13

I am trying to work with Eclipse Helios on my x64 machine (Im pretty sure now that this problem could occur with any eclipse) but it just doesn't cooperate.
When I try to run eclipse I get the following:
I have installed
Helios EE x64 (latest version)
JDK 1.6.025 (x64)
I have linked my Environment Variables up correctly and tried to compile a Java file through cmd and have succeeded.
Whenever I tried running eclipse i get exit code=13 (required java version=1.5)
I tried running the following in cmd:
-vm "mypath\jdk1.6.025\jre\bin"
command as forums suggested
as well as other paths
-vm "mypath\jdk1.6.025\bin"
-vm "mypath\jdk1.6.025\jre\bin\javaw.exe"
even
-vm "mypath\jre6\bin" out of desperation
to no avail.
I am all out of ideas and I wonder if anybody had this problem. I even downloaded the helios x86 version and x86 JDK version yet it did not fix the problem. (I changed the environment variables)
I changed everything back but I'm stuck...
Related Question: Cannot Run Eclipse
It turns out that a directory had an ! in its name and eclipse had a problem with that.
Once I switched the directory (from Desktop which is located in the user directory which had ! in it to C:/ ) everything worked fine. (look at the Djava.class.path in the image located in my the question above for the whole path - it should make it clear what the problem was)
Vista allows you to create a username that contains ! character and then a lot of programs have issues with it
Update
If somebody is still getting this problem even though their path is ok I suggest
trying to look at the Environment Variables
then try uninstalling the Helios EE ( or any other version of ee you are running ) and JDK and then reinstalling the 86x versions of both (they should still work on the 64x platform).
for further explanation look here
Thank you everybody that tried to help
Please, check that your have downloaded the x64 version. ;)
And your installed Java, is x86. Use Eclipse x86 if you use Java x86.
Because your eclipse's env-arch was not matched with java-arch, for instance: eclipse-64bit run in java-32bit or vice versa.
In Windows: Set correct env path to the specific 32 or 64bit java acording to eclipse.
In Linux:
Try run: [path-to-eclipse]/eclipse -vm [jdk-path]/bin
What version of java is on your path when you start eclipse? Try entering java -version on a command prompt. You will want Sun java 1.5 or higher. See http://www.ehow.com/how_4784069_terminated-exit-code-error-eclipse.html
This turned out to be a permissions error for me. I change the kepler folder, eclipse root directory to have permissions set to everyone all. This is going to be a security risk so I will need to set the permissions to be program specific. using procmon.exe I found that javaw.exe was getting write permissions denied. The programmers of eclipse and javaw.exe did not give those programs elevated permissions to run as trustedinstaller.
I faced the same problem
Turned out my Java version in the PATH had been updated to 1.8
Once I changed this back to 1.7, my Eclipse started without issues

Categories

Resources