I extracted the android SDK into a folder i made called "/usr/android/android-sdk-linux". I go into "tools/" and double click the executable file "android", click "Run in Terminal" but nothing happens. I also click "Run" but again nothing happens. i run it in terminal (./android command), and i get:
./android: 1: ./android: java: not found
./android: 1: ./android: java: not found
./android: 110: exec: java: not found
So why is this happening?
Edit: Here are the results of ~$ java
* default-jre
* gcj-4.6-jre-headless
* openjdk-6-jre-headless
* gcj-4.5-jre-headless
* openjdk-7-jre-headless
All i had to do was sudo apt-get install openjdk-7-jdk. Never trying a manual installation again. oh and sorry for my ignorance on the previous answers.
when you are using Debian based Linux Distribution, the better solution if you install JDK manually (not from repository) is by make a symbolic link that point to a java command.
I solved this problem. Create a symbolik link named /usr/bin/java dan point it to /home/your_name/your_jdk_folder/bin/java
This is the sample command in terminal/konsol
sudo ln -s /home/azware/tmp/jdk1.7.0_03/bin/java /usr/bin/java
Using Ubuntu 14.04 with Sun JDK 1.8 in /opt/jdk I solved this problem with this:
sudo update-alternatives --install /usr/local/bin/java java /opt/jdk/bin/java 0
sudo update-alternatives --install /usr/local/bin/javac javac /opt/jdk/bin/javac 0
This uses the Debian-based alternatives system that Ubuntu also uses. Please note that this is in the case that you don't have any other Java (i.e. OpenJDK) installed. If you have another Java installed, chances are you already have an alternative installed for it. Consult the update-alternatives man page to see how the system works.
It looks like you don't have java installed. Try just running java - is that not found?
Make sure that you have the Java6 JDK in particular, installed.
I was using android studio on ubuntu 14.04, 64bit and this error was caused due to the file permission issues in $home/android-studio/sdk/tools
$sudo chmod -R 755 ./*
Running the command in $home/android-studio/sdk/tools solved the problem.
Related
I am trying to install the latest version of Java in my Linux machine, but I am unable to do so.
Steps I followed:
Downloaded the latest Java tar ball.
Copied into /usr/lib/jvm and untared it.
Adding in to environment variable (export JAVA_HOME=/usr/lib/javm/jdk1.7.0_80, export PATH=$PATH:$JAVA_HOME/bin).
When I try to change the default Java version, the installed one is
not coming ($ update-alternatives –-config java).
How do I resolve this? I have followed many links, but nothing helps.
You will also have to "install" the new Java software to /etc/alternatives/, in order to select it:
sudo update-alternatives --install /usr/bin/java java /usr/lib/javm/jdk1.7.0_80/jre/bin/java 2000
I have installed OpenJDK 7 and it runs well on my Ubuntu 14.04 machine. I want to add Java sources to my Eclipse. When I go to /usr/lib/jvm/java-7-openjdk-amd64 there is a symlink called src.zip but it's broken. How do I fix this? Do I have to manually download sources and add them?
You should do:
sudo apt-get install openjdk-7-source
then the source code will be downloaded under: "/usr/lib/jvm/openjdk-7".
The symlink:
src.zip -> ../openjdk-7/src.zip
should work now.
The answer from Alex is correct, as in how it should be. However, for OpenJDK 11 on Ubuntu 18.10 it appears that src.zip has been moved to lib/src.zip so the symlink cannot be resolved.
In addition to the
sudo apt install openjdk-11-source
command, run
echo "(cd /usr/lib/jvm/openjdk-11/; ln -s lib/src.zip)" | sudo bash
to create an additional symbolic link.
I downloaded sources from http://jdk7src.sourceforge.net/ and added them to eclilpse. It works fine now.
installing openjdk8 again worked for me in ubuntu 16.04
step1: sudo apt install openjdk-8-source
step2 : attach the source.zip under(Window->preferences-java->Installed JREs->edit java-8-open-Jdk->expand rt.jar->click on Source attachment and attach the src.zip under /usr/lib/jvm/java-8-openjdk-amd64).
I am trying to install webstorm, but when I try to run the *.sh file it gives me error of not having java environment available.
So I tried to look into the official documentation
But the steps to install the jdk didn't worked. I tried to locate java folder, but couldn't locate this directory /usr/bin/java
Please guide me how I can install webstorm now?
Java generally installs in /usr/lib/jvm/java-[major version]-openjdk-[arch]. Install a package such as openjdk-7-jdk and check in that location.
If you already have java installed, running which java will tell you the path of the java executable.
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java7-installer
I haven't tried with java-8. Then:
sudo update-alternatives --java
And set auto-mode or java-7 (You might try with java-8)
First check the about java version
java -version
if its not returning you need to check your installed jdk
go to
cd /usr/lib/jvm
if you are finding something which start with java_XXXX
it means this is the only your jdk, and you can set JAVA_HOME as well path till bin folder by using export
I had a similar problem, during installation of eclipse (openjdk-7-jdk was required). I used
> sudo apt-get update
> sudo apt-get install ...
and it worked.
You should just install a JRE (to allow Java execution programs) and not a JDK (to develop Java programs).
No need a JDK to allow Webstorm to lauch.
On ubuntu : apt-get install default-jre
Have a nice day :)
David
This is probably one of the most confusing things I've had since I haven't used Unix too much before.
I have Ubuntu and I need to install my IDE (Eclipse) to support Java and C++.
I got Eclipse through the software center, then through the terminal's apt-get I installed openjdk for java, it appeared as a "Java project" in eclipse but it wouldn't compile, for example if I write System.out.println("something"); it does not even compile the System.out.println as it does not recognize it.
So can someone please once and for all refer me to a tutorial on how to install all these (and configure it) correctly? I have only found tips here and on google, nothing that -really- explains, and most the tutorials on how to install eclipse with java wants you to get sun-java-6-jdk which is not available anymore in the apt-cache
Looks like you have not installed the java properly :
Step 1 : Download java binaries from oracle.com/
Step 2 : Extract the compressed folder in your home directory /home
you can either right click on the tar ball and choose "Extract" option or you can use
[user#user-pc ~]$ tar xzvf <filename>.tar.gz
example : [user#user-pc ~]$ tar xzvf jdk-7u3-linux-x64.tar.gz
Step 3 :
Once its extracted, switch to root user
[user#user-pc ~]$ su
and execute the following commands:
[root#user-pc ~]# update-alternatives --install /usr/bin/java java /home/<extracted_folder_name>/bin/java 1
[root#user-pc ~]# update-alternatives --install /usr/bin/javac javac /home/<extracted_folder_name>/bin/javac 1
[root#user-pc ~]# update-alternatives --set java /home/<extracted_folder_name>/bin/java
[root#user-pc ~]# update-alternatives --set javac /home/<extracted_folder_name>/bin/javac
I have tried this on Linux Mint, though I make and educated guess that it should work fine for almost all Linux Debian Distros.
Restart your eclipse and it should work fine.
I have installed java in my CentOS release 5.5 machine using the command yum install java. But I am unable to compile a class using javac.
Do I need to install any other package?
I have tried to locate the javac executable but i am unable to locate it.
/usr/bin/java is linked as follows:
/usr/bin/java -> /etc/alternatives/java
/etc/alternatives/java -> /usr/lib/jvm/jre-1.6.0-openjdk.x86_64/bin/java
I have seen the following output by yum list installed |grep java:
java-1.6.0-openjdk.x86_64 1:1.6.0.0-1.16.b17.el5 installed
tzdata-java.x86_64 2011b-1.el5 installed
Worked for me with this command:
yum install java-devel
You installed the Java Runtime Environment (JRE) only, which does not provide javac. For javac, you have to install the OpenJDK Development Environment. You can install java-devel or java-11-devel, which both include javac.
By the way: you can find out which package provides javac with a yum search, e.g.
su -c 'yum provides javac'
on more recent releases of CentOS e.g. 6 the command changes to
su -c 'yum provides */javac'
Use the following sudo command:
sudo yum install java-1.6.0-openjdk-devel
I don't know exactly what yum install java will actually install. But to check for javac existence do:
> updatedb
> locate javac
preferably as root. If it's not there you've probably only installed the Java runtime (JRE) and not the Java Development Kit (JDK). You're best off getting this from the Oracle site: as the Linux repos may be slightly behind with latest versions and also they seem to only supply the open-jdk as opposed to the Oracle/Sun one, which I would prefer given the choice.
I use Fedora (currently 31)
Even with JDK's installed, I still need to specify JAVAC_HOME in the .bashrc, especially since I have 4 Java versions using sudo alternatives --configure java to switch between them.
To find java location of java selected in alternatives
readlink -f $(which java)
In my case:
/usr/java/jdk1.8.0_241-amd64/jre/bin/java
So I set following in .bashrc to:
export JAVA_HOME=/usr/java/jdk1.8.0_241-amd64/jre/bin/java
export JAVAC_HOME=/usr/java/jdk1.8.0_241-amd64/bin/javac
export PATH=$PATH:/usr/java/jdk1.8.0_241-amd64/jre/bin
export PATH=$PATH:/usr/java/jdk1.8.0_241-amd64/bin/
Now javac –version gives:
javac 1.8.0_241
This is useful for those who want to use Oracle's version. Just remember to change your .bashrc again if you make a change with java alternatives.
Is the javac executable in a directory that is part of your PATH?
I don't know the CentOS equivalent of the Windows path but if you cd to the java sdk directory and run ./javac does anything happen?
Install same version javac as your JRE
yum install java-devel
This worked for me:
sudo dnf install java-<version>-devel
You have installed the Java Runtime Environment(JRE) but it doesn't contain javac.
So on the terminal get access to the root user sudo -i and enter the password.
Type yum install java-devel, hence it will install packages of javac in fedora.
Linux Mint 19.3
I installed Java Oracle manually, like this:
$ sudo ln -s /usr/lib/jvm/java-1.8.0_211/bin/javac /usr/bin/javac
for java 8 use
sudo yum install java-1.8.0-openjdk-devel
Make sure you install JDK/JRE first.
follow these steps:
open terminal go to your root dictionary by typing
cd /
you will see Library folder
Now follow this path Library/Java/JVM/bin
Once you get into bin you can see the javac file
Now you need to get the path of this folder for that just write this command
pwd
get the path for your javac.