eclipse JNI_CreateJavaVM error at mac os x - java

i am using mac os x 10.8.2. i have installed java 1.7 and then take back since i can not send iphone applications via xcode. now java 1.6 is installed.
ysnky# ~$ java -version
java version "1.6.0_37"
Java(TM) SE Runtime Environment (build 1.6.0_37-b06-434-11M3909)
Java HotSpot(TM) 64-Bit Server VM (build 20.12-b01-434, mixed mode)
ysnky# ~$
but now i can not run eclipse. it does not open, it gives this alert and closed.
The JVM shared library "/System/Library/Frameworks/JavaVM.framework"
does not contain the JNI_CreateJavaVM symbol.
i am really confused and can not find a solution. i just want to run eclipse, that is all :(
thanks.

You can download and install from apple website.It works perfect for
me
http://support.apple.com/kb/DL1572?viewlocale=en_US

Update your Mac. Apple has provided new Java update which fixes this issue.

If you don't have the file /System/Library/Frameworks/JavaVM.framework/Versions/Current execute the following command
cd /System/Library/Frameworks/JavaVM.framework/Versions
sudo ln -s /System/Library/Frameworks/JavaVM.framework/Versions/A Current

I was able to solve this by first removing any previously installed versions of the Oracle Java jdk. Instructions are here:
http://docs.oracle.com/javase/7/docs/webnotes/install/mac/mac-jdk.html#uninstall
Then installing Apple's official Java JDK. For some reason the Java download page on support.apple.com came back blank for me, but via Google's cached copy of the page, I found the direct link to download, which is what finally fixed this issue for me:
http://support.apple.com/downloads/DL1572/en_US/JavaForOSX2014-001.dmg

You can download and install from apple website.It works perfect for me on mac 10.9.5
http://support.apple.com/kb/DL1572?viewlocale=en_US

Related

pyimagej setup + conda: No Java runtime present, requesting install

Problem
I'm trying to use pyimagej==0.4.0 (source). Per its README, I run the following code:
import imagej
ij = imagej.init()
And it returns the following error: No Java runtime present, requesting install.
I looked up this error in multiple articles:
Even though JRE 8 is installed on my MAC -" No Java Runtime present,requesting to install " gets displayed in terminal
https://apple.stackexchange.com/q/283858/327668
Both articles say I need the full JDK, not just the JRE. However, I think I have the full JDK.
Background
pyimagej==0.4.0
macOS Mojave v10.14.3
miniconda 4.6.14
Set up conda environment with:
conda create -n pyimagej pyimagej openjdk=8
conda activate pyimagej
Checking environment:
(pyimagej) ➜ fiji_test java -version
openjdk version "1.8.0_192"
OpenJDK Runtime Environment (Zulu 8.33.0.1-macosx) (build 1.8.0_192-b01)
OpenJDK 64-Bit Server VM (Zulu 8.33.0.1-macosx) (build 25.192-b01, mixed mode)
(pyimagej) ➜ fiji_test echo $JAVA_HOME
/usr/local/Caskroom/miniconda/base/envs/pyimagej
Can you please fill in what am I missing? Thank you in advance for any advice.
Well it turns out the problem was quite in the weeds.
It seems this problem was encountered by one of pyimagej's developers here: https://github.com/imagej/pyimagej/issues/10
The developer posed a short-term workaround of directly modifying the jdk's Info.plist.
The developer also opened a PR for a more long-term solution. Hopefully it gets closed, and then hopefully no one else will encounter this! :)

How to install openJdk 8 in windows 64 bit os

