VsCode does not indicate the correct version - java

Why not specified correct version of java JRE in my vscode ?
Here is my java version.
$java -version
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)
And env path here,
$env | grep JAVA
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_191.jdk/Contents/Home
And user setting in vscode,
"java.home": "/Library/Java/JavaVirtualMachines/jdk1.8.0_191.jdk/Contents/Home",
When open java project in vscode, next error occurred.
enter image description here
Hello.Thank you.

Related

How to set Java -version is returning jdk instead if java

Hello I installed java on my MacOS but its not working as expected.
When I do java -version below is the output I am getting instead of right version number:
abc#xxxxx ~ % java -version
openjdk version "15" 2020-09-15
OpenJDK Runtime Environment AdoptOpenJDK (build 15+36)
OpenJDK 64-Bit Server VM AdoptOpenJDK (build 15+36, mixed mode, sharing)
I see this is want installed under system and user:
Expected Output:
1234$ java -version
java version "1.8.0_261"
Java(TM) SE Runtime Environment (build 1.8.0_261-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.261-b12, mixed mode)
Perhaps you should fix your JAVA_HOME.
Here's the easiest way I know. Just add this to your ~/.bash_profile and ~/.zshenv:
export JAVA_HOME="$(/path/to/your/java)"
Then restart your terminals/IDEs.

java 11, running sdkmanage results in java.lang.module.FindException: Module java.se.ee not found

i tried
export JAVA_OPTS='-XX:+IgnoreUnrecognizedVMOptions --add-modules java.se.ee'
and some old solutions here for java 9 same error but nothing work. please help
OS: mac. java version:
Users-MacBook-Pro:Users user$ java --version
java 11.0.2 2019-01-15 LTS
Java(TM) SE Runtime Environment 18.9 (build 11.0.2+9-LTS)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.2+9-LTS, mixed mode)
open sdkManager:
Users-MacBook-Pro:~ user$ /Users/user/android/tools/bin/sdkmanager ; exit;
Error occurred during initialization of boot layer
java.lang.module.FindException: Module java.se.ee not found
logout
Saving session...
...copying shared history...
...saving history...truncating history files...
...completed.
[Process completed]
EDIT - MORE DATA:
I installed java 8 as well and run this command:
export JAVA_HOME=`/usr/libexec/java_home -v 1.8`; java -version
and got:
java version "1.8.0_202"
Java(TM) SE Runtime Environment (build 1.8.0_202-b08)
Java HotSpot(TM) 64-Bit Server VM (build 25.202-b08, mixed mode)
But sdkmanage still gives the same error.
By the way, when close an open again the terminal, running java -version results again with:
java version "11.0.2" 2019-01-15 LTS
Java(TM) SE Runtime Environment 18.9 (build 11.0.2+9-LTS)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.2+9-LTS, mixed mode)
Is it OK?
UPDATE 1.4
I have change the .bash_profile file to this:
export JAVA_HOME=`/usr/libexec/java_home -v 1.8.0_202`
unset JAVA_OPTS
and running env give:
Users-MacBook-Pro:~ user$ env
TERM_PROGRAM=Apple_Terminal
SHELL=/bin/bash
TERM=xterm-256color
TMPDIR=/var/folders/9t/4jx8w7_s6f5blrh1yly746z80000gn/T/
Apple_PubSub_Socket_Render=/private/tmp/com.apple.launchd.gDNTyh8LPx/Render
TERM_PROGRAM_VERSION=404.1
TERM_SESSION_ID=8F5607E3-18FE-467B-B843-58F71D03F9B0
USER=user
SSH_AUTH_SOCK=/private/tmp/com.apple.launchd.jY4TgxEWu3/Listeners
PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
PWD=/Users/user
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_202.jdk/Contents/Home
XPC_FLAGS=0x0
XPC_SERVICE_NAME=0
SHLVL=1
HOME=/Users/user
LOGNAME=user
LC_CTYPE=UTF-8
_=/usr/bin/env
Users-MacBook-Pro:~ user$
running sdk manager still give the same error
I had the same problem and I did this:
export APP_HOME=/path/to/my/java-8
export JAVA_HOME=/path/to/my/java-8
On the other hand, if you want to keep this configuration on reboot or in other terminal, you must put these lines on ~/.bashrc file

