我正在尝试在Ubuntu 11.10上安装IDEA。首先,我安装了openjdk-7-jdk
。然后我按照指示尝试运行idea.sh
文件。然而它抱怨:
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.
尝试echo
这三个变量在屏幕上打印一个空行。如何(以及以什么值)设置这些变量并继续安装?感谢。
答案 0 :(得分:78)
<强>更新强>:
建议在Linux上使用捆绑的 JetBrains Runtime 来运行IntelliJ IDEA。目前IntelliJ IDEA要求Java 8在此平台上运行。可以切换到系统或其他Java版本,请check the FAQ。
原始答案(已废弃):
建议使用OpenJDK 1.7+或Oracle JDK在Linux上运行IntelliJ IDEA,由于已知的性能和视觉问题,OpenJDK 1.6严格不受支持。
从IntelliJ IDEA 16开始,自定义JRE与Linux发行版捆绑在一起。
棘手的部分是Oracle JDK不再通过.deb软件包分发,您不能只使用apt-get或Ubuntu软件中心进行安装。
他们的网站也很混乱,您可以轻松下载JRE而不是JDK(因为IntelliJ IDEA需要使用JRE包中缺少的tools.jar而无法下载)。
Here is the correct URL用于JDK下载(版本1.6.0_29)。从此URL下载相应的 .bin 文件,例如 jdk-6u29-linux-i586.bin ,如果您需要32位Java或 jdk-6u29-适用于64位版本的linux-x64.bin 。
chmod +x jdk-6u29-linux-i586.bin
./jdk-6u29-linux-i586.bin
安装在当前目录中。
在 bin / idea.sh 内,在第二行添加以下内容:
export IDEA_JDK=/path/to/jdk1.6.0_29
通常位于/usr/lib/jvm/<YOUR_JDK>
下。现在IntelliJ IDEA应该在Oracle JDK 1.6.0_29下正常启动。您可以在Help
|中进行验证About
。
答案 1 :(得分:3)
您可以通过执行以下操作设置JAVA_HOME
变量并添加到PATH
。以root身份打开/etc/bash.bashrc
并将以下内容添加到文件末尾。
JAVA_HOME=/usr/lib/jvm/java
export JAVA_HOME
重新启动时,请尝试运行以下命令:
$ echo $JAVA_HOME
答案 2 :(得分:3)
我也面临一个问题......在第一天所有工作都没有问题,但是......
我解决了一个问题:添加到文件idea.sh
行,其中包含JDK IDEA_JDK="/opt/java/32/jdk1.6.0_45/"
在46行之后添加
答案 3 :(得分:2)
如果您安装了java,请尝试
type java
如果你看到这样的话
java is /usr/java/default/java
然后你应该编辑.bash_profile,添加
export JAVA_HOME=/usr/java/default
然后执行
source .bash_profile
如果你没有安装java,你应该安装手册或自动。
答案 4 :(得分:2)
我有几次这个问题......
然后从终端运行它:
$ idea projects-name;
或2:导航到IDEA_HOME / bin并从那里运行。
答案 5 :(得分:1)
实际上,您可以在bash中配置JAVA_HOME。但是,IDEA使用标准bin文件夹中的javac和java。所以,你必须像这样配置。
使用这些命令将mv转换为/ usr / lib / jvm下的jvm文件夹
sudo mv -r ~/jdk-xx-version /usr/lib/jvm
使用这些命令配置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
答案 6 :(得分:1)
使用以下命令安装JDK 8:
sudo apt-get install openjdk-8-jdk
然后,有时问题出在您正在运行的JAVA的默认版本上。为此,请使用update-alternatives
对其进行修改:
sudo update-alternatives --config java
看看我是怎么做到的:
$ 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
现在Intellij IDEA 2016.3正常运行。
答案 7 :(得分:0)
以下是安装IDEA的开发人员的bash脚本,以便您可以通过idea.sh
它还:
#!/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
答案 8 :(得分:0)
这可能不是原始问题的根本原因,但这是搜索此错误时的热门话题:
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.
简短答案:如果您正在升级IDEA并遇到此错误,并且正在使用JBRE(JetBrains运行时),请将以前的运行时路径导出到JAVA_HOME
以加载最新版本的IDEA,并允许导入向导复制配置。
JAVA_HOME
时,该问题就会出现在我的开发环境中。 2019.2
更新为2019.3
,这导致最新版本的IDEA暂时没有配置文件。 解决方案
% cat ~/.IntelliJIdea2019.2/config/idea.jdk
/home/username/.IntelliJIdea2019.2/config/jdks/jbrsdk-8u232-linux-x64-b1638.3
jbrsdk-8u232-linux-x64-b1638.3
,路径如上所示。 暂时将其导出为 JAVA_HOME
。 EXPORT JAVA_HOME=/home/username/.IntelliJIdea2019.2/config/jdks/jbrsdk-8u232-linux-x64-b1638.3
idea &
。您现在应该出现第一次运行对话框,以复制配置,并且您无需再次导出变量。
答案 9 :(得分:0)
arch linux采用intellij idea 2020的解决方案在这里: https://git.archlinux.org/svntogit/community.git/tree/trunk?h=packages/intellij-idea-community-edition
if [ -z "$IDEA_JDK" ] ; then
IDEA_JDK="/usr/lib/jvm/java-11-openjdk/"
fi
# open-jfx location that should match the JDK version
if [ -z "$IDEA_JFX" ] ; then
IDEA_JFX="/usr/lib/jvm/java-11-openjfx/"
fi
# classpath according to defined JDK/JFX
if [ -z "$IDEA_CLASSPATH" ] ; then
IDEA_CLASSPATH="${IDEA_JDK}/lib/*:${IDEA_JFX}/lib/*"
fi
exec env IDEA_JDK="$IDEA_JDK" IDEA_CLASSPATH="$IDEA_CLASSPATH" /usr/share/idea/bin/idea.sh "$@"