I need to install open JDK in my Windows 64-bit os. I have used ORACLE open JDK and downloaded from the below link: https://jdk.java.net/8/
While downloading I have selected Accept License Agreement and installed.
But, after the installation when I tried checking the version using command java -version it's showing like regular JDK.
Can anyone help me to get where I went wrong? Or is there any better vendor to install open JDK in windows. Thanks.
Amazon offers an open jdk for Windows (and other OS), but just for Java 8, 11 and 16.
You can download it from here: https://aws.amazon.com/es/corretto/
After installing it and running the java -version command, you will see something like this:
>java -version
openjdk version "1.8.0_242"
OpenJDK Runtime Environment Corretto-8.242.08.1 (build 1.8.0_242-b08)
OpenJDK 64-Bit Server VM Corretto-8.242.08.1 (build 25.242-b08, mixed mode)
You need to set your java version in environment of you machine and target your JDK8 bin folder, or any JDK that you want to have at your disposal when you run java -version.
The best way to do this is to use the builds from adoptopenjdk. They're very high quality and come in multiple variants for Windows ranging from zip files to MSI installers. Dead simple to install JDK 8, 11 or 15.
But, after the installation when I tried checking the version using command java -version it's showing like regular JDK.
This is because JAVA_HOME is pointing to your old JDK. You need to go to Control Panel and change the Environment Variables. Just do a search on Windows 10 for "Environment Variables" to easily find that configuration panel.
Azul Systems provides builds of OpenJDK and relative installers, for all OSes and JDK versions.
It also provides builds of the JDK with OpenJFX included.
The installers bind JAR files to be executed by Java on Windows.
Download from azul.com website
I know this is old but should anyone run across this in search of OpenJDK 8 go here
https://developers.redhat.com/products/openjdk/download

gradlew uses wrong Java version

I am working on an android application using Kotlin. I am running a kotlin linter through command line ./gradlew klint.
But it gives me an error:
Gradle 4.4 requires Java 7 or later to run. You are currently using Java 6.
When I check the project structure, I am using the embedded JDK.
I also updated android studio to latest version. I do not know how to update the embedded JDK to latest version.
java version
"1.6.0_65" Java(TM) SE Runtime Environment (build 1.6.0_65-b14-468) Java HotSpot(TM) 64-Bit Server VM (build 20.65-b04-468, mixed mode)
which java - /usr/bin/java
echo $PATH - /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/username/Library/Android/sdk/platform-tools
echo $JAVA_HOME - empty
A copy of the latest OpenJDK comes bundled with Android Studio 2.2 and higher, and this is the JDK version we recommend you use for your Android projects.
https://developer.android.com/studio/intro/studio-config.html#jdk
This however, is only for building your apps within Android Studio, not from the terminal with gradlew, otherwise, it'll use whatever is on your OS's $PATH variable.
In order to use the embedded JDK, you at least need to set JAVA_HOME, for example on Linux/Mac,
$ export JAVA_HOME=/path/to/AndroidStudio/jdk # TODO: Find this
$ ./gradlew
My recommendation, however, is to use the mechanism for your OS for installing Java.
For easy Java library management (on Linux & Mac), you can try using sdkman
gradle.properties can be updated to point to the embedded JDK that comes with Android Studio in Mac OS:
org.gradle.java.home=/Applications/Android Studio.app/Contents/jre/jdk/Contents/Home
The issue is resolved by adding :
/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin
at the start of the PATH variable . What i have found is that: There are three java locations.
Java that comes with mac (/usr/bin/java)
Java downloaded from oracle . ( /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin)
Java embedded with Android Studio (/Applications/Android\ Studio.app/Contents/jre/jdk/Contents/Home/bin/)
In my case the gradlew was always using the java from MAC (point number 1).
So when i added the " java dowloaded from oracle (point 2)" at the start of path variable it started using the one from oracle and my gradlew command ran.

Different java versions on mac machine?

