- 浏览: 136747 次
- 性别:
- 来自: 上海
-
文章分类
最新评论
-
qq466862016:
不错的文章
JDK动态代理与CGLIB代理的对比 -
jinxiongyi:
你好,jpedal pdf转换图片的 画质,怎么提高。。我转 ...
介绍几款PDF转图片的开源工具 -
qqdwll:
转图片消耗的内存还是不小。 有时间得找找有没有更好的办法, 把 ...
介绍几款PDF转图片的开源工具 -
xiaoyao3857:
Thanks for your work!It's help ...
Keeping Eclipse running clean (转载) -
iceside:
图片讲解非常详细,说清了引用复制是怎么回事
Java 值传递的终极解释
原文地址: http://www.eclipsezone.com/eclipse/forums/t61566.html
In my time helping people with their Eclipse installs I have seen time after time situations where a crash of Eclipse, the VM or the computer or even just long months of development have started to wear down the stability of the workspace where Eclipse stores everything. If you have time some day, take a look at the <workspace dir>\.metadata directory to get an idea of just how much Eclipse generates and stores in your workspace. Every time you add a plugin, upgrade a plugin, remove a plugin that puts and changes information in your workspace, much like your Windows registry as you install/upgrade/uninstall software on Windows.
Over time you may begin to notice strange behavior in your plugins while using them. Clicking "Search" doesn't actually do anything, autocomplete no longer works or pops up strange results, you just installed a new plugin that is suppose to be stable and it doesn't work at all; what is going on? Chances are your workspace has gotten into a state where, for lack of a better technical understanding, has collected a lot of dust and it is time to clean house.
Using the -clean argument
The easiest way to fix up a dusty workspace is using the -clean command line argument to the eclipse.exe executable. Let's take a look at what the Eclipse help docs tell us this command does:
if set to "true", any cached data used by the OSGi framework and eclipse runtime will be wiped clean. This will clean the caches used to store bundle dependency resolution and eclipse extension registry data. Using this option will force eclipse to reinitialize these caches.
The -clean argument is a one-time use flag, meaning after you have run Eclipse using it, you can remove it until you need it again. If you prefer to leave it set the only side effect of using it ever time are increased startup times (2-3x longer) which some folks do not mind.
Now, back to the description above, this may not sound like much, I have to say that you would be amazed at what using -clean can fix up sometimes; some really random things. There are three easy ways you can go about using this argument:
Edit the eclipse.ini file located in your <Eclipse install directory> and add it as the first argument on the first line.
Edit the shortcut you use to start Eclipse and add it as the first argument.
Create a batch or shell script that calls the Eclipse executable with the -clean argument. The advantage to this step is you can keep the script around and use it each time you want to clean out the workspace. You can name it something like eclipse-clean.bat (or eclipse-clean.sh).
My preferred way to handle this is #1 only because I don't do this very often. I open my eclipse.ini file with any editor, add -clean as the first argument, save the file and restart Eclipse. After this step is done I remove the argument from the file, save it and exit from my text editor.
Creating a new workspace
Now let us say that using -clean didn't help, things are still acting strange, the next step to recovering a stable development environment is to create a new workspace and re-import your old settings and projects into it. As many times as I have seen using -clean solve the most obscure problem or dirty workspace I have seen it not make a lick of difference that only a new workspace would cure.
If you find yourself in the situation where you need to create a new workspace, don't fear, since Eclipse makes exporting and importing your preferences and projects the only time consuming part of this task is clicking a lot of OK and Finish buttons.
The first step to creating a new workspace is to get everything you need out of the current one, that means our preferences. You can accomplish this by going to File > Export... > Preferences > "To preference file", give it a name > Finish . The default at the top of the dialog should have been to Export all , if it wasn't, be sure to select that before clicking Finish. Also make sure you are exporting to a file to a neutral location, like your Desktop.
After we are done exporting our preferences use the File > Switch Workspace command to specify the location of a new workspace and then click OK . After Eclipse has restarted the first thing to do is pull in your old preferences. Go to File > Import > Preferences > "From preferences file", select your file > Finish . After your preferences are imported now it is on to the projects.
To import your projects use the File > Import > Existing Projects into Workspace wizard. Here you will select the directories of your old projects and import them into your new workspace one at a time. With newer versions of Eclipse, there is a new option Copy Project into Workspace that is a good option to check before performing your Import. This will guaruntee that the physical files are copied out of the old workspace and into the new one. If you do not select this option, a link is created so you will need to keep the old workspace directory around as it holds the physical files (Thanks Sanjay for the pointer!) .
After you are done importing your projects, you are all set with a new and clean workspace, congratulations!
Clean Reinstall of Eclipse
Now let's say that none of the tips above worked, the problem you were having is still persisting and things just aren't working right. In my experience, if that is the case you most likely have a broken install which more times than not stems from using incompatible versions of plugins with the wrong base version of Eclipse. For example, trying to use a Eclipse 3.1 GA compatible plugin with Eclipse 3.2 Milestone 2 release. These plugin developers have guarantees from Eclipse of API stability during GA and stable release cycles that they develop against, when a stable plugin is then used in a nightly, integration or milestone build the chances that the underlying Eclipse APIs have changed are increased and it's possible that the plugin you are trying to use will no longer function correctly or just start functioning very strangely. As a responsible user you need to be aware of this and try and avoid this situation.
Now assuming you are using all the correct versions of Eclipse and your plugins and things are just broken (maybe you tested every plugin on EclipsePluginCentral and your install is shot) here's a good strategy for getting back to a clean install of Eclipse and your plugins.
First, I always suggest people perform new installs parallel to their old ones. Don't go erasing your old Eclipse install yet, use your new install for at least a week to make sure you got it right before you toast the old one. Be sure to write down or remember all the plugins you want to use with your clean install of Eclipse.
Second, redownload the most recent stable Eclipse release (Eclipse 3.1.1 is the current stable release at the time of this writing) and unzip it to a new location. Go ahead and install all of your plugins or at least the ones you can without running Eclipse.
Third, be sure to make all the necessary changes to your eclipse.ini file or shortcut for your new install that you had with your old install. Be sure to add the -clean command line argument for this first run since we are going to try and use your existing workspace for this initially.
Last, fire up your new install of Eclipse and point it at your existing workspace directory. Now play around and see if the install is working, if you are having a problem that continues to persist, the last step in this journey is to create a new workspace to use with your new install. Please follow the steps above in the Creating a new workspace section to do that.
If for some reason you are still experiencing trouble at this point, depending on the kind of problem, you should start looking at and testing native issues. Your operating system patch level, library versions, Java version, up to date drivers, memory checker, hard drive checker, virus checker, spyware checker, etc. Any time I've seen a problem go this far it usually turned out to be either a user fundamentally not understanding what they were doing and it was user error the entire time or there is a native issue as I outlined above at play here that needs to be resolved.
Conclusion
Now that you have made it this far, it means you have a clean Eclipse install. I hope this tip was helpful to some folks out there that might be having some "strange behaviors" and aren't quite sure why or what to do. Thank you for reading.
Thanks for your work!It's helpful to me
Now let's say that none of the tips above worked, the problem you were having is still persisting and things just aren't working right. In my experience, if that is the case you most likely have a broken install which more times than not stems from using incompatible versions of plugins with the wrong base version of Eclipse. For example, trying to use a Eclipse 3.1 GA compatible plugin with Eclipse 3.2 Milestone 2 release. These plugin developers have guarantees from Eclipse of API stability during GA and stable release cycles that they develop against, when a stable plugin is then used in a nightly, integration or milestone build the chances that the underlying Eclipse APIs have changed are increased and it's possible that the plugin you are trying to use will no longer function correctly or just start functioning very strangely. As a responsible user you need to be aware of this and try and avoid this situation.
In my time helping people with their Eclipse installs I have seen time after time situations where a crash of Eclipse, the VM or the computer or even just long months of development have started to wear down the stability of the workspace where Eclipse stores everything. If you have time some day, take a look at the <workspace dir>\.metadata directory to get an idea of just how much Eclipse generates and stores in your workspace. Every time you add a plugin, upgrade a plugin, remove a plugin that puts and changes information in your workspace, much like your Windows registry as you install/upgrade/uninstall software on Windows.
Over time you may begin to notice strange behavior in your plugins while using them. Clicking "Search" doesn't actually do anything, autocomplete no longer works or pops up strange results, you just installed a new plugin that is suppose to be stable and it doesn't work at all; what is going on? Chances are your workspace has gotten into a state where, for lack of a better technical understanding, has collected a lot of dust and it is time to clean house.
Using the -clean argument
The easiest way to fix up a dusty workspace is using the -clean command line argument to the eclipse.exe executable. Let's take a look at what the Eclipse help docs tell us this command does:
if set to "true", any cached data used by the OSGi framework and eclipse runtime will be wiped clean. This will clean the caches used to store bundle dependency resolution and eclipse extension registry data. Using this option will force eclipse to reinitialize these caches.
The -clean argument is a one-time use flag, meaning after you have run Eclipse using it, you can remove it until you need it again. If you prefer to leave it set the only side effect of using it ever time are increased startup times (2-3x longer) which some folks do not mind.
Now, back to the description above, this may not sound like much, I have to say that you would be amazed at what using -clean can fix up sometimes; some really random things. There are three easy ways you can go about using this argument:
Edit the eclipse.ini file located in your <Eclipse install directory> and add it as the first argument on the first line.
Edit the shortcut you use to start Eclipse and add it as the first argument.
Create a batch or shell script that calls the Eclipse executable with the -clean argument. The advantage to this step is you can keep the script around and use it each time you want to clean out the workspace. You can name it something like eclipse-clean.bat (or eclipse-clean.sh).
My preferred way to handle this is #1 only because I don't do this very often. I open my eclipse.ini file with any editor, add -clean as the first argument, save the file and restart Eclipse. After this step is done I remove the argument from the file, save it and exit from my text editor.
Creating a new workspace
Now let us say that using -clean didn't help, things are still acting strange, the next step to recovering a stable development environment is to create a new workspace and re-import your old settings and projects into it. As many times as I have seen using -clean solve the most obscure problem or dirty workspace I have seen it not make a lick of difference that only a new workspace would cure.
If you find yourself in the situation where you need to create a new workspace, don't fear, since Eclipse makes exporting and importing your preferences and projects the only time consuming part of this task is clicking a lot of OK and Finish buttons.
The first step to creating a new workspace is to get everything you need out of the current one, that means our preferences. You can accomplish this by going to File > Export... > Preferences > "To preference file", give it a name > Finish . The default at the top of the dialog should have been to Export all , if it wasn't, be sure to select that before clicking Finish. Also make sure you are exporting to a file to a neutral location, like your Desktop.
After we are done exporting our preferences use the File > Switch Workspace command to specify the location of a new workspace and then click OK . After Eclipse has restarted the first thing to do is pull in your old preferences. Go to File > Import > Preferences > "From preferences file", select your file > Finish . After your preferences are imported now it is on to the projects.
To import your projects use the File > Import > Existing Projects into Workspace wizard. Here you will select the directories of your old projects and import them into your new workspace one at a time. With newer versions of Eclipse, there is a new option Copy Project into Workspace that is a good option to check before performing your Import. This will guaruntee that the physical files are copied out of the old workspace and into the new one. If you do not select this option, a link is created so you will need to keep the old workspace directory around as it holds the physical files (Thanks Sanjay for the pointer!) .
After you are done importing your projects, you are all set with a new and clean workspace, congratulations!
Clean Reinstall of Eclipse
Now let's say that none of the tips above worked, the problem you were having is still persisting and things just aren't working right. In my experience, if that is the case you most likely have a broken install which more times than not stems from using incompatible versions of plugins with the wrong base version of Eclipse. For example, trying to use a Eclipse 3.1 GA compatible plugin with Eclipse 3.2 Milestone 2 release. These plugin developers have guarantees from Eclipse of API stability during GA and stable release cycles that they develop against, when a stable plugin is then used in a nightly, integration or milestone build the chances that the underlying Eclipse APIs have changed are increased and it's possible that the plugin you are trying to use will no longer function correctly or just start functioning very strangely. As a responsible user you need to be aware of this and try and avoid this situation.
Now assuming you are using all the correct versions of Eclipse and your plugins and things are just broken (maybe you tested every plugin on EclipsePluginCentral and your install is shot) here's a good strategy for getting back to a clean install of Eclipse and your plugins.
First, I always suggest people perform new installs parallel to their old ones. Don't go erasing your old Eclipse install yet, use your new install for at least a week to make sure you got it right before you toast the old one. Be sure to write down or remember all the plugins you want to use with your clean install of Eclipse.
Second, redownload the most recent stable Eclipse release (Eclipse 3.1.1 is the current stable release at the time of this writing) and unzip it to a new location. Go ahead and install all of your plugins or at least the ones you can without running Eclipse.
Third, be sure to make all the necessary changes to your eclipse.ini file or shortcut for your new install that you had with your old install. Be sure to add the -clean command line argument for this first run since we are going to try and use your existing workspace for this initially.
Last, fire up your new install of Eclipse and point it at your existing workspace directory. Now play around and see if the install is working, if you are having a problem that continues to persist, the last step in this journey is to create a new workspace to use with your new install. Please follow the steps above in the Creating a new workspace section to do that.
If for some reason you are still experiencing trouble at this point, depending on the kind of problem, you should start looking at and testing native issues. Your operating system patch level, library versions, Java version, up to date drivers, memory checker, hard drive checker, virus checker, spyware checker, etc. Any time I've seen a problem go this far it usually turned out to be either a user fundamentally not understanding what they were doing and it was user error the entire time or there is a native issue as I outlined above at play here that needs to be resolved.
Conclusion
Now that you have made it this far, it means you have a clean Eclipse install. I hope this tip was helpful to some folks out there that might be having some "strange behaviors" and aren't quite sure why or what to do. Thank you for reading.
评论
1 楼
xiaoyao3857
2011-08-24

