需要的软件:jdk1.6,Intellij Idea 12,tomcat7.0,maven
1)安装jdk 1.7以及配置环境变量
java项目的开发以及IntelliJ IDEA 12的运行都需要jdk的支持
下载 linux下的jdk包,地址是http://www.oracle.com/technetwork/java/javase/downloads/index.html
下载文件为:jdk-7u25-linux-i586.tar.gz
解压jdk-7u25-linux-i586.tar.gz到/opt目录下,并添加环境变量到~/.bashrc文件。
export JDK_HOME=/opt/jdk1.7.0_25
export PATH=$JAVA_HOME/bin:$PATH
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
之后可以使用以下命令测试
java -version
2)安装IntelliJ IDEA
下载IntelliJ IDEA 12.14,文件为ideaIU-12.1.4.tar.gz,下载地址 http://www.jetbrains.com/idea/download/index.html#linux
下载后解压到目录/opt中,
tar -zxvf ideaIU-12.1.4.tar.gz /opt
解压缩后生成相关目录。
3)运行IntelliJ IDEA
IDEA目录下有一个idea.sh的文件,使用命令
sh idea.sh 运行该软件。
(以下是转载)
1) Get Java
Install the Java 6 JDK, which IDEA itself needs to run. (You can have other JDKs for your projects, but you’ll need this one to run IntelliJ itself.) For example, type this in a terminal:
sudo apt-get install sun-java6-jdk
Follow the prompts for root password, download confirmation, and eventually the Sun EULA to install Java itself. If it installed successfully, you should be able to type this at a prompt:
java -version
… to get several lines telling you the version of Java you have installed. If this doesn’t work, refer to Sun’s documentation on troubleshooting installations.
2) Get IntelliJ IDEA
Download the latest version of IntelliJ IDEA for Linux:
http://www.jetbrains.com/idea/download/index.html#linux
Once the download is finished, extract the archive using the correct filename according to your download. For example, to install IntelliJ in /usr/lib, do the following:
tar xfz idea-7.0.1.tar.gz ./usr/lib/
The IntelliJ installation will now be in a subdirectory indicating the build number, in the format “idea-xxxx”. In the case of IDEA 7.0.1, the app directory is “idea-7364“. (Once the extraction is done, you can delete the downloaded archive to conserve disk space if needed.)
3) Get Environmental
There are a couple of environment variables to be taken care of. First, you need to set a new environment variable that tells IntelliJ where your install of Java is. For example:
export JDK_HOME="/usr/lib/jvm/java-6-sun/"
Use the “env” command, or just “echo $JDK_HOME“, to verify the variable is set.
Next, you’ll need to edit /etc/environment with superuser rights in the editor of your choice, adding the idea-xxxx/bindirectory to your PATH variable. For example, you can edit the environment with the GUI mousepad editor like so:
sudo mousepad /etc/environment
The various directories in the environment PATH variable are delineated by colons (:). Append the current value (inside the quotes) with a new colon and then add the idea-xxxx/bin location. It should look something like this:
PATH="/usr/local/sbin:/usr/local/bin:/usr/lib/idea-7364/bin"
Save and close the environment file. You’ll need to “source” it for your system to pick up the new directory in the PATH. You can verify your changes by echoing the variable as well:
source /etc/environment
echo $PATH
If you see the path to IntelliJ returned in the output, you’re all set.
Lastly, you may want to change the VM settings of IntelliJ. This depends entirely on your project size and other factors, so you’ll need to base these settings on your own need. The settings are in idea-xxx/bin/idea.vmoptions.
4) Get Started!
That’s it. Now you can run “idea.sh” from a terminal in any directory, and IntelliJ should launch…
sh idea.sh
If you run into problems, be sure to double-check the readme files in the installation directory.
Give Back
If this article proved useful to you, please drop us a comment and let us know. Or, if you find problems/alternate solutions along the way, please share them for the benefit of others. Thanks and happy coding!
export JDK_HOME=/opt/jdk1.7.0_25
export PATH=$JAVA_HOME/bin:$PATH
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar