Debian6 Eclipse and JDK installation

Source: Internet
Author: User
Tags gtk subversion client tmp folder java se

    • Installing the JDK

Currently the latest JDK version is: Java SE development Kit 7u5

: http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html

Check Latest: http://www.oracle.com/technetwork/java/javase/downloads/index.html

2. Unzip the installation

We install the JDK to this path:/USR/LIB/JVM
If there is no such directory (the first time of course not), we will create a new directory

Cd/usr/lib

sudo mkdir JVM

After the establishment of the good, we came to the download of the compressed package directory, extracted to our newly created folder inside, and modify the name to facilitate our management

sudo tar zxvf./jdk-7-linux-i586.tar.gz-c/USR/LIB/JVM

Cd/usr/lib/jvm

sudo mv Jdk1.7.0_05/jdk7

3. Configure Environment variables

Gedit ~/.BASHRC

Add at the end of the open file

Export JAVA_HOME=/USR/LIB/JVM/JDK7

Export JRE_HOME=${JAVA_HOME}/JRE

Export Classpath=.:${java_home}/lib:${jre_home}/lib

Export Path=${java_home}/bin: $PATH

Save the exit and enter the following command to make it effective

SOURCE ~/.BASHRC

4. Configure the default JDK

Some Linux distributions already have default JDK, such as OPENJDK. So in order to make the JDK version we just installed can be the default JDK version, we will also make the following configuration.
Execute the following command:

sudo update-alternatives--install/usr/bin/java java/usr/lib/jvm/jdk7/bin/java sudo update-alternatives--install /usr/bin/javac Javac/usr/lib/jvm/jdk7/bin/javac 300

Note: If the above two commands do not find a path problem, just restart the computer and repeat the above two lines of code is OK.

Execute the following code to see the current various JDK versions and configurations:

sudo update-alternatives--config java

5. Testing

Open a terminal and enter the following command:

Java-version

Show Results:

Java version "1.7.0_05" Java (TM) SE Runtime Environment (build 1.7.0_05-b05)

Java HotSpot (TM) Server VM (build 23.1-b03, Mixed mode)

This means that the Java command is ready to run.

    • Install Eclipse

Download the 64-bit version of Eclipse, I use Indigo, so the next is eclipse-jee-indigo-sr2-linux-gtk-x86_64.tar.gz
Copy to/usr/local/bin, unzip to current directory
sudo tar-zxvf eclipse-jee-indigo-sr2-linux-gtk-x86_64.tar.gz
Rename directory Eclipse to Eclipse-jee

Add eclipse to Debian's applications:
Add Eclipse-jee.desktop under/usr/share/applications, with the following content

[desktop entry]
categories=gnome
comment=eclipse for j2ee  Development
exec=/usr/local/bin/ Eclipse-jee/eclipse
icon=/usr/local /bin/eclipse-jee/icon.xpm
Name= Eclipse jee
terminal=false
type=application

Similarly, add eclipse for PHP Developer, using Eclipse-php's directory name and program name

When you're done, you can see the added eclipse shortcuts in the applications of the ALT+F1, or you can open them directly with Eclipse-jee ALT+F2

adding TOMCAT6 server inside Eclipse, a workaround for cannot create a server using the selected type appears:
Google has a lot of results, there are said to delete a workspace under the Pref file, but this file does not exist at all.
The final Solution to the problem:
CD/USR/SHARE/TOMCAT7
sudo ln-s/var/lib/tomcat7/conf conf
sudo ln-s/etc/tomcat7/policy.d/03catalina.policy conf/catalina.policy
sudo ln-s/var/log/tomcat7 log
sudo chmod-r 777/usr/share/tomcat7/conf

Change the tomcat7 above to Tomcat6. The last one is useless, because the original is already 777 permissions.
There is also a related command, do not know whether it played a role, this is the user I used to launch Eclipse, join TOMCAT6 this group
sudo adduser [my user name] Tomcat6

