I'm trying to setup Unity to build for Android. But I can't get the Java Development Kit. Can't download it and can't find it either.
In this answer, the guy says
To ensure JDK is installed, just go through the following :
press Win + R
type 'cmd' in the popup and press button OK.
in the console which has opened, type javac -version and press enter.
You should see as an output :
javac 1.8.0_XX
If so SDK is installed.
I did that and I got "javac 1.8.0_XX", and so I assumed I had the JDK, so I went to Unity > External Tools > JDK and tried linking the following path: "C:\Program Files\Java\jre1.8.0", and got the error message: "The path you specified does not look like a valid JDK installation. Android development requires at least JDK(1.7), having JRE only is not enough. Please make sure you are selecting a suitable JDK home directory or download and install the latest JDK: link"
I clicked the download link for windows x64 and it never loads and eventually says there's no connection. I tried the x86 as well.
In this SO question How do I find where JDK is installed on my windows machine?
Answer: For windows, in the command prompt:
c:\> for %i in (java.exe) do #echo. %~$PATH:i
And so I did that and got the path "C:\ProgramData\Oracle\Java\javapath\java.exe"
When I try linking via Unity > External tools > JDK it doesn't find any files.
I'm a bit clueless now.
#RealAnyOne, you have installed Java with JRE only installation i.e., without out a JDK that’s what you see only one folder and this is why it also showing version in the command line since it won’t check for JDK. JRE is Java Runtime Environment, JDK is Java Development Kit which contains many essential libraries. So Ideally there should be two folders JRE and JDK. This is the reason you are getting this issue with Unity.
To Fix::
Uninstall old Java 8
Download Java 8 from the oracle website
http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
Install it. Now you should have two folders. Then point your Unity to it.
Related
I'm a bit confused now. When I run the command java --version in the terminal i get: java 13.0.1. When I open the system preferences and click the java app and then about, i see it says Java version 8 1.8.0_231
Does that mean I have 8, 13 or both?
When I check through the java app.
When I check through the terminal.
When i check for all JDK installed on my system (only 1 version pop ups).
You can have multiple JDK installed in one machine but you can have only one version set as default Java SDK. Looks like you have Java 13 set as default.
Try running the following :
echo $JAVA_HOME
You can also go to the tab Java and see the list of all Java Runtime Environments (JRE.)
Please note that just because you have multiple JREs available doesnot mean all corresponding SDK are also there.
You can have many version of java on your Mac. But you can run only one of this in a process.
On my Mac, system preferences run with java path :
/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java
But in terminal, this run with java path:
/usr/bin/java
I think you can replace java file in /usr/bin by another version java you want.
that means you jdk version is 13 , and your jre version is 1.8.
jre is used for running java apps ,and the jdk(java development kit) is for building apps with java language. java jdk is like the android sdk
I'm trying to install Eclipse, but I can't get the installer to start. It fails with
"Failed to create the Java Virtual Machine"
How can I resolve this?
Note: I'm on Mac.
Edit the file /Applications/Eclipse.app/Contents/Info.plist
There is a comment for use a particular JVM:
<key>Eclipse</key>
<array>
<!-- to use a specific Java version (instead of the platform's default) uncomment one of the following options,
or add a VM found via $/usr/libexec/java_home -V -->
<string>-vm</string><string>/Library/Java/JavaVirtualMachines/jdk8u192-b12/Contents/Home/jre/</string>
<string>-keyring</string>
<string>~/.eclipse_keyring</string>
</array>
It took me some time to figure this out as well. The main takeaway was eclipse does not support SDK Version 14 (as of eclipse 2020-03). That was not completely obvious to me.
Install a supported version (I used Homebrew to install SDK V8 🍺):
brew cask install adoptopenjdk/openjdk/adoptopenjdk8
If this is the only Java Version you have installed you should be fine and Eclipse should open up. If that is not the case and you have another Java Version installed. You have to tell Eclipse which Version of Java it should be using (see Step 2).
Tell Eclipse which Version to use by editing the /Applications/Eclipse.app/Contents/Info.plist file as described by Juan Ignacio Barisich and Brad Parks. That being the version you installed in step 1.
nano /Applications/Eclipse.app/Contents/Info.plist
# or
open /Applications/Eclipse.app/Contents/Info.plist
<key>Eclipse</key>
<array>
<string>-keyring</string>
<string>~/.eclipse_keyring</string>
<string>-vm</string>
<string>/Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home/jre/</string>
</array>
Disclaimer: Please bare in mind that those were the steps I took to get eclipse running again. Because I'm nowhere qualified to give a precise answer about this please take a look at the comments in case I got something wrong.
Edit: See Christian Fries answer who pointed out that all java versions 8 to 13 are supported by eclipse.
For me, I had to edit the eclipse-inst.ini file located here:
Eclipse Installer.app/Contents/Eclipse/eclipse-inst.ini
and add the path to my local java VM at the very top of the .ini file, which is here:
-vm
/Users/bparks/jdk/jdk1.8.0_162_x64/bin/java
If the Eclipse Installer.app file is in a DMG, right click on it, and copy it, then paste it into another folder. Then right click on that app file, and choose "Show Package Contents", to get into the files inside the application.
If you've already got Eclipse installed, and find it's throwing the same error, you could try a similar approach by editing the following file for Eclipse:
/Applications/Eclipse.app/Contents/Eclipse/eclipse.ini
On mac, you can get the full path you'd need to your java exe by running the following in a terminal, which will copy the path to your clipboard.
$ echo $(/usr/libexec/java_home)/bin/java | pbcopy
Note: The error "Failed to create the Java Virtual Machine" also exists with Eclipse 2020-03 (under some situations, see https://bugs.eclipse.org/bugs/show_bug.cgi?id=561273) and it is not required to use Java 8 (with Eclipse 2020-03).
For the impatient:
You can run Eclipse or the Eclipse Installer with a given VM without changing eclipse.ini by starting it via a command line:
Open Terminal an run:
open PATHTOECLIPSEINSTALLER/Eclipse\ Installer.app --args -vm /Library/Java/JavaVirtualMachines/NAMEOFJDK/Contents/Home/bin
where PATHTOECLIPSEINSTALLER is the path of the folder where Eclipse Installer is located and NAMEOFJDK is the name of the folder with the JDK (11, 12, 13).
For example:
open Downloads/Eclipse\ Installer.app --args -vm /Library/Java/JavaVirtualMachines/jdk-11.0.2.jdk/Contents/Home/bin
In the installer you may select the VM used by Eclipse. Use a compatible VM here and the installer will modify the eclipse.ini for you.
Explanation TL;DR
To clarify this issue:
Eclipse - say Eclipse 2020-03 - runs with Java 11, Java 12, Java 13, but does not run with Java 14. It fails with the message "Failed to create the Java Virtual Machine". This happens for the installer and for Eclipse itself.
You can download Eclipse without the installer from here: https://www.eclipse.org/downloads/packages/
Explanation:
On macOS, if you start a freshly installed Eclipse, it will use the default JVM. The default JVM is obtained by running /usr/libexec/java_home.
This program /usr/libexec/java_home will find the installed JDK with the highest version as default. That is, if you have JDK 14 installed and run Eclipse 2020-03, you will see this error.
Solution
Summarising some other answers here, there are three options:
Once you have removed JDK 14 from /Library/Java/JavaVirtualMachines/ the error will be gone.
If you like to have JDK 14 installed, start the installer with a different JDK via the command line open Path-to-Eclipse-Installer/Eclipse\ Installer.app --args -vm /Library/Java/JavaVirtualMachines/NAMEOFJDK/Contents/Home/bin
You may edit the eclipse.ini (as suggested in other answers) to use a specific JVM.
Referring to Marseille Joseph
https://www.eclipse.org/forums/index.php?t=msg&th=1102885&goto=1823113&#msg_num_13
This worked for me!
Their solution didn't require uninstalling jdk14 or to editing the eclipse.ini file. Instead, do this:
cd /Library/Java/JavaVirtualMachines/jdk-14.jdk/Contents/MacOS/
sudo rm /Library/Java/JavaVirtualMachines/jdk-14.jdk/Contents/MacOS/libjli.dylib
sudo ln -s /Library/Java/JavaVirtualMachines/jdk-14.jdk/Contents/Home/lib/libjli.dylib libjli.dylib
I started facing the same problem in mac suddenly after updating to macOS Monterey, So I just did the following steps:
Then go to Contents/Eclipse/eclipse.ini file and open it with any text editor and you will see the following:
Add below line before -vmargs as shown in above image:
-vm /Library/Java/JavaVirtualMachines/jdk1.8.0_171.jdk/Contents/Home/bin/java
This below line will be different for all the users:
/Library/Java/JavaVirtualMachines/jdk1.8.0_171.jdk/Contents/Home/bin/java
and you can just get this line copied to your clipboard using this command in terminal:
$ echo $(/usr/libexec/java_home)/bin/java | pbcopy
Similarly will be for STS:
Then go to Contents/Eclipse/SpringToolSuite4.ini as shown below and open with any text editor app.
You will see the following:
Just add the same line that you added for Eclipse in the above steps:
delete all java folder inside /Library/Java
then install a new jdk from
https://adoptopenjdk.net/
which will install at
/Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk
then try reinstalling eclipse a
I had the same problem in my mac. Here is my solution.
First: I've uninstall all the versions of jdk, because I've try a lot of options.
To do this, you need to go to Library/Java/JavaVirtualMachines
and delete all the folders.
Second: Install jdk 1.8 here is a link to download this version:
jdk 1.8
Third: Install eclipse 2020-03 and thats all.
If you want to use JDK 14, you need to follow this steps:
Open eclipse
Go to Help > Install new software
In the Install window copy the following link in Work with https://download.eclipse.org/eclipse/updates/4.15-P-builds/
Select the third option show in the picture below
Then, click "next" and finish the install
Now you have to change the options, go to Preferences (command + ,) > Java > Compiler and search the version 14. Before this step you need to install jdk 14 (link) Perhaps eclipse would suggest you to change to the correct JREs, for this you need to go to Java > Installed JREs and add the correct version. When you click add you need to choose he JRE type, in my case I use a MacOS X VM and Standard VM, then you have to choose the directory (/Library/Java/JavaVirtualMachine/jdk-14/Contents/Home and click open you could give a JRE Name and finish eclipse will be restart and now you can use eclipse with java 14.
This works for me, I hope you have understood me.
Go to /Library/Java/JavaVirtualMachines
Delete all version except one in use.
Install jdk 8 from brew work for me. You can get the instruction on installing Jdk 8 from HomeBrew here How to install Java 8 on Mac
I met this problem with eclipse-java-2020-03-M2-macosx-cocoa-x86_64, and opendjdk11. The latest eclipse installer at the moment also complained same error.
After I switched back to openjdk8, everything goes well...
For Windows OS:
open eclipse.ini in the Eclipse program folder
add the below lines at the top of the file
-vm
path-to-java-bin\javaw.exe (for example: C:\Program Files\Java\jdk-11.0.10\bin\javaw.exe)
I mounted eclipse dmg file and copied eclipse inside Applications. Then I tried to modify file Info.plist located inside Contents as below, but was getting that this file Info.plist is readonly error. I noticed that I already have read and write permission but still it was giving me that read only error. Then I moved the contents of Eclipse to some other local folder and then edited Info.plist, it did not give me readonly error.
<array>
<string>-vm</string><string>/Library/Java/JavaVirtualMachines/jdk1.8.0_65.jdk/Contents/Home/bin/java</string>
<string>-keyring</string>
<string>~/.eclipse_keyring</string>
</array>
Finally I am able to open eclipse.
Launching the Eclipse mac installer 64 bit (Eclipse Installer.app downloaded from http://www.eclipse.org/downloads/index-developer.php?oxygen) on Mac OS Sierra 10.12.3 fails and displays the alert message :
The JVM shared library "/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/../lib/server/libjvm.dylib"
does not contain the JNI_CreateJavaVM symbol.
My System Preference panel tells me that I have the recommended version of Java (Java 8 update 121).
I tried different things as suggested on different posts (including Eclipse won't start after installing Mac OS X Yosemite (Mac OS 10.10)) :
I made sure to use the 64 bits version
I tried to go back to Java 6 (downloaded from Apple website) but then I get a message telling that I need the latest version of Java (Java 8) to install Eclipse
I tried older versions of Eclipse (Mars, etc.) but the installer returns the same alert message
I tried to re-install Java after editing SystemVersion.plist as suggested here but got the same message.
I installed Java from the jdk8 website and JDK from the oracle website (as suggested by greg-449) but still the same alert message.
Thanks for your help.
I solved the problem by editing the file Contents/Info.plist stored within the Eclipse Installer.app (that you can actually open as a standard folder).
I uncomented this line specifying the vm location
<string>-vm</string><string>/Library/Java/JavaVirtualMachines/1.8.0.jdk/Contents/Home/bin/java</string>
and I replaced the name of the jdk folder by the one I actually have in my /Library/Java/JavaVirtualMachines. In my case, 1.8.0.jdk had to be replaced by jdk1.8.0_121.jdk.
Install the Java 8 JDK not just the JRE. On macOS the JRE does not provide a complete Java installation.
The current (Java 8 update 121) location for the JDK download is here. You should end up with a jdk-8u121-macosx-x64.dmg file to install. Once installed start the Terminal app and make sure that java -version works.
The following was added in the whatever.app/Contents/Info.plist
<key>Eclipse</key>
<array>
<string>-vm</string
<string>/Users/<yourHomeDir>/.sdkman/candidates/java/11.0.2-open/bin/java</string>
<string>-keyring</string>
<string>~/.eclipse_keyring</string>
</array>
Note that, I experienced this issue while using Eclipse Mat and JDK Mission Control
On Mac OS v11.6 (Big Sur ) ,the dependency was Java 11 .
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.
I went to the Oracle site, downloaded and installed Java Platform (JDK) 7 on a Windows 7 64 bit virtual machine. I added the path to the c:\program files\Java\jdk1.7.0\bin to the path environment variable. I even deleted c:\windows\system32\Java.exe as recommended by someone. I was essentially following this: "Android Create" call fails in windows 7 - missing JDK
When I install the ADT it gives me the error JDK could not be found. Download the latest JDK. Why?
Thanks.
this is caused because the Android DK finds java in the c:\windows\system32\ folder before it finds the JDK one.
To resolve this edit your PATH environment variable and put the JDK path before the c:\windows\system32\ path.
Just in the ADT installer , press back when the installer promite for No JDK Found then press next, the installer will find the JDK, for sure this is a common bug
Does that happen when you open eclipse?
I'm thinking in two possible problems. Here is one possible solution: Eclipse - no Java (JRE) / (JDK) ... no virtual machine
If you already got this, go to Window -> Android SDK and AVD preferences
The first "preference" should ask you your Android SDK folder. you need to set this correctly.
Your JDK installation is not proper.
Reinstall JDK. It should be working fine.
I also had this problem once. I have done the above to resolve this issue.
You should not delete C:\Windows\System32 folder for this issue, It might lead to OS problems.
adil's answer is the one which finally worked for me (although I had added the jdk\bin to the path and created\set the JAVA_HOME to the same); moving the jdk\din directory before the win\sys32 in the PATH finally allowed me to install the android sdk on win7/64bit