Once again, I spent much time trying to get something to work without success.
I want to install MATLAB Compiler Runtime on my Ubuntu 13.04, where there is no MATLAB installed.
Here's what I did:
I downloaded the 64-bit Linux version R2012b(8.0) off of
http://www.mathworks.com/products/compiler/mcr/index.html?s_cid=BB.
Then, I switched into the folder and tried to install via
sudo ./install just to receive the following message:
Error: Cannot locate Java Runtime Environment (JRE).
The directory /home/konni/Downloads/MCR_R2012b_glnxa64_installer/sys/java/jre/glnx86/jre does not exist.
And, it does not exist indeed, but there exists a folder with "glnxa86" instead of "glnx86". I wouldn't just want to rename it, though.
I do have a JRE installed on my machine, btw:
java version "1.7.0_25"
OpenJDK Runtime Environment (IcedTea 2.3.10) (7u25-2.3.10-1ubuntu0.13.04.2)
OpenJDK Server VM (build 23.7-b01, mixed mode)
I have absolutely no clue what to do. The problems I found using google didn't quite help me, either...
Maybe you have an idea?
I'd greatly appreciate any help! :-)
If the only problem is finding the JRE, then the command line switch -javadir will get you done:
./install -javadir /usr/lib/jvm/java-7-openjdk-i386/jre/
I had the same problem recently when installing a software that required a 7.13 MCR on an Ubuntu 17.10.
In this
https://www.linuxquestions.org/questions/linux-newbie-8/matlab-7-5-compiled-runtime-for-64-bit-linux-installation-no-jre-error-838281/
I found that the 32 bit version installs fine, and it did, but obviously, that didn't solve my problem.
However, I found a way to do it. The trick is that the installer needs the old JRE (1.5) and will not work with JDK 8.
So the first step is to run
./MCRInstaller.bin -is:extract
this will create a directory called istemp... something, for me istemp23732345211606.
ls
jre1.5.0-linux-amd64.bin JVMNotFound.txt setup.jar Verify.jar
It is tempting to run the setup.jar directly, do try, but with Java 8, I only got the following error message:
Could not load wizard specified in /wizard.inf (104)
But perhaps it will work for you. People who get the above mentioned error with wizard.inf should look further, because the installer needs JDK 5 to run.
I chose not to use the bundled version but downloaded the JDK 5 from Oracle. The bundled version might work as well - I did not try.
You can download JDK 5 from here:
http://www.oracle.com/technetwork/java/javasebusiness/downloads/java-archive-downloads-javase5-419410.html#jdk-1.5.0_22-oth-JPR
Extract the downloaded archive (chmod +x the bin and run), then copy the files to /usr/lib/jvm/java5
Rename the jdk1.5.0_022 or anything to jdk1.5.0 to make it simple.
Fix attributes:
sudo chmod a+x /usr/bin/java
sudo chmod a+x /usr/bin/javac
sudo chmod a+x /usr/bin/javaws
sudo chown -R root:root /usr/lib/jvm/java5/jdk1.5.0
Then run:
sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/java5/jdk1.5.0/bin/java" 1
sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/jvm/java5/jdk1.5.0/bin/javac" 1
Now chose the jdk 5 as default
sudo update-alternatives --config java
And selecting the appropriate option.
Check that it worked
java -version
You should see something like this:
java version "1.5.0_22" Java(TM) 2 Runtime Environment, Standard
Edition (build 1.5.0_22-b03) Java HotSpot(TM) 64-Bit Server VM (build
1.5.0_22-b03, mixed mode)
Now you can run the setup.jar file in the extracted directory (istemp...)
sudo java -jar setup.jar
I recommend that you chose a contemporary java by running
sudo update-alternatives --config java
again.
When running the installer.sh, use the command line option "-is:javahome [path to your java jre folder]".
For instance, I installed below a java 8 jre on an old matlab compiler 2007b as follow:
sudo /opt/installer.sh -console -is:javahome /usr/lib/jvm/java-8-openjdk-amd64/jre/
I had same problem. The problem is you are installing 64-bit matlab on 32-bit ubuntu. use 32-bit matlab and install in ubuntu 32-bit. use 64-bit matlab and install in ubuntu 64-bit. Please like the answer if it was helpful.
Related
I'm a newbie and am confused over the setup for one of my cs courses.
I originally have Java 8 in both Windows and Ubuntu, but then I realised that I need to use jshell for testing in Ubuntu as well, which is only available for Java 9 and higher.
Hence I downloaded the newest Java 19 on my windows but Ubuntu doesn't recognise it and still use Java 8.
How can I go around to update the Java in Ubuntu as well without having to redownload it again?
Below is on my Ubuntu terminal:
hejin#LAPTOP-8I6A5M2K:~/cs2030s$ java.exe -version
java version "1.8.0_351"
Java(TM) SE Runtime Environment (build 1.8.0_351-b10)
Java HotSpot(TM) 64-Bit Server VM (build 25.351-b10, mixed mode)
hejin#LAPTOP-8I6A5M2K:~/cs2030s$ javac.exe -version
javac 1.8.0_351
hejin#LAPTOP-8I6A5M2K:~/cs2030s$ jshell.exe
jshell.exe: command not found
hejin#LAPTOP-8I6A5M2K:~/cs2030s$ jshell
Command 'jshell' not found, but can be installed with:
sudo apt install openjdk-11-jdk-headless # version 11.0.17+8-1ubuntu2~22.04, or
sudo apt install openjdk-17-jdk-headless # version 17.0.5+8-2ubuntu1~22.04
sudo apt install openjdk-18-jdk-headless # version 18.0.2+9-2~22.04
sudo apt install openjdk-19-jdk-headless # version 19.0.1+10-1ubuntu1~22.04
(to be honest I don't know why it seems others can do fine with just java Hello.txt and javac Hello.txt but I have to add .exe at the back.
And below is my command prompt terminal:
C:\Users\User>java -version
java version "19.0.1" 2022-10-18
Java(TM) SE Runtime Environment (build 19.0.1+10-21)
Java HotSpot(TM) 64-Bit Server VM (build 19.0.1+10-21, mixed mode, sharing)
C:\Users\User>javac -version
javac 19.0.1
C:\Users\User>jshell -version
jshell 19.0.1
C:\Users\User>jshell
| Welcome to JShell -- Version 19.0.1
| For an introduction type: /help intro
jshell> 1 + 1
$1 ==> 2
jshell>
I am confused over what some answers I searched online talked about changing the environment variable path as well... When I checked the advanced system settings the jdk19 path seems already there.
screenshot of my system settings environment variables
Here are a few things to check with your path dealings Windows -> WSL Ubuntu. On Windows you can confirm where java is found by:
echo %Path%
=> should print list of colon separated folders on your path example:
C:\java\jdk-20\bin;etc
which java.exe
=> should print name of java.exe found inside %Path% example:
C:\java\jdk-20\bin\java.exe
When you run wsl.exe to load WSL Linux distribution the Windows Path is translated to Linux semi-colon separated PATH without drive letters:
C:\java\jdk-20\bin;etc => /mnt/c/linux/jdk-20/bin:etc
On WSL Linux check where it looks up PATH:
echo $PATH
=> should print list of colon separated folders on your path:
/mnt/c/linux/jdk-20/bin:etc
=> its likely you have 2 JDK in Linux PATH
which java.exe
=> finds "java.exe" of the first JDK in the Linux PATH
Have a look at any WSL Ubuntu bash profiles which may also override PATH in WSL to see what causes the 2nd JDK in path - typically ~/.bashrc or ~/.profile and fix so the later JDK19 is first or only JDK one resolved.
Note that fixing WSL Linux to access Windows JDK introduces a new issue if you actually need Linux JDK, but you could always use "java" vs "java.exe" from WSL if you need to work in both JDK platforms from Linux.
I'm trying to run the command sudo apt update on my terminal in MacOS
I'm getting this message in response: The operation couldn’t be completed. Unable to locate a Java Runtime that supports apt. Please visit http://www.java.com for information on installing Java.
I saw a similar question here, however even though I made sure to install the JDK like the solution suggested I'm still getting the same response.
I also tried pasting
export PATH="$HOME/.jenv/bin:$PATH"
eval "$(jenv init -)"
export JAVA_HOME="$HOME/.jenv/versions/`jenv version-name`"
Into my .zshrc.save folder and had no luck.
When I run java -version in the terminal this is what I get back:
java version "15.0.2" 2021-01-19
Java(TM) SE Runtime Environment (build 15.0.2+7-27)
Java HotSpot(TM) 64-Bit Server VM (build 15.0.2+7-27, mixed mode, sharing)
20 years ago, java shipped with a tool called apt: Annotation Processor Tool. This tool was obsolete not much later.
What that update-node-js-version is talking about, is a completely and totally unrelated tool: It's the Advanced Package Tool, which is a tool to manage installations on debian and ubuntu - linux distros. You do not want to run this on a mac, and the instructions you found are therefore completely useless: That is how to update node-js on linux. Your machine isn't linux.
Search around for answers involving brew, which is the go-to equivalent of apt on mac. And completely forget about java - this has NOTHING to do with java - that was just a pure coincidence.
Install Homebrew on your Mac Machine
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
For the system Java wrappers to find this JDK, symlink it with
sudo ln -sfn /usr/local/opt/openjdk/libexec/openjdk.jdk /Library/Java/JavaVirtualMachines/openjdk.jdk
If you need to have openjdk first in your PATH, run:
echo 'export PATH="/usr/local/opt/openjdk/bin:$PATH"' >> ~/.profile
For compilers to find openjdk you may need to set:
export CPPFLAGS="-I/usr/local/opt/openjdk/include"
The below commands worked for me.
First, install the homebrew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Then set the Android Studio Java path to the Home(If you have Android Studio). If not then you take the respective Java path & export it to the JAVA Home path.
export JAVA_HOME=/Applications/Android\ Studio.app/Contents/jre/Contents/Home
I want to install an NPM express generator:
sudo apt npm install -g express-generator
It throws the following error:
Unable to locate an executable at "/Library/Java/JavaVirtualMachines/openjdk-14.0.1.jdk/Contents/Home/bin/apt" (-1)
I installed Java in this path (it's not in the System/Library/ - maybe thats the issue?):
'MacintoshSSD/Library/Java/JavaVirtualMachines/openjdk-14.0.1.jdk/Contents/Home'
My .bash_profile looks like that:
export JAVA_HOME=$(/usr/libexec/java_home)
If I check JAVA_HOME it looks fine:
echo $JAVA_HOME
/Library/Java/JavaVirtualMachines/openjdk-14.0.1.jdk/Contents/Home
.. and Java version:
java --version
openjdk 14.0.1 2020-04-14
OpenJDK Runtime Environment (build 14.0.1+7)
OpenJDK 64-Bit Server VM (build 14.0.1+7, mixed mode, sharing)
Any idea why it still can find an exectuable?
I an other thread I read about a possible conflict between the pre-installed macOS Java-Version and the Orcalce Java-Version enter link description here but I couldn`t work it out..
And could you explain to me the difference between java_home and JAVA_HOME?
Sorry, I just saw what's wrong...
There used to be an apt tool in Java, but it's gone now. Your mistake is using the linux command line. On many linux systems, another tool called apt is used for installing software.
Check the npm documentation on how to install npm on your Mac, as there are different ways to do it.
Once npm is installed, run sudo npm install -g express-generator (no apt here).
Explanation of the error message
The Java apt-tool was removed in JDK 8. But as JAVA_HOME/bin is normally not on your PATH on Mac, apple provides simple wrappers for all the commands under JAVA_HOME. There still is such a wrapper for apt that tries to run a program with the same name from your Java installation. That's why you get that error message.
conflict between the pre-installed macOS Java-Version and the Orcalce Java-Version:
Apple stopped pre-installing Java in macOS 10.7 so this should not be an issue.
difference between java_home and JAVA_HOME:
JAVA_HOME is an environment variable that points to your Java installation. java_home is a utility program in macOS that makes it easier to correctly set up your JAVA_HOME by listing installed Java versions and the values to use for JAVA_HOME.
I'm having trouble removing Java 9 from my macOS Sierra system.
I accidentally installed Java 9, instead of Java 8, so now all my Eclipse projects give me these warnings: Build path specifies execution environment JavaSE-1.8. There are no JREs installed in the workspace that are strictly compatible with this environment.
I have used the following guide, but it did not work. Here is my command output when running java -version from the command line:
java version "9"
Java(TM) SE Runtime Environment (build 9+181)
Java HotSpot(TM) 64-Bit Server VM (build 9+181, mixed mode)
for macOS high sierra removing java 9:
delete the java folder you find in the dir shown to you after executing:
/usr/libexec/java_home -V
use "Go to" in finder and copy and paste the dir to get there
There are two commands which are very simple and useful. If you want to keep multiple versions simply set JAVA_HOME to version you want to use.
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_(version you want to use).jdk/Contents/Home
Example--> export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home
Else in addition to above command remove/uninstall additional jdk version from your system with below command.
sudo rm -rf /Library/Java/JavaVirtualMachines/jdk-(version you want to remove).jdk/
Example --> sudo rm -rf /Library/Java/JavaVirtualMachines/jdk-9.0.4.jdk/
Please refer below github link for additional details -->
https://gist.github.com/schnell18/bcb9833f725be22f6acd01f94b486392
Thanks
On MacOS you can list what JDKs you have installed and where they are installed to with:
/usr/libexec/java_home -V
If you want to select one of the installed JDKs to be used as default, you can do:
/usr/libexec/java_home -v 1.8
Verify which is now default with java -version.
You can manually add the location of other installed JREs in Eclipse via Preferences / Java / Installed JREs , press Add, and then point it to one of the locations should with the -V option above. You can then check it to select which is default for your projects.
After viewing which Java Virtual Machines I had on my computer using the following command:
ls /Library/Java/JavaVirtualMachines
I realized no additional JDK's would appear after using the Java 8 installer (besides Java 9). When doing further research, it turns out I had installed the other version that is not a SE development kit and it was just working in web browsers, not for the terminal.
For anyone having the same issue, make sure you use the Java SE Development Kit 8.
Uninstall Oracle Java using the Terminal:
Note: To uninstall Java, you must have Administrator privileges and execute the remove command either as root or by using the sudo tool.
Remove one directory and one file (a symlink), as follows:
Click on the Finder icon located in your dock
Click on the Utilities folder
Double-click on the Terminal icon
In the Terminal window Copy and Paste the commands below:
sudo rm -fr /Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin
sudo rm -fr /Library/PreferencePanes/JavaControlPanel.prefPane
sudo rm -fr ~/Library/Application\ Support/Java
Do not attempt to uninstall Java by removing the Java tools from /usr/bin. This directory is part of the system software and any changes will be reset by Apple the next time you perform an update of the OS.
Source:https://www.java.com/en/
I believe the problem is navigating to the correct directory... Once you are where you are supposed to be you can run the sudo commands to remove whichever versions of java you want to remove.
First, run the command in the terminal to determine which version of Java you are running,
java -version
then you can navigate to pesky version of java that you intend to delete by using the following command:
cd /Library/Java/JavaVirtualMachines
then once you see are in the JavaVirtualMachines path, type in ls to see what versions of Java you have installed,
ls
and finally when you know which version or versions of Java you want to uninstall:
sudo rm -rf jdk-10.0.1.jdk #or whichever version you want to delete
I know that you've asked about how to uninstall the java version. But, I think it's important how to manage your Java version in a very good way.
For me, the best way is using SDKMan, a very nice tool for managing you Development tools like Java.
Here you can learn more about it: http://sdkman.io/
You can install your Java version as follow:
$ sdk install java
You can install others tools like Scala:
$ sdk install scala 2.12.1
Uninstall your tools very easy:
$ sdk uninstall java 9
And so on. Hope this helps you in future installation of your development tools.
my configurations are
hduser#worker1:/usr/local/hadoop/conf$ jps
The program 'jps' can be found in the following packages:
* openjdk-6-jdk
* openjdk-7-jdk
Ask your administrator to install one of them
I have java installed though
hduser#worker1:/usr/local/hadoop/conf$ java -version
java version "1.6.0_23"
OpenJDK Runtime Environment (IcedTea6 1.11pre) (6b23~pre10-0ubuntu5)
OpenJDK 64-Bit Server VM (build 20.0-b11, mixed mode)
hduser#worker1:/usr/local/hadoop/conf$ echo $JAVA_HOME
/usr/lib/jvm/java-1.6.0-openjdk
and also set up in conf/hadoop-env.sh
hduser#worker1:/usr/local/hadoop/conf$ cat hadoop-env.sh | grep JAVA_HOME
# The only required environment variable is JAVA_HOME. All others are
# set JAVA_HOME in this file, so that it is correctly defined on
export JAVA_HOME=/usr/lib/jvm/java-1.6.0-openjdk
How can I make JPS work?
Saurabh Saxena's answer above is no longer correct.
To get jps, you want to also install the development tools java-1.6.0-openjdk-devel.
On CentOS 6 the file is:
java-1.6.0-openjdk-devel.x86_64
So:
yum install java-1.6.0-openjdk*
will do the trick (also picks up demo and javadocs besides the jdk and dev tools, but you will get the full complement of command line tools).
For Ubuntu:
apt-get install java-1.6.0-openjdk-devel
For all these examples, you can try JDK7 (just substitute 1.7), and as of December 2012, Hadoop is pretty stable without the Oracle libraries. See: http://openjdk.java.net/install/
This might also be a reason. Its simple: See if $javac works. Note: $java might work, check javac. If $javac is not working then $jps will not work either.
So you might want to do something like
export PATH=$PATH:$JAVA_HOME/bin
and try again. both javac and jps.
good luck.
I have found the solution for the missing JPS command. I was installing Hadoop 1.x on ubuntu machine in a pseudo distributed mode. I used Java-7-openJDK to provide for the Java commands and tools. For some reason there was a java-1.6.0-openjdk-devel for version 6 but none for version 7 specifically debian and ubuntu distributions. I am not sure if the same is true for Fedora and Redhat. So the best answer as that time was using the linux command
ps -aux | grep java
I hated doing that because Hadoop daemons start with so many options that each result fills up more than a screen. Apart from seeing that java is running it is impossible to see what hadoop daemons are running. Hence i came up with a short soultion in the form of one line shell script
This is my JPS scirpt for open JDK
!#/bin/bash
ps -aux | grep java | awk '{print $12}'
END
I saved these two lines in a file named jps and stored it in the hadoop/bin directory with execute permissions
**Here is the result of the script
hduser#localhsot# ./jps
-Dproc-namenode
-Dproc-datanode
-Dproc-JobTracker
-Dproc-TaskTracker**
It seems like open-jdk does not have jps in it.
For hadoop, installing sun-jvm would be a better choice.
try this....
sudo apt-get install openjdk-7-jdk
I would like to update topic for those who would face the same problem.
JDK8 also does not have the "jps" command but JDK7 does have it.
root#tahirpc:/home/tahir# java -version
java version "1.7.0_65"
OpenJDK Runtime Environment (IcedTea 2.5.3) (**7u71-2.5.3-0ubuntu0.14.04.1**)
OpenJDK 64-Bit Server VM (build 24.65-b04, mixed mode)
root#tahirpc:~# jps
5036 NodeManager
4368 NameNode
4912 ResourceManager
5315 Jps
4773 SecondaryNameNode
4487 DataNode
Use sudo apt-get install openjdk-7-jdk and not openjdk-7-jre. .
For java 8 in ubuntu use the following command.
sudo apt install openjdk-8-jdk-headless
For Hadoop, Oracle JDK 6 preferred, I am not sure if someone has used OpenJDK with Hadoop successfully without any patches. FYI, there had been some talks about support for JDK 7 also. For now, there is too much dependency on Oracle JDK. Hope the dependency goes away soon.
I found it
rpm -qlp java-1.6.0-openjdk-devel-1.6.0.0-1.39.1.9.7.el6.x86_64.rpm | grep jps
/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/bin/jps
then
rpm -i java-1.6.0-openjdk-devel-1.6.0.0-1.39.1.9.7.el6.x86_64.rpm
Open syneptics package manager and install openjdk-7-jdk and openjdk-6-jdk package. AFter that jps will work