I've always used Google2SRT, a light software to download subtitles from Youtube. Now it no longer works: "Startup Error: Failed to find Java VM".
I have Java installed, I have Netbeans installed and working, I have never had any Java related issues.
I've tried reinstalling everything, I've tried creating a JAVA_HOME and JRE_HOME System variable and pointing it to "C:\Program Files\Java\jre1.8.0_191" according to this tutorial: https://confluence.atlassian.com/doc/setting-the-java_home-variable-in-windows-8895.html
It felt odd because I didn't even had this environment variable previously. I have no idea what's the issue.
I've tried uninstalling Netbeans and other programming tools as well.
I'm on Windows 7 x64.
java -debug -version > "%userprofile%\desktop\javaDebug.log" 2>&1 returns:
java version "1.8.0_191"
Java(TM) SE Runtime Environment (build 1.8.0_191-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.191-b12, mixed mode)
I have also tried setting maximum heap size in _JAVA_OPTIONS
System Variables
Just go to the install dir (e.g. C:\Program Files (x86)\Google2SRT), open a cmd.exe, cd to the above folder and type java -jar Google2SRT.jar. You don't need the .exe
This should work, provided you have java installed. Check by typing java -version in the cmd.
Recently I copied Netbeans 8.2 to new computer and unfortunately the java path are different from previous. My machine running on Windows 10 x64. And when I running netbeans64.exe on bin folder than two popups appear
cannot locate java installation in specified jdkhome:C:\Users\root\Workspace\root\idk\java\jdk\1.8\bin\
After that, I choose to use default version, than another popup appear
cannot find java 1.8 or higher
I've follow instruction to change on /etc/netbeans.conf as below
netbeans_jdkhome="C:\Users\root\Workspace\root\idk\java\jdk\1.8\bin\"
But it doesn't works. I can assuring you that inside the folder contains java.exe which is version 1.8
java version "1.8.0_152"
Java(TM) SE Runtime Environment (build 1.8.0_152-b16)
Java HotSpot(TM) 64-Bit Server VM (build 25.152-b16, mixed mode)
I had registered that path above on System Environment Variables
I have tried to use parameter --jdkhome but still got the same result.
What wrong with my Netbeans? Any other suggestion?
Thanks
jdkhome should point to the root of the JDK folder, not the bin folder inside it.
So it should be:
netbeans_jdkhome="C:\Users\root\Workspace\root\idk\java\jdk\1.8\"
or
--jdkhome C:\Users\root\Workspace\root\idk\java\jdk\1.8
When I try to start uiautomatorviewer.bat i get this error:
ERROR: No suitable Java found. In order to properly use the Android Developer
Tools, you need a suitable version of Java JDK installed on your system.
We recommend that you install the JDK version of JavaSE, available here:
http://www.oracle.com/technetwork/java/javase/downloads
If you already have Java installed, you can define the JAVA_HOME environment
variable in Control Panel / System / Avanced System Settings to point to the
JDK folder.
You can find the complete Android SDK requirements here:
http://developer.android.com/sdk/requirements.html
I have a working JDK at C:\Program Files\Java\jdk-9
My system variables are:
JAVA_HOME C:\Program Files\Java\jdk-9
PATH C:\Program Files\Java\jdk-9\bin;D:\Prac\AndroidSDK\platform-tools\bin;D:\Prac\AndroidSDK\tools\bin;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;%ANDROID_HOME%;%ANDROID_HOME%\build-tools\25.0.3;D:\Prac\nodejs\;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;
( ANDROID_HOME D:\Prac\AndroidSDK )
My java version:
java version "9"
Java(TM) SE Runtime Environment (build 9+181)
Java HotSpot(TM) 64-Bit Server VM (build 9+181, mixed mode)
echo %JAVA_HOME% is working OK (printing correct path).
I tried setting JAVA_HOME variable in the .bat script. That didn't work. (But that might be because I'm not sure where exactly in the script should I include it...)
Do you have any idea how to solve this?
Eureka! The problem was that I was using 64bit JDK.
After installation of 32bit version all I needed to do was to set ANDROID_SWT system variable and it is working now.
At the beginning I first installed JDK 7 on my Windows 7 operating system . As usual I added the following path of my newly installed Java Development Kit to the system variable PATH.
C:\Program Files\Java\jdk1.7.0_25\bin
When running javac and java commands in Command Prompt they have both pointed to the same environment. So far so good.
For the purposes of Java application development at our enterprise I was forced to install an older instance of JDK thus installing JDK 6.
Below is the printout of my PATH system variable at the moment.
C:\dev\CollabNet\Subversion Client
C:\WINDOWS\system32
C:\WINDOWS
C:\WINDOWS\System32\Wbem
C:\WINDOWS\System32\WindowsPowerShell\v1.0\
C:\Program Files\WIDCOMM\Bluetooth Software\
C:\Program Files\WIDCOMM\Bluetooth Software\syswow64
C:\Program Files\Java\jdk1.6.0_37\bin
C:\Development\apache-maven-3.1.1\bin
C:\dev\apache-ant-1.7.1\bin
C:\Program Files\TortoiseSVN\bin
But now I faced the situation where javac and java versions are different therefore pointing to different environments.
C:\Users\rokprodan>javac -version
javac 1.6.0_37
C:\Users\rokprodan>java -version
java version "1.7.0_25"
Java(TM) SE Runtime Environment (build 1.7.0_25-b17)
Java HotSpot(TM) 64-Bit Server VM (build 23.25-b01, mixed mode)
Does anybody have any suggestions and ideas for this situation? How could I achieve that both javac and java are pointing to JDK 6 ?
I deep appreciate your advices and help.
When you installed public JRE, java.exe was put into C:\WINDOWS\system32.
But javac is not a part of JRE, so it is can be found only in C:\Program Files\Java\jdk1.6.0_37\bin.
The solution is to place C:\Program Files\Java\jdk1.6.0_37\bin before C:\WINDOWS\System32 in PATH environment variable.
I'm in the situation where I've installed the JDK, but I can't run applets in browsers (I may not have installed the JRE).
However, when I install the JRE, it clobbers my JDK as the default runtime. This breaks pretty much everything (Eclipse, Ant) - as they require a server JVM.
There's no JAVA_HOME environment variable these days - it just seems to use some registry magic (setting the system path is of no use either). Previously, I've just uninstalled the JRE after I've used it to restore the JDK. This time I want to fix it properly.
This also manifests itself with the jre autoupdater - once upon a time, I had a working setup with the JDK and JRE, but it updated and bust everything.
This is a bit of a pain on Windows. Here's what I do.
Install latest Sun JDK, e.g. 6u11, in path like c:\install\jdk\sun\6u11, then let the installer install public JRE in the default place (c:\program files\blah). This will setup your default JRE for the majority of things.
Install older JDKs as necessary, like 5u18 in c:\install\jdk\sun\5u18, but don't install the public JREs.
When in development, I have a little batch file that I use to setup a command prompt for each JDK version. Essentially just set JAVA_HOME=c:\jdk\sun\JDK_DESIRED and then set PATH=%JAVA_HOME%\bin;%PATH%. This will put the desired JDK first in the path and any secondary tools like Ant or Maven can use the JAVA_HOME variable.
The path is important because most public JRE installs put a linked executable at c:\WINDOWS\System32\java.exe, which usually overrides most other settings.
I have patched the behaviour of my eclipse startup shortcut in the properties dialogue
from
"E:\Program Files\eclipse\eclipse.exe"
to
"E:\Program Files\eclipse\eclipse.exe" -vm "E:\Program Files\Java\jdk1.6.0_30\bin"
as described in the Eclipse documentation
It is a patch only, as it depends on the shortcut to fix things...
The alternative is to set the parameter permanently in the eclipse initialisation file.
I just had that problem (Java 1.8 vs. Java 9 on Windows 7) and my findings are:
short version
default seems to be (because of Path entry)
c:\ProgramData\Oracle\Java\javapath\java -version
select the version you want (test, use tab completing in cmd, not sure what those numbers represent), I had 2 options, see longer version for details
c:\ProgramData\Oracle\Java\javapath_target_[tab]
remove junction/link and link to your version (the one ending with 181743567 in my case for Java 8)
rmdir javapath
mklink /D javapath javapath_target_181743567
longer version:
Reinstall Java 1.8 after Java 9 didn't work. The sequence of installations was jdk1.8.0_74, jdk-9.0.4 and attempt to make Java 8 default with jdk1.8.0_162...
After jdk1.8.0_162 installation I still have
java -version
java version "9.0.4"
Java(TM) SE Runtime Environment (build 9.0.4+11)
Java HotSpot(TM) 64-Bit Server VM (build 9.0.4+11, mixed mode)
What I see in path is
Path=...;C:\ProgramData\Oracle\Java\javapath;...
So I checked what is that and I found it is a junction (link)
c:\ProgramData\Oracle\Java>dir
Volume in drive C is OSDisk
Volume Serial Number is DA2F-C2CC
Directory of c:\ProgramData\Oracle\Java
2018-02-07 17:06 <DIR> .
2018-02-07 17:06 <DIR> ..
2018-02-08 17:08 <DIR> .oracle_jre_usage
2017-08-22 11:04 <DIR> installcache
2018-02-08 17:08 <DIR> installcache_x64
2018-02-07 17:06 <JUNCTION> javapath [C:\ProgramData\Oracle\Java\javapath_target_185258831]
2018-02-07 17:06 <DIR> javapath_target_181743567
2018-02-07 17:06 <DIR> javapath_target_185258831
Those hashes doesn't ring a bell, but when I checked
c:\ProgramData\Oracle\Java\javapath_target_181743567>.\java -version
java version "1.8.0_162"
Java(TM) SE Runtime Environment (build 1.8.0_162-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.162-b12, mixed mode)
c:\ProgramData\Oracle\Java\javapath_target_185258831>.\java -version
java version "9.0.4"
Java(TM) SE Runtime Environment (build 9.0.4+11)
Java HotSpot(TM) 64-Bit Server VM (build 9.0.4+11, mixed mode)
so to make Java 8 default again I had to delete the link as described here
rmdir javapath
and recreate with Java I wanted
mklink /D javapath javapath_target_181743567
tested:
c:\ProgramData\Oracle\Java>java -version
java version "1.8.0_162"
Java(TM) SE Runtime Environment (build 1.8.0_162-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.162-b12, mixed mode)
** update (Java 10) **
With Java 10 it is similar, only javapath is in c:\Program Files (x86)\Common Files\Oracle\Java\ which is strange as I installed 64-bit IMHO
.\java -version
java version "10.0.2" 2018-07-17
Java(TM) SE Runtime Environment 18.3 (build 10.0.2+13)
Java HotSpot(TM) 64-Bit Server VM 18.3 (build 10.0.2+13, mixed mode)
After many attempts, I found the junction approach more convenient. This is very similar on how this problem is solved in linux.
Basically it consists of having a link between c:\tools\java\default and the actual version of java you want to use as default in your system.
How to set it:
Download junction and make sure to put it in your PATH
environment variable
Set your environment this way:
- PATH pointing to ONLY to this jre c:\tools\java\default\bin
- JAVA_HOME pointing to `c:\tools\java\default
Store all your jre-s in one folder like (if you do that in your Program FIles folder you may encounter some
C:\tools\Java\JRE_1.6
C:\tools\Java\JRE_1.7
C:\tools\Java\JRE_1.8
Open a command prompt and cd to C:\tools\Java\
Execute junction default JRE_1.6
This will create a junction (which is more or less like a symbolic link in linux) between C:\tools\java\default and C:\tools\java\JRE_1.6
In this way you will always have your default java in c:\tools\java\default.
If you then need to change your default java to the 1.8 version you just need to execute
junction -d default
junction default JRE_1.8
Then you can have batch files to do that without command prompt like
set_jdk8.bat
set_jdk7.bat
As suggested from #СӏаџԁеМаятіи
EDIT: From windows vista, you can use mklink /J default JRE_1.8
I simply install all the versions of JDK I need and the latest installed becomes default, so I just reinstall the one I want to be default if necessary.
I have several JDK (1.4, 1.5, 1.6) installed in C:\Java with their JREs. Then I let Sun update the public JRE in C:\Program Files\Java.
Lately there is an improvement, installing in jre6. Previously, there was a different folder per new version (1.5.0_4, 1.5.0_5, etc.), which was taking lot of space
an alterable way to run an .jar app is create an .bat cmd for it.
for example, you have jre10 and jre8 installed on your pc,and jre10 is your default jre.
but your jar is specified to work with jre8,following cmd will work:
"C:\Program Files\Java\jre1.8.0_181\bin\java.exe" -jar JabRef-4.3.1.jar
Need to remove C:\Program Files (x86)\Common Files\Oracle\Java\javapath from environment and replace by JAVA_HOME which is works fine for me
Stacked by this issue and have resolved it in 2020, in Windows 10. I'm using Java 8 RE and 14.1 JDK and it worked well until Eclipse upgrade to version 2020-09. After that I can't run Eclipse because it needed to use Java 11 or newer and it found only 8 version. It was because of order of environment variables of "Path":
I suppose C:\Program Files (x86)\Common Files\Oracle\Java\javapath is path to link to installed JRE exe files (in my case Java 8) and the issue was resolved by move down this link after %JAVA_HOME%, what leads to Java 14.1/bin folder.
It seems that order of environment variables affects order of searched folders while executable file is requested.
Thanks for your comment or better explanation.