Installing eclipse mars on Linux

I just downloaded the linux 64 bit tar for eclipse mars. When I try and run the installer it gives me the following message
Version 1.6.0_31 of the JVM is not suitable for this product.
Version: 1.7 or greater is required.
I am on java version 1.8. See
$java -version
java version "1.8.0_65"
Java(TM) SE Runtime Environment (build 1.8.0_65-b17)
Java HotSpot(TM) 64-Bit Server VM (build 25.65-b01, mixed mode)
Where does it get the 1.6 version of java?
.cshrc.mine
setenv $JAVA_HOME /path/to/Java8
setenv PATH /path/to/Java8/bin/:$PATH
Also
$ java -XshowSettings:properties -version
Property settings:
// Other props
java.runtime.name = Java(TM) SE Runtime Environment
java.runtime.version = 1.8.0_65-b17
java version "1.8.0_65"
Java(TM) SE Runtime Environment (build 1.8.0_65-b17)
Java HotSpot(TM) 64-Bit Server VM (build 25.65-b01, mixed mode)
Try specify the JDK/JRE path by adding the following two lines into the beginning of your eclipse.ini file:
-vm
[your-path-to-java-executable]
In your eclipse.ini file you should point to java8
-vm
/opt/jdk18025/bin/javaw.exe

What is the source of the discrepancy in Java versions: Java 6 (in Terminal, Eclipse) and Java 7 (in Java Control panel)?

Eclipse complains: JRE version is 1.6.0; version 1.7.0 or later is needed to run Google Plugin for Eclipse.
In the Terminal, java concurs:
> java -version
java version "1.6.0_65"
Java(TM) SE Runtime Environment (build 1.6.0_65-b14-462-11M4609)
Java HotSpot(TM) 64-Bit Server VM (build 20.65-b04-462, mixed mode)
But in System Preferences \ Java \ the Java Control Panel says Your system has the recommended version of Java: Java 7 Update 51
and points to /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java.
Eclipse preferences show that the installed JRE is at:
/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
To point Eclipse to Java 7 (1.7.0), it's enough to change the preference:
What is the source of the discrepancy in Java versions? Is this an instance of having different PATHs between the command-line Mac and the windowed-Mac?
Edit
If I edit /usr/local/adt-bundle-mac-x86_64/eclipse/Eclipse.app/Contents/MacOS/eclipse.ini by adding
-vm
"/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java"
Eclipse refuses to start.
And yet this is indeed 1.7:
> "/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java" -version
java version "1.7.0_51"
Java(TM) SE Runtime Environment (build 1.7.0_51-b13)
Java HotSpot(TM) 64-Bit Server VM (build 24.51-b03, mixed mode)
If you want to be certain of the JVM that is used to run Eclipse, you need to specify it in your eclipse.ini file, according to these instructions.
Installing this update might fix your problem:
http://support.apple.com/kb/dl1572

Change Java version terminal uses

my first post on this forum, so please give me a break. Recently I installed java 7 for my computer, but I had downloaded java 6 before. Currently the Java control panel and the java website tells me that I have Java 7. However, when I go into the terminal and type: java -version, it comes up with:
java version "1.6.0_65"
Java(TM) SE Runtime Environment (build 1.6.0_65-b14-462-11M4609)
Java HotSpot(TM) 64-Bit Server VM (build 20.65-b04-462, mixed mode)
I am aware that terminal accesses java from the path '/usr/bin/java', and the control panel accesses java from the path '/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java', so how can I change the terminal path to java?
Try using $ export JAVA_HOME=$(/usr/libexec/java_home -v 1.7) - it's the canonical way to switch Java versions.
Here's what it looks like on my machine:
$ export JAVA_HOME=$(/usr/libexec/java_home -v 1.6)
$ java -version
java version "1.6.0_65"
Java(TM) SE Runtime Environment (build 1.6.0_65-b14-462-11M4609)
Java HotSpot(TM) 64-Bit Server VM (build 20.65-b04-462, mixed mode)
$ export JAVA_HOME=$(/usr/libexec/java_home -v 1.7)
$ java -version
java version "1.7.0_11"
Java(TM) SE Runtime Environment (build 1.7.0_11-b21)
Java HotSpot(TM) 64-Bit Server VM (build 23.6-b04, mixed mode)

Categories

Resources