在Ubuntu 11.10上安装IDEA
我正在尝试在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
这三个variables会在屏幕上打印一个空行。 我如何设置这些variables(以及什么值)并继续安装? 谢谢。
build议使用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包中缺less的tools.jar一样工作)。
这是 JDK下载的正确URL (版本1.6.0_29)。 从这个URL下载相应的.bin文件,例如,如果您需要32位Java或jdk-6u29-linux-x64.bin(对于64位版本),请使用jdk-6u29-linux-i586.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
|中进行validation About
。
您可以设置JAVA_HOME
variables并添加到您的PATH
,通过执行以下操作。 以root身份打开/etc/bash.bashrc
并将以下内容添加到文件的末尾。
JAVA_HOME=/usr/lib/jvm/java export JAVA_HOME
当您重新启动时,请尝试运行以下内容:
$ echo $JAVA_HOME
如果你已经安装了Java,请尝试
type java
如果你看到这样的
java is /usr/java/default/java
那么你应该编辑.bash_profile,添加
export JAVA_HOME=/usr/java/default
然后执行
source .bash_profile
如果你不安装java,你应该安装手动或自动。
我有这个问题几次…
- 将IDEA_HOME / bin添加到PATH确保JAVA_HOME和其他variables是正确的。
然后从terminal运行它:
$ idea projects-name;
或2:导航到IDEA_HOME / bin并从那里运行。
我也面临一个问题…在第一天所有的作品没有问题,但是…我解决一个问题:添加到文件idea.sh
与JDK的pathIDEA_JDK="/opt/java/32/jdk1.6.0_45/"
在46行之后添加
您使用以下方法安装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运行良好。
以下是安装IDEA的开发人员的bash脚本,以便您可以通过idea.sh
从shell运行它
它也是:
- testing操作系统是否在VirtualBox上运行
- 如果它在VirtualBox上运行,则testingIdeaProjects是否设置为共享
- 如果是,则将挂载命令写入引导脚本以将项目从主机自动挂载到guest虚拟机
- 还创build了一个脚本来即时挂载和卸载想法项目
#!/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
其实,你可以在bash中configurationJAVA_HOME。 但是,IDEA使用标准bin文件夹中的javac和java。 所以,你必须这样configuration。
- 将JDK下载到本地(〜)文件夹
- 解压缩zip文件
-
使用这些命令将mv转换为/ usr / lib / jvm下的jvm文件夹
sudo mv -r ~/jdk-xx-version /usr/lib/jvm
-
使用这些命令来configurationJAVA_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