Now let's say that none of the tips above worked, the problem you were having is still persisting and things just aren't working right. In my experience, if that is the case you most likely have a broken install which more times than not stems from using incompatible versions of plugins with the wrong base version of Eclipse. For example, trying to use a Eclipse 3.1 GA compatible plugin with Eclipse 3.2 Milestone 2 release. These plugin developers have guarantees from Eclipse of API stability during GA and stable release cycles that they develop against, when a stable plugin is then used in a nightly, integration or milestone build the chances that the underlying Eclipse APIs have changed are increased and it's possible that the plugin you are trying to use will no longer function correctly or just start functioning very strangely. As a responsible user you need to be aware of this and try and avoid this situation.
发表评论
-
介绍几款PDF转图片的开源工具
2011-09-09 00:40 4607最近项目中有个需求需要把PDF转成一张图。经过调查,有 ... -
jadclipse(反编译Eclipse插件)
2011-07-19 19:13 1665Jad Java decompiler plugin for ... -
Java开发时候的内存溢出
2011-07-13 17:33 1200这里以tomcat环境为例, ... -
class loader
2011-07-08 17:23 0Because Class.getResource() eve ... -
Jakarta-Common-BeanUtils使用笔记
2011-07-06 16:55 1403原文转发http://blog.csdn.net/fa ... -
基于MVC模式Struts框架研究
2011-04-13 20:02 1359不做web开发多年了, 可偶尔去面试的时候, 还是 ... -
Java反射与动态代理
2011-04-13 15:08 1021这篇文章是 成富 先生在InfoQ上Java 深度历险系列的一 ... -
Java枚举类型
2011-04-04 19:50 797Tiger中的一个重要新特性是枚举构造,它是一种新的Java枚 ... -
Java 值传递的终极解释
2011-03-21 22:49 1984对于Java的值传递, 你真的了解么? Ja ... -
六种异常处理的陋习
2011-03-20 03:21 840你觉得自己是一个Java专 ... -
数组初始化
2011-03-20 02:40 898数组初始化,你觉得简单吗? a.如果你觉得简单,那请看下面的 ... -
Java 实现 hashCode 方法
2011-03-11 17:07 1219原文 http://www.javapractices.com ... -
Java 中 immutable class 以及怎样实现immutable 类
2011-03-11 16:47 1374原文 http://www.javapractices.com ... -
Java 内部类介绍
2011-02-16 17:14 1012转载: http://zhidao.baidu.com/que ... -
Java 中的Clone 学习总结
2011-01-25 18:22 27901. 一个类需要实现clone. 一个最佳实践是它需要实现 C ... -
java 通过流, nio 移动文件或者文件夹
2011-01-04 17:54 1896我们用例子说明java怎样通过不同的方式移动文件或文件夹。 ... -
转 深入探讨SOAP、RPC和RMI
2010-12-17 00:34 1083这篇文章是从网上转下来的。 原文应该是写于2001年。 10 ... -
java 6 中的性能优化
2010-12-07 15:30 1451文章转载自: http://www ... -
创建强健,稳定的 JMS 系统
2010-12-07 15:21 991The most reliable way to produc ... -
Java Modifier Summary
2010-11-12 15:10 900<tbody> <tr> ...
相关推荐
BIS_Humans keeping AI in check
自动车道保持系统(Automated Lane Keeping System, 简称ALKS)是现代智能驾驶辅助技术的重要组成部分,它旨在提高行车安全性和舒适性,减轻驾驶员在高速公路等特定场景下的驾驶负担。ECE R157e是针对这一系统的法规...
互补滤波论文 Keeping a Good Attitude.pdf 本文总结了一个名为"Keeping a Good Attitude"的论文,该论文提出了一个四元数基础的方向滤波器,用于感知和磁力计(MARGs)中的惯性测量单元(IMU)。该论文的主要贡献...
小学教案
小学教案
小学教案
标题中的"PyPI 官网下载 | django-account-keeping-0.3.1.tar.gz"表明这是一个在Python的包索引服务(PyPI)上发布的软件包,名为`django-account-keeping`,版本号为0.3.1,且是以tar.gz格式提供的。这种格式通常...
Hulu-Andrew-microservices keeping the peace
"Keeping Notes Web App Project"是一个基于JavaScript(使用jQuery库)的免费源代码项目,旨在帮助用户在线创建、存储和管理个人笔记。这个项目的核心目标是提供一个轻量级且易于使用的界面,用户可以在其中记录...
Would you mind keeping your voice downPPT教案学习.pptx
A business web application for keeping track of hours spent on a project with the ability to handle multiple resources as well as multiple projects.
### Web Operations: Keeping the Data On Time #### 一、引言 《Web Operations: Keeping the Data On Time》这本书由John Allspaw和Jesse Robbins编辑,由O'Reilly Media出版,于2010年首次发行。本书汇集了一...
【时间保持】(Time Keeping) 是一个至关重要的领域,它涉及到科学、技术和社会生活的方方面面。时间保持不仅是确保日常生活有序进行的基础,也是科学研究和技术发展的重要支柱。以下是对标题和描述所涉及知识点的...
语言:English,Nederlands在浏览器中认识产品,并在浏览器中找到了Keeping。数据字gesynchroniseerd已满足je帐户。在浏览器中认识产品,并在浏览器中找到了Keeping。Tijdregistratiedata wordt gesynchroniseerd遇到...
车道保持辅助系统(Lane Keeping Assist System,LKAS)是现代智能驾驶汽车中不可或缺的一个功能,它主要用于帮助车辆在行驶过程中保持在正确的车道内。在MATLAB Simulink环境中设计和模拟这样的系统,可以深入理解...
"time_keeping"这个主题,结合标签"Java",表明我们关注的是在Java环境中如何有效地管理和跟踪时间。Java提供了一系列内置类和方法,使得开发者能够进行精确的时间计算、日期处理以及定时任务的安排。 1. **Java....
该程序被称为“Great program for keeping personal messages personal”,意味着它专注于为个人用户提供一个安全的环境,保护他们的信息不被未经授权的第三方访问。这样的程序通常会提供一个简洁直观的用户界面,让...
车道保持系统最新国际标准,适合汽车ADAS相关研究人员及工程师使用。
《保持Windows系统安全》 Windows操作系统作为全球广泛使用的桌面平台,拥有熟悉的桌面体验、广泛的硬件生态系统和丰富的桌面应用程序兼容性。然而,随着技术的发展,网络安全威胁也在不断增加,尤其是在企业环境中...