Debian 7 Wheezy 安装 Eclipse

下载64位的eclipse版本, 我用的是Indigo, 所以下的是eclipse-jee-indigo-SR2-linux-gtk-x86_64.tar.gz

复制到 /usr/local/bin, 解压到当前目录

sudo tar -zxvf eclipse-jee-indigo-SR2-linux-gtk-x86_64.tar.gz

将目录eclipse更名为eclipse-jee

将eclipse添加到Debian的Applications:

在/usr/share/applications下添加eclipse-jee.desktop, 内容如下

[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

同理, 添加Eclipse for PHP Developer, 使用eclipse-php的目录名和程序名

完成后, 在Alt+F1呼出的applications里面就可以看到添加了的eclipse快捷方式, 也可以通过Alt+F2用eclipse-jee直接打开

在Eclipse里面添加Tomcat6 Server, 出现 Cannot create a server using the selected type 的解决方法:

Google了好多结果, 有说删除workspace下的某个pref文件的, 但是这个文件根本不存在.

最终解决问题的方法:

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

把上面的tomcat7换成tomcat6就可以了. 最后一个没用, 因为原来就已经是777权限.

另外还有一个相关的命令, 不知道是否起到了作用, 这个是将我用于启动eclipse的用户, 加入tomcat6这个组

sudo adduser [my user name] tomcat6

[Tomcat Debug环境的设置] 2013.05.25 Update:

双击Servers 里面的Tomcat v6.0 Server at Localhost, 可以看到Tomcat的配置页面. 这个页面上要进行如下设置:

1. Server Locations 设置为第三个. 为什么呢? 看这段解释:

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.

我是这样做的, 在我的目录下建一个tmp文件夹: /home/[my user name]/WorkJava/tmp_server,

然后把这个路径加入Server path, 并且把Deploy path改为webapps

2. 关闭publishing, 设置为 Never publish automatically

3. 不部署任何项目, 而是通过/home/[my user name]/WorkJava/tmp_server/conf/Catalina/localhost/[project name].xml 来实现部署. 这个xml里面的内容很简单, 就是一个指向你workspace里面编译好的项目的路径, 一个项目部署文件例子是这样的

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>

这样, 在Servers里面启动服务后, 就会自动启动你在workspace里面的项目

[Subclipse的安装] 2013.05.20 Update:

首先在 http://subclipse.tigris.org/ 找到了 eclipse 更新源: http://subclipse.tigris.org/update_1.8.x

在Eclipse Help->Install New Software 下增加这个源, 然后勾选以下的三个组件:

Subclipse, Subversion Client Adapter, Subversion Client Adapter

别的都不是必须的, 可以不装

然后需要安装Debian的libsvn-java提供JNI支持.

sudo apt-get install libsvn-java

系统会同时安装libsvn1

问题: 此时打开eclipse, 会提示Unable to load default SVN Client

解决: 将svn client 的路径加入eclipse.ini: 修改/usr/local/bin/eclipse-jee/eclipse.ini, 在

-vmargs 下面增加一行:

-Djava.library.path=/usr/lib/x86_64-linux-gnu/jni/

这个路径可以通过 sudo find / -name libsvnjavahl*.* 得到

问题: 打开eclipse出现 Incompatible JavaHL library loaded. 1.7.x or later required

解决: 这是因为Debian Wheezy安装的libsvn1 版本还是1.6.x, 而Subclipse 1.8.x 需要1.7.x的支持.

两个途径:

1. 不使用subeclipse 1.8.x 而使用 subeclipse 1.6.x

2. 安装libsvn1 1.7

因为subversion 1.7 较之前版本有很大的改进, 所以决定从unstable版中安装libsvn1 1.7, 安装步骤:

1. 修改/etc/apt/sources.list, 将

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

改为

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

安装完后, 记得将/etc/apt/sources.list改回去.

重新启动eclipse后, 会提示要禁用svn的 keyring, 确认就可以了. 这时候svn就可以使用了.