There is something going wrong with my java configuration and it is really bugging me. I am using IntelliJ IDEA and after downloading and installing java 8 I tried to configure my project to use that SDK but I could only locate version 1.6 under /Library/Java/JavaVirtualMachines/. I am new to OS X and I am really confused with the paths.
Looking on my Java control panel I can see I got installed Java 8 but after running java -version on the terminal I get 1.6.0_65.
And the which java gives back /usr/bin/java.
Please help I am completely lost
Here is an example with several Java versions installed side-by-side ...
ls /Library/Java/JavaVirtualMachines/
jdk1.7.0_25.jdk jdk1.7.0_72.jdk jdk1.8.0_05.jdk jdk1.8.0_25.jdk
User can edit ~/.profile to point explicitly at one
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.7.0_72.jdk/Contents/Home
export PATH=$JAVA_HOME/bin:$PATH
And here is result ...
java -version
java version "1.7.0_72"
Java(TM) SE Runtime Environment (build 1.7.0_72-b14)
Java HotSpot(TM) 64-Bit Server VM (build 24.72-b04, mixed mode)
Well something was wrong with the installation. I completely removed the other versions (not 1.6) and reinstalled 1.8 using the default path (as there is no option to change it during installation. Now IntelliJ can see JDK 1.8
Thanks for the help anyway

Eclipse in OS X uses different version of Java than CLI

When I type java -version in the console I get java version "1.8.0_05". The soft link /System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK points to /Library/Java/JavaVirtualMachines/jdk1.8.0_05.jdk/Contents. In the java preferences window, the only listed version of Java is 1.8. JAVA_HOME is set to /Library/Java/JavaVirtualMachines/jdk1.8.0_05.jdk/Contents/Home.
However, when I try to run Eclipse.app, I get the error: Version 1.6.0_65 of the JVM is not suitable for this product. Version: 1.7 or greater required.
I believe it is trying to use /System/Library/Java/JavaVirtualMachines and in that directory the only version is 1.6.0.jdk.
How can I get eclipse to use the correct version of Java?
I solved this issue in my mac with yosemite:
Installed JDK for MACOSX 64bits from https://jdk8.java.net/download.html
Inside the eclipse.ini I put this line:
-vm /Library/Java/JavaVirtualMachines/jdk1.8.0_40.jdk/Contents/Home
And it worked for me!
Download the 64-bit version of Eclipse instead of the 32-bit version.
The reason is that Eclipse contains native machine code (for the GUI) which is why there is both a 32-bit and 64-bit version of Eclipse, and this explicitly require the corresponding Java version. Originally Apple created both versions up to Java 6, but Oracle only creates a 64-bit version (much to the dismay of owners of older machines). So, if you download a 32-bit version of Eclipse it will only run with an Apple JVM, which apparently is too old (which surprise me - I thought Java 6 was still supported for Eclipse 4.4)
I faced this same problem but rather than making it to use version 1.8 I changed the settings in eclipse.ini file so I can just run the program regardless which version of jvm does it want to use
Solution:
Open the directory where you have Eclipse copy in your computer.
You would see a file name eclipse press control key and click on it to see the options.
Then click on Show Originalfrom the options, there you would find eclipse.ini file open it with a text editor and change the -Dosgi.requiredJavaVersion=1.7 to -Dosgi.requiredJavaVersion=1.6
Save the file and open the ecplise.app it should open now without any error
Try adding the following lines to your eclipse.ini:
-vm
/Library/Java/JavaVirtualMachines/jdk1.8.0_05.jdk/Contents/Home
Maybe a newer version of eclipse could help, too (if yours is out of date).
Take a look in your System Preferences -> Java. It should open the Java Control Panel. In the panel, check if you have one (or many) JDKs.
I suspect you have many and are setting the JDK in your .profile while Eclipse is reading some other Java Home.
You can change them manually by running this in your terminal
export JAVA_HOME=`/usr/libexec/java_home -v 1.8`
To check if it worked, run java -version and you should see something like
java version "1.8.0_05"
Java(TM) SE Runtime Environment (build 1.8.0_05-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.5-b02, mixed mode)
Try calling Eclipse now from the command line. To call Eclipse as an App, just set the Java8 through the Java Control Panel. This will be read when Eclipse starts.
This is what I have on my Java Control Panel:
This is on my Eclipse Luna:
Download the 64-bit version of Eclipse.
This solved the problem. Thanks everyone.

Categories