`
geeksun
  • 浏览: 952855 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

eclipse使用及问题解决方案

    博客分类:
  • ide
阅读更多

        近日,准备使用eclipse来进行开发,虽然之前一直使用myeclipse做开发,但因为许可证到期,也不好意思使用破解的myeclipse,所以将在以后的开发中使用eclipse,目前,已经从 www.eclipse.org 下载了eclipse3.3和eclipse3.4,这两个版本都是jee版的,支持j2ee开发。

        eclipse启动后,eclipse 将会到指定的目录下去查找 eclipse\features 目录和eclipse\plugins 目录,看是否有合法的功能部件和(或)插件。也就是说,目标目录必须包含一个 \eclipse 目录。如果找到,附加的功能部件和插件在运行期配置是将是可用的,如果链接文件是在工作区创建之后添加的,附加的功能部件和插件会作为新的配置变更来处理。


        常见问题:
        1. 在启动eclipse jee europa之后,在 Problem 里出现 error prompt:Unbound classpath container: 'com.genuitec.eclipse.j2eedt.core.J2EE14_CONTAINER',google了一下,发现在 build path 里将 jdk 的路径排到最前面就可以用,这个有可能是jdk如果在后面的话,有些类文件会找不到所引用的类才报错,记号之。
        2. debug 时出现 source not found ,跳不到要 debug 的类里面,这时需要在 Window --> Preferences --> Tomcat --> Source Path,在Source Path 标签下有行文字:Add java projects to source path(Eclipse debugger will search for source files in these projects),将要调试的project选中。        
        3.  查看 jdk 的源代码: "已经安装的jre" 那边挑选一下jdk, 使用jdk的jre就行了。        

        4.  eclipse启动后找不到插件:

             (1)删除整个目录/eclipse/configuration/org.eclipse.update/,重启eclipse  

             (2)在/configuration/config.ini文件中加入一行

             osgi.checkconfiguration=true

这样它会寻找并安装插件,找到后可以把那行再注释掉,这样以后每次启动就不会因寻找插件而显得慢了。

        5.  eclipse工作空间设置

        eclipse\configuration\.settings\org.eclipse.ui.ide.prefs,设置是否显示工作空间选择面板:SHOW_WORKSPACE_SELECTION_DIALOG=true,还有一种方法是打开Window -> Preferences > General > Startup and Shutdown选中 Prompt for workspace on startup。设置工作空间的位置:RECENT_WORKSPACES=D\:\\workspace.

        6.  eclipse提示“"Unable to install breakpoint。。。”,这个是编译器的设置问题,window->preferences->java->Compiler在compiler起始页,classfile Generation区域中确认已经勾选了All line number attributes to generated class files。如果已经勾选,从新来一下再Apply一下。或者从项目层次进行设定,项目属性->java compiler同样在起始页,确定已经勾选。
        常见用法:
        1.  设置Eclipse里面的Default Editor:这个对于把 html editor plugin 设置为默认的编辑器很有用,步骤: 选择菜单 Window -> Preferences. 在弹出的对话框中展开左侧的树: General -> File Associations, 再选中右侧的列表中的 *.jsp(需要点击滚动条向下滚动), 在下侧出现的所有编辑器类型中选择 “MyEclipse JSP Editor…”, 然后点击右侧的 Default 按钮, 再点击 OK 按钮关闭对话框即可设置所有 JSP 文件的默认打开方式。
         2.  过滤jar包和缩短包名:TIP: 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.

Another useful Eclipse trick is to use 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.
文章出处:http://www.diybl.com/course/3_program/java/javashl/20071126/87734.html
         3.  不让 jar 包在 project explorer 视图中显示,在 eclipse 中如果不让jar显示没有 myeclipse 中方便,在 myeclipse 中不让 jar 显示可以过滤, eclipse 可以自定义一个 user library,然后将 jar 包放进去就行了。
          步骤: 右击你的工程→Build Path→Add Libraries→User Library→User Libraries→new→输入名字(假设Test,然后选中Test,点Add JARS,加入你工程用的Jar包。 记得要把你原来的那些Jar包删掉,不然因为包重复报错的。
资料参考自:
http://topic.csdn.net/u/20080717/09/452ba80e-54a4-4062-83a5-f02ad51105f3.html
         4.  指定生成class的文件夹,在eclipse中建一个web工程,一般为 dynamic project,默认将class文件生成在build文件夹下的classes下,如果想把class文件放在web-inf下,需要进行一下指定,步骤:在project的java build path视图里,改变Default output folder的属性,例如本例将/test/build/classes改为test/WebContent/WEB-INF/classes。
         5.   eclipse导出war包(第二种方法比第一种好用):
         1. 需要先安装tomcat插件(tomcatPluginV321),项目-》属性-》tomcat-》export to war settings,写上要导出war包的位置。
            然后,项目-》export-》general -》archive file-》To archive file中写要导出文件的位置和文件名。
         2. 或在DOS命令符中,将路径转到你想要打包的应用的根目录下,如webroot目录下,用命令:
            jar cvf myApp.war *.*
            就可以了
            myApp是命名,随便用的
          6.   svn使用:
          project-team-share project-svn-填写url如:https://smiletalk.googlecode.com/svn/trunk/smiletalk,点击next,填写svn的用户名和密码,connect oo。
          7.   CVS文件系统不同步:Resource is out of sync with the file system:
          这是因为在eclipse之外修改文件造成的,需要手动刷新一下资源管理器。方法:工程右键-刷新(refresh)。

            8.   window-->show view 中可增加在eclipse下方的控制台显示模块信息。

            9.   在Eclipse中查看JVM的内存使用情况:

         1).eclipse自带内存监视及回收插件:Eclipse 3.2以上都可以使用,菜单 Window => Preferences => General => 右边,

   把 Show Heap Status 打上勾就会在右下角任务栏显示内存监视器,并且可以点击内存回收。

          2).Eclipse3.2以下版本,方法如下:

          1.在eclipse根目录下建立一个文件,文件名options,不要加后缀直接保存,文件内容org.eclipse.ui/perf/showHeapStatus=true

          2.修改eclipse目录下的eclipse.ini文件,在开始添加如下内容:

-debug
options
-vm
javaw.exe

 

                10.  卸载andriod sdk插件,如果卸载出现困难时,"Help" -> "Software Updates" -> "Manage Configuration" 再左边找到关于Android的开发插件,单击选择之后,在右边框里选择"Disable",就可以了,提示重启eclipse,完成!(trackback:http://howieshen.blogbus.com/logs/56919307.html

 

0
0
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics