`
log_cd
  • 浏览: 1090584 次
  • 性别: Icon_minigender_1
  • 来自: 成都
社区版块
存档分类
最新评论

eclipse的一些使用技巧

阅读更多

(1)Hidden .jar

 

      In order to clean up the project view in Eclipse, you can hide the files you don't need. First of all, make sure you're in the Java Perspective (Window → Open Perspective). Then click the little (down) arrow in the top right corner of the Package Explorer pane. Select Filters, check the "Name Filter Patterns" and type "*.jar" (no quotes) in the text field. Then in the list of elements, scroll down and check Referenced Libraries. Click OK to continue.

 

(2)abbreviated package names

 

      You probably won't need it on this project, but its nice on projects where you're inflicted with super.long.package.name.syndrome. Go to Window → Preferences → Java → Appearance. Check the "Compress all package names" checkbox and type "1." (no quotes) in the text field.

(3)use resin plugin

 

(4)Managing and Uninstalling plugins

 

      This is important to manage the amount of disk space that Eclipse uses and because the Eclipse UI tends to become cluttered when many plugins are installed. A large number of plugins may also make your Eclipse environment less stable. In general, if you are not using a plugin, it is a good idea to disable it.

      Disabling a plugin means that it will not be loaded when Eclipse starts. Disabling a plugin is equivalent to uninstaling it, except that the plugin is still available on your hard drive in case you want to reinstall it later.

     Select the menu item Help -> Software Update -> Manage Configuration,Right-click on the item (or on the parent folder: this is equivalent).

 

(5)tapestry vm arguments

 

-Xmn100M -Xms300M -Xmx300M -XX:MaxPermSize=128M
-Dorg.apache.tapestry.enable-reset-service=true
-Dorg.apache.tapestry.disable-caching=true

 

(6)Eclipse:java.lang.OutOfMemoryError: PermGen space

 

在eclipse.ini配置文件中加上以下两行
-XX:PermSize=128M
-XX:MaxPermSize=128M

PermSize 和MaxPermSize如果设置为相同还可以在一定程度上提高性能,因为,PermSize在不断的变化中会需要转移其中的数据。如果固定了以后,则可以减少每次扩大PermSize带来的性能损失。

 

PermGen space的全称是Permanent Generation space,是指内存的永久保存区域OutOfMemoryError: PermGen space从表面上看就是内存益出,解决方法也一定是加大内存。Permanent Generation保存了JVM中所有对象的类信息,包括类的元数据,还有方法描述等等,所以这一代内存垃圾收集算法是不一样的,在Java大程序的情况下,尤其是J2EE 或者说Java EE的大型应用程序上,Permanent Generation的大小会直接限定能载入类的数量和大小。

为什么会内存益出:
(1)这一部分用于存放Class和Meta的信息,Class在被 Load的时候被放入PermGen space区域,它和和存放Instance的Heap区域不同。
(2) GC(Garbage Collection)不会在主程序运行期对PermGen space进行清理,所以如果你的APP会LOAD很多CLASS的话,就很可能出现PermGen space错误。

 

(7)安装Eclipse SVN plugin(Subclipse)

 

Eclipse的SVN Plugin,叫做Subclipse,官方网站的下载地址在http://subclipse.tigris.org/,也提供了update site http://subclipse.tigris.org/update
Eclipse的使用者可以通过Eclipse的插件自动下载和更新功能来安装这个插件,在Eclipse的菜单中选择Help->Software Updates->Find and Install-> Search for new features to install ->New Remote Site。URL中就输入http://subclipse.tigris.org/update,Eclipse就会自已安装上了.

安装完成后,在Eclipse的plugins中就会多了5个包,命名为org.tigris.subversion.*的都应该是了。打开Eclipse,window->show view窗口中多了一个SVN文件夹,到此就证明svn插件成功的安装上了。具体的使用方法,在Eclipse的Help中有详细的帮助Subclipse - Subversion Eclipse Plugin,教你一步一步的使用SVN的客户端了。

 

eclipse使用subclipse导致jvm崩溃

解决方法:

将环境变量 APR_ICONV_PATH改为APR_ICONV1_PATH

或者下载Subversion 1.4.3的zip包,将环境变量 APR_ICONV_PATH 指向解压后的 iconv文件夹。

 

 

(8)让Eclipse显示代码行数 
windows->Preferences->General->Editors->Text Editors ->Show Line numbers

 

(9)解决Eclipse自动关闭的问题

    Eclipse快捷上点右键,选属性,在目标中文字后加入一串参数:
-vmargs   -Xms128M   -Xmx256M   -XX:PermSize=64M   -XX:MaxPermSize=256M
(10)使用Eclipse制作可执行jar文件

1,右击Eclipse项目,点击Export

2,选中java-jar文件。

3,选中要发布为jar文件的项目。

1)选中源文件夹,库文件夹,配置文件文件夹。

2)不要选中Eclipse项目的文件和其他不需要的文件。

3)选中:Export all output folders for checked projects

输出所有选中的文件夹。

4)选中:Export java source files and resources

如果是源文件夹,就会输出生成的.class文件。

5)选中:压缩Jar文件的内容。

6)选中:不警告就覆盖已存在的文件

7)选择一个输出jar文件的目的地。

4,使用已存在的manifest文件。

5MANIFEST.MF  文件如下:

Manifest-Version: 1.0

Main-Class: Test

Class-Path: lib/OXmlEd1.11-nolib-bin.jar lib/dom4j-1.6.1.jar lib/commons-logging-1.0.4.jar lib/log4j-1.2.8.jar

 

    如果让Eclipse为我们生成,不会生成Class-Path部分的描述。所以,我们需要再加上Class-Path描述!

 

(11)eclipse中改变workspace

方法一:

1、在file菜单下选择switch workspace项,在这里可以另外添加一个新的workspace

2、在eclipse安装目录下configuration\.settings目录下的 org.eclipse.ui.ide文件,修改RECENT_WORKSPACES=默认workspace路径

方法二:

     进入 Window > Preferences > General > Startup and Shutdown 选中 Prompt for workspace on startup。

方法三:

    先打开Eclipse,进入之后,再去打开一次,会提示 Workspace in use or cannot be created, choose a different one 。 这时候就会提示你更改workspace的目录了。
(12)eclipse svn更换帐号

     把Documents and Settings\$USERNAME\Application Data\Subversion\auth下的文件删除,重新访问svn资源库,会弹出输入用户名密码的对话框。

(13)版本号 、 文件的状态图标不能显示的解决办法

     打开 : windows ->preferences->General->Appearance->Lable Decorations  勾选其中的 SVN 项即可。 同时,还可以打开 windows ->preferences->Team -> SVN 中做相关设置。

(14)Eclipse里的No grammar constraints (DTD or XML schema) detected for the document警告

    dtd验证是xml的规范,要去除警告的话:工具栏:windows => preferences => xml => xml files => validation => Indicate when no grammar is specified:选择Ignore即可。

Eclipse3.5 disable validate:

        go to File -> Properties -> Builders, and deselect "Validation" and "Script Builder" and "JavaScript Validator"

(15)delete an Eclipse perspective for a plugin I uninstalled

       Window --> Preferences --> General --> Perspectives Select the perspective you want to delete and remove it。

(16)设置eclipse自动生成的author等注释

a、定义注释:  preference->java->codestyle->codetemplates->commnets->type

      在菜单中是source->generate element comment即可。

b、直接改模板: window->preference->java->code styple->code template --> code --> New Java files --> edit
例如:
${filecomment}
${package_declaration}
/**
* @author bela E-mail:bela@world.com
* @version 创建时间:${date} ${time}
*/
${typecomment}
${type_declaration}

          最后点apply,另外,在点了edit弹出来的编辑窗口的左下脚有一个"Insert Variable"按钮,点击那里就会显示当前模板中可以引用变量。

(17)解决eclipse中svn信息不显示

        windows ->preferences->General->Appearance->Lable Decorations 勾选其中的 SVN 项即可

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics