I am trying to install IDEA on Ubuntu 11.10. First, I installed openjdk-7-jdk
. Then I tried running the idea.sh
file as instructed. However it complains:
ERROR: cannot start IntelliJ IDEA.
No JDK found to run IDEA. Please validate either IDEA_JDK, JDK_HOME or JAVA_HOME
environment variable points to valid JDK installation.
Press Enter to continue.
Trying to echo
these three variables prints an empty line to the screen. How (and to what values) do I set these variables and proceed with the installation? Thanks.
UPDATE:
It's recommended to use the bundled JetBrains Runtime on Linux to run IntelliJ IDEA. At the moment IntelliJ IDEA requires Java 8 to run on this platform. It's possible to switch to a system or some other Java version, please check the FAQ.
Original answer (obsolete):
It's recommended to use OpenJDK 1.7+ or Oracle JDK to run IntelliJ IDEA on Linux, OpenJDK 1.6 is strictly unsupported because of the known performance and visual issues.
Starting from IntelliJ IDEA 16, custom JRE is bundled with Linux distributions.
The tricky part is that Oracle JDK is no longer distributed via .deb packages and you can't just install it with apt-get or Ubuntu Software Center.
Their site is also confusing and you can easily download JRE instead of the JDK (which will not work as IntelliJ IDEA needs tools.jar that is missing from JRE package).
Here is the correct URL for the JDK downloads (version 1.6.0_29). From this URL download the appropriate .bin file, for example jdk-6u29-linux-i586.bin if you need 32-bit Java or jdk-6u29-linux-x64.bin for 64-bit version.
chmod +x jdk-6u29-linux-i586.bin
./jdk-6u29-linux-i586.bin
to install in the current directory.
Inside bin/idea.sh add the following on the second line:
export IDEA_JDK=/path/to/jdk1.6.0_29
Normally resides under /usr/lib/jvm/<YOUR_JDK>
. Now IntelliJ IDEA should start fine under Oracle JDK 1.6.0_29. You can verify it in Help
| About
.
You can set JAVA_HOME
variable and add to your PATH
, by doing the following. As root open up /etc/bash.bashrc
and add the following to the end of the file.
JAVA_HOME=/usr/lib/jvm/java
export JAVA_HOME
When you reboot, try running the following:
$ echo $JAVA_HOME
i also face a question... in firs day all works without problems, but then...
i solve a problem: add to file idea.sh
line with path to JDK IDEA_JDK="/opt/java/32/jdk1.6.0_45/"
add after 46 line
if you had install java ,try
type java
if you see like this
java is /usr/java/default/java
then you should edit .bash_profile,add
export JAVA_HOME=/usr/java/default
then execute
source .bash_profile
if you not install java,you should install manual or auto.
I have had this problem a few times...
- Add the IDEA_HOME/bin to your PATH Make sure JAVA_HOME & other variables are correct.
then run it from the terminal:
$ idea projects-name;
OR 2: navigate into the IDEA_HOME/bin and run it from there.
Actually, you can configure the JAVA_HOME in bash. But, IDEA use javac and java from standard bin folders. So, you have to configure like this.
- Download the JDK to home(~) folder
- extract the zip file
use these command to mv to jvm folder under /usr/lib/jvm
sudo mv -r ~/jdk-xx-version /usr/lib/jvm
use these commands to configure the JAVA_HOME
sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jdk-xx-version/bin/java" 1 sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/jvm/jdk-xx-version/bin/javac" 1 sudo update-alternatives --install "/usr/bin/javaws" "javaws" "/usr/lib/jvm/jdk-xx-version/bin/javaws" 1
You install JDK 8 with:
sudo apt-get install openjdk-8-jdk
Then, sometimes the problem lies on the default version of JAVA you are running. For this, use update-alternatives
to modify it:
sudo update-alternatives --config java
See how I did it:
$ sudo update-alternatives --config java
There are 2 choices for the alternative java (providing /usr/bin/java).
Selection Path Priority Status
------------------------------------------------------------
* 0 /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java 1071 auto mode
1 /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java 1071 manual mode
2 /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java 1069 manual mode
Press enter to keep the current choice[*], or type selection number: 2
update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java to provide /usr/bin/java (java) in manual mode
And now Intellij IDEA 2016.3 is running fine.
Here is a bash script for developers that installs IDEA so that you can run it from the shell via idea.sh
It also:
- Tests if the operating system is running on VirtualBox
- If it runs on VirtualBox, tests if IdeaProjects is set up for sharing
- If yes, writes a mount command to the bootstrap script to automount projects from host to guest
- Also creates a script to mount and unmount idea projects on-the-fly
#!/bin/bash
#Author: Yucca Nel http://thejarbar.org
#Modify these variables as needed...
tempWork=/tmp/work
defaultStartScript=/etc/init.d/rc.local
defaultIDEA=11.0.1
locBin=/usr/local/bin
read -p "Please [Enter] full path name of your local startup script ($defaultStartScript is the default). Please
make sure on this before providing a value by consulting documentation for your system:" locStartScript
locStartScript=${locStartScript:-$defaultStartScript}
read -p "Please [Enter] IDEA Version ($defaultIDEA is default):" ideaVersion
ideaVersion=${ideaVersion:-$defaultIDEA}
if [ ! -f $locStartScript ]
then
echo "The file you provided could not be found. Remember to include the full path and try again. Exiting in 7 secs..."
sleep 7
exit 1
fi
mkdir -p /$tempWork
cd /$tempWork
sudo wget http://download-ln.jetbrains.com/idea/ideaIC-$ideaVersion.tar.gz;
tar -zxvf ./*;
#Move it to a better location...
mv ./idea-IC-* $HOME/;
sudo ln -f -s $HOME/idea-*/bin/* /usr/bin/;
#If you use VirtualBox , you can share your projects between Host and guest. Name of shared
#folder must match 'IdeaProjects'
mkdir -p $HOME/IdeaProjects
if [ -f /sbin/mount.vboxsf ]
then
sudo /sbin/umount $HOME/IdeaProjects
sudo /sbin/mount.vboxsf IdeaProjects $HOME/IdeaProjects
fi
if mountpoint -q ~/IdeaProjects
then
#Add it to the start script to automate process...
if ! grep "sudo /sbin/mount.vboxsf IdeaProjects $HOME/IdeaProjects" $locStartScript
then
echo "sudo /sbin/mount.vboxsf IdeaProjects $HOME/IdeaProjects" | sudo tee -a $locStartScript
fi
sudo chmod +x $locStartScript
#Create a mount and unmount script file...
rm -rf $tempWork/*
echo '#!/bin/bash' > $tempWork/idea-mount.sh
echo "sudo /sbin/mount.vboxsf IdeaProjects $HOME/IdeaProjects" >> $tempWork/idea-mount.sh
echo "echo 'mounted IdeaProjects'" >> $tempWork/idea-mount.sh
echo "exit 0" >> $tempWork/idea-mount.sh
echo '#!/bin/bash' > $tempWork/idea-umount.sh
echo "sudo umount $HOME/IdeaProjects" >> $tempWork/idea-umount.sh
echo "echo 'unmounted IdeaProjects'" >> $tempWork/idea-mount.sh
echo 'exit 0' >> $tempWork/idea-umount.sh
#Script for mounting ALL VirtualBox shared solders....
#If there isn't one create one...
if [ ! -f $locBin/mount-all-from-host.sh ]
then
echo '#!/bin/bash' > $tempWork/mount-all-from-host.sh
echo "sudo /sbin/mount.vboxsf IdeaProjects $HOME/IdeaProjects" | sudo tee -a $tempWork/mount-all-from-host.sh
echo "exit 0" | sudo tee -a $tempWork/mount-all-from-host.sh
#Otherwise if there is one, but no mount, add one...
elif ! grep "sudo /sbin/mount.vboxsf IdeaProjects" $locBin/mount-all-from-host.sh
then
sudo sed -ie '$d' $locBin/mount-all-from-host.sh
echo "sudo /sbin/mount.vboxsf IdeaProjects $HOME/IdeaProjects" | sudo tee -a $locBin/mount-all-from-host.sh
echo "exit 0" | sudo tee -a $locBin/mount-all-from-host.sh
fi
#Script for unmounting ALL VirtualBox shared folders...
#If there isn't one create one...
if [ ! -f $locBin/umount-all-from-host.sh ]
then
echo '#!/bin/bash' > $tempWork/umount-all-from-host.sh
echo "sudo umount -a -t vboxsf" | sudo tee -a $tempWork/umount-all-from-host.sh
echo "echo 'unmounted all VirtualBox shared folders'" | sudo tee -a $tempWork/umount-all-from-host.sh
echo "exit 0" | sudo tee -a $tempWork/umount-all-from-host.sh
fi
sudo chmod +x $tempWork/*
sudo mv -f $tempWork/*.sh $locBin/
rm -rf $tempWork
fi
sudo rm -rf $tempWork
exit 0
来源:https://stackoverflow.com/questions/8382641/installing-idea-on-ubuntu-11-10