So I installed Java 7 and verified that it was installed Java now shows up under System preferences. However when I run java -version it still returns
java version "1.6.0_65
How do i fix this so that my computer points to the correct version? Also, is this a problem in the future if i choose to not fix this?
Thanks
You need to set your java 7 directory bin path to system PATH variable. As you are using Mac OS, use this article to set path correctly:
JAVA HOME in Mac OS
Use the following command to list the installed versions of Java:
/usr/libexec/java_home -V
From the output of the above command, copy the path for the version of Java you want to use.
Open up your ~/.bash_profile or ~/.bashrc file and add/edit the line:
export JAVA_HOME=/Path/copied/from/step/2
In your terminal, reload the the file you edited in the previous step using the corresponding command below:
source ~/.bash_profile
source ~/.bashrc
Now, you should see the the correct version of Java on the command line:
java -version
Related
Java -version in Linux is not seem to be working and returing -bash: java: command not found error,though im able to run java related apps.
I have installed jdk in my new linux machine and i have set the environment variable JAVA_HOME using which i can execute JAVA apps and I can echo the java path i set.
Problem is i can not see the java version i have installed ,using the command java -version (i want to know that everything is set fine)
can someone guide me ,what i am missing here.
You should have your java installation directory added to PATH environment variable in order to use java from terminal. For example:
export PATH=<your java Directory>/bin:$PATH
I'm testing out some code on a computer running Windows 8.1.
I'm using the command prompt and I can't seem to get javac (or javaC) to compile my text file. I've added the path as an environment variable (...\bin) and it doesn't do work. java -version and java prints information to the console, just can't get javac to work.
Seems like you are having JRE installed on your machine. You can go to your JAVA_HOME/bin folder, check if javac file is there or not. If not, it means you have JRE installed. You need to install java JDK.
FOr download jdk, this is the url for JDK 8:
http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
Previous version available here:
http://www.oracle.com/technetwork/java/archive-139210.html
My Talend tool version is 5.6. As mentioned in Talend documentation it needs Java Runtime Environment 7 i.e jdk1.7, which is installed - along with set java_home in my environment variables. As per me it should work.
However I have jdk1.8 installed too, but I'm correctly pointing jdk1.7 path at environment variable.
Alternatively I have tried giving jdk1.7 path in Talend's Talend-Studio-win-x86_64.ini file. It's still giving me error.
Below is snapshot: in cmd the installed version shows jdk1.8 where in echo %JAVA_HOME% it shows path of jdk1.7
While starting tool this error comes:
Create a batch file with the following command:
Talend-Studio-win-x86_64.exe -vm "[jdk path]\bin"
Then start the studio by executing this batch.
Talend is based on eclipse, so you can set the java vm to use in the ini-file. (Sorry, I don't have an installation here right now, I think it is called talend.ini - nevertheless, it is located in talend's installation folder.)
Add the following to the top of the file:
-vm
[path to your java 7]/bin/javaw.exe
try to make changes in TOS_DI-win-x86_64.ini file
add line
-vm
C:\Program Files\Java\jdk-11.0.14\bin\javaw.exe
And update or confirm the version as below.
-Dosgi.requiredJavaVersion=11.0.14
Hope it'll help to fix the issue
Suppose you have talend in c:\talend and jdk1.7 is in C:\jdk1.7.
You can do like the following in windows environment.
Open command prompt.
Goto the bin folder location where jdk 1.7 is located. For example if you have jdk in C:\jdk1.7 then
cd\
cd C:\jdk1.7\bin
Then from bin folder of jdk type the full uri of the executable and hit enter.
In the above supposition c:\jdk1.7\bin>c:\talend\tos_di-xxxxx.exe
In the above statement tos_di-xxxxx.exe is the executable file depending on the os environment
I'm trying to update my JVM and downloaded the dmg from java.com and installed it and now I see java has been updated to 1.7.0_55, but for some reasons /usr/libexec/java_home -v 1.7 doesn't return the new jdk but the old one (native to OS X).
chienandalusialocal:TempEc ngw$ /usr/libexec/java_home -v 1.7
Unable to find any JVMs matching version "1.7".
/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
How should I fix this? Shouldn't the installer configure a working environment?
TIA,
ngw
You need to update your JAVA_HOME enviroment variable to point at the JVM you want to use; In factory distributions of OSX, the JAVA_HOME (specified in your ~/.bash_profile) will point to the JDK 1.6.0 installed in /System/Library/Java/JavaVirtualMachines
A simple fix; You need to change the JAVA_HOME variable at login, so you need to change a line in the text file ~/.bash_profile, which is run whenever you login.
In terminal:
type: open /Library/Java/JavaVirtualMachines to open Finder in the location of your JVMs. Get the folder name of the JVM you want to use, and save that for later.
type: open -a TextEdit ~/.bash_profile, and the file will open in TextEdit.
look for a line that says:
export JAVA_HOME="/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home" or
JAVA_HOME="/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home"
export JAVA_HOME
and change to
export JAVA_HOME="/Library/Java/JavaVirtualMachines/YOUR_JDK/Contents/Home"
where YOUR_JDK is the folder name of the JVM you want to use that you found earlier.
Restart terminal to test the effects, and type java -V to see if it is working.
See https://superuser.com/questions/490425/how-do-i-switch-between-java-7-and-java-6-on-os-x-10-8-2
I need to run a java -jar on command line and so installed jdk6 but whenever i do java -version in command line it still shows the old version (1.3) How do I update it to show the latest version ??
Add the new Java bin folder to your path. And remove any other java references from your path.
You should set the PATH environment variable. On the command prompt, do:
> set JAVA_HOME=c:\java\jdk1.6.0_20
> set PATH=%JAVA_HOME%\bin;%PATH%
Now doing java -version should give you the expected version information.
The JDK install does not update the default Java installation on the system.
Go to http://java.com/en/download/installed.jsp and use the suggested installation procedure there when it finds that your default Java is outdated.