[Settings for Tomcat Debug Environment] 2013.05.25 Update:
Double-click Tomcat v6.0 Server at Localhost in servers to see the Tomcat configuration page. The following settings are set on this page:
1. The Server Locations is set to a third. Why is it? Look at this explanation:

in fact, i  always use workspace metadata. when you say use workspace  metadata, eclipse copies your files  (Class files, jsps, server.xml,  context.xml)  to /.metadata/.plugins/org.eclipse.wst.server.core/tmp0. It then  starts tomcat using these files. it does not change the  TOMCAT INSTALLATION DIRECTORY AT ALL. NOTE THAT THIS DOESN ' T copy  the tomcat files, just the files which come from your  Project.

if you choose  use tomcat installation, then it copies your files into the  Tomcat installation directory, and boots it from there.

if, like me,  You ' re developing multiple projects from multiple workspaces, then  This makes a big difference. with use workspace metadata you  will never get any interference between workspaces. for instance ,  it ' S possible that when rebooting tomcat, one project will  be in a bad state and your logs will be filled  With stuff from another project. it ' s better to have two  separate locations, and the workspace is a good place for  this.

I did this by building a TMP folder in my directory:/home/[my user Name]/workjava/tmp_server,
Then add this path to the server path and change the deploy path to WebApps

2. Turn off publishing, set to never publish automatically

3. Do not deploy any projects, but deploy by/home/[my user Name]/workjava/tmp_server/conf/catalina/localhost/[project Name].xml. This XML content is very simple, is a point to your workspace inside the path of the compiled project, a project deployment file example is this

View Plaincopy to Clipboardprint?

1 <!--? XML version= "1.0" encoding= "UTF-8"?-->

2 <context docbase= "/home/[my user Name]/workjava/workspace/medias/webroot" >

3 </context>

In this way, after you start the service in servers, you will automatically start your project in workspace.

[Subclipse Installation] 2013.05.20 Update:

The Eclipse update Source was first found in http://subclipse.tigris.org/: http://subclipse.tigris.org/update_1.8.x
Add this source under Eclipse Help->install New software and tick the following three components:
Subclipse, Subversion client Adapter, Subversion client Adapter
Nothing else is necessary, you can not pretend

The Libsvn-java will then need to install Debian to provide JNI support.
sudo apt-get install Libsvn-java
The system will install LIBSVN1 at the same time

problem:  Open eclipse,  at this time You are prompted unable to load default svn client
resolve:  Add svn client  path to eclipse.ini:  modify/usr/local/bin/eclipse-jee/eclipse.ini,  in
-vmargs  add one line below:
-djava.library.path=/usr/lib/x86_64-linux-gnu/jni/
This path can be obtained by  sudo find / -name libsvnjavahl*.* 

Problem: Open Eclipse appears incompatible Javahl library loaded. 1.7.x or later required
Workaround: This is because the Debian Wheezy installs the LIBSVN1 version or 1.6.x, and Subclipse 1.8.x requires 1.7.x support.

Two ways:
1. Use Subeclipse 1.6.x without subeclipse 1.8.x
2. Installing LIBSVN1 1.7

since subversion 1.7 is much better than the previous version, it is decided to install LIBSVN1 1.7 from version unstable and install the steps:
1. Modify the/etc/apt/sources.list to
Deb Http://debian.ustc.edu.cn/debian/wheezy main Non-free contrib
deb-src http://debian.ustc.edu.cn/debian/wheezy main Non-free contrib
instead
Deb Http://debian.ustc.edu.cn/debian/sid main Non-free contrib
deb-src http://debian.ustc.edu.cn/debian/sid main Non-free contrib
2. sudo apt-get update
3. Sudo apt-get install libsvn1

After installation, remember to change the/etc/apt/sources.list back.

After you restart Eclipse, you will be prompted to disable SVN's keyring, confirming it. This is when SVN can be used.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.