获取 Java Eclipse 的轻量级安装
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2992749/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Getting a lightweight installation of Java Eclipse
提问by liam
Having dealt with yet another stupid eclipse problem, I want to try to get the lightest, most minimal Eclipse installation as possible.
在处理了另一个愚蠢的 eclipse 问题之后,我想尝试尽可能地获得最轻量、最少的 Eclipse 安装。
To be clear, I use eclipse for two things:
需要明确的是,我将 eclipse 用于两件事:
- Editing Java
- Debugging Java
- 编辑 Java
- 调试 Java
Everything else I do through Emacs/Zsh (editing JSP/XML/JS, file management, SVN check-in, etc). I have not found any aspect of working in Eclipse to do these tasks to be efficient or even reliable, so I do not want plug-ins that relate to it.
我通过 Emacs/Zsh 做的所有其他事情(编辑 JSP/XML/JS、文件管理、SVN 签入等)。我还没有发现在 Eclipse 中执行这些任务的任何方面都是高效甚至可靠的,所以我不想要与之相关的插件。
From the eclipse.org site, thisis the lightest install of eclipse that they have, and I don't want any of those things (Bugzilla, Mylyn, CVS xml_ui), and have actually had problems with each of them even though I do not use them.
从 eclipse.org 站点,这是他们拥有的最轻量级的 eclipse 安装,我不想要任何这些东西(Bugzilla、Mylyn、CVS xml_ui),并且实际上每个人都遇到了问题,即使我这样做了不使用它们。
So what is the minimal build I can get that will:
那么我能得到的最小构建是什么:
- Ignore SVN metadata
- Includes the full-featured editor (intellisense and type-finding)
- Includes the full-featured debugger (standard Eclipse/JDK)
- 忽略 SVN 元数据
- 包括全功能编辑器(智能感知和类型查找)
- 包括全功能调试器(标准 Eclipse/JDK)
Does not have any extra plug-ins, platforms, or "integrations" with other platforms, specifically, I don't want to deal with plug-ins relating to:
没有任何额外的插件、平台或与其他平台的“集成”,具体来说,我不想处理与以下相关的插件:
Maven, JSP Validation, Javascript editing or validation, CVS or SVN, Mylyn, Spring or Hibernate "natures", app servers like a bundled Tomcat/GlassFish/etc, J2EE tools, or anything of the like.
Maven、JSP 验证、Javascript 编辑或验证、CVS 或 SVN、Mylyn、Spring 或 Hibernate“自然”、应用服务器(如捆绑的 Tomcat/GlassFish/等)、J2EE 工具或任何类似的东西。
I do primarily Spring/Hibernate/web-mvc apps, and have never dealt with an Eclipse plug-in that handles any of it gracefully, I can work effectively with my own toolset, but Eclipse extensions do nothing but get in the way.
我主要做 Spring/Hibernate/web-mvc 应用程序,从来没有处理过可以优雅地处理其中任何一个的 Eclipse 插件,我可以使用我自己的工具集有效地工作,但是 Eclipse 扩展只会妨碍工作。
I have worked with plain eclipse up to Ganymede, MyEclipse (up to 7.5), and the latest version of Spring-SourceTools, and find that they are all saddled with buggy useless plug-ins (though the combination is always different).
我使用过普通 Eclipse 直到 Ganymede、MyEclipse(最高 7.5)和最新版本的 Spring-SourceTools,发现它们都背负着有缺陷的无用插件(尽管组合总是不同的)。
Switching to NetBeans/Intellij is not an option, and my teammates work with SVN-controlled .class/.project files, so it pretty much has to be Eclipse.
切换到 NetBeans/Intellij 不是一个选项,我的队友使用 SVN 控制的 .class/.project 文件,所以它几乎必须是 Eclipse。
Does anyone have any good advice on how I can save a few grey hairs?
有没有人对我如何拯救几根白发有什么好的建议?
采纳答案by Chris Lercher
The "Eclipse IDE for Java Developers" version isn't the smallest one! Look for "Eclipse Classic" - it doesn't contain most of the things you mentioned. It's larger in download size only, because it comes with source code.
“面向 Java 开发人员的 Eclipse IDE”版本并不是最小的版本!寻找“Eclipse Classic”——它不包含你提到的大部分内容。它仅在下载大小上更大,因为它带有源代码。
See this comparison: http://www.eclipse.org/downloads/compare.php
回答by Mark Peters
Get as minimal an installation as you can, and then remove whatever is left that you don't want.
尽可能少安装,然后删除您不想要的任何剩余内容。
Longer answer:
更长的答案:
I played around a bit. Here's how I experimented:
我玩了一会儿。这是我的实验方式:
- Extract a clean eclipse*.zip to two different directories; call it
eclipse
andeclipse-bak
. We'll only modifyeclipse
. - Before starting it the first time, remove some of the features from the features folder. I got rid of
org.eclipse.cvs
,org.eclipse.epp.\*
,...mylyn\*
,...wst\*
. - Start up Eclipse to a workspace. Create in that workspace a Java project, debugging configuration, etc. Stuff that you would want to do and that will complain if we remove the wrong thing. Open up the Error Logview.
- Close Eclipse. Remove something (or a group of things) from the plugins folder.
- Open Eclipse. Check the error log to see if something you care about couldn't load. If it did, add those things back from
eclipse-bak/plugins
. If not, close Eclipse and return to step 4 for a new set of plugins.
- 将一个干净的 eclipse*.zip 解压到两个不同的目录;调用它
eclipse
和eclipse-bak
。我们只会修改eclipse
. - 在第一次启动之前,从 features 文件夹中删除一些功能。我摆脱了
org.eclipse.cvs
,org.eclipse.epp.\*
,...mylyn\*
,...wst\*
。 - 启动 Eclipse 到工作区。在该工作区中创建一个 Java 项目、调试配置等。您想做的事情,如果我们删除错误的内容,就会抱怨。打开错误日志视图。
- 关闭日食。从插件文件夹中删除某些内容(或一组内容)。
- 打开日食。检查错误日志以查看您关心的内容是否无法加载。如果是这样,请从
eclipse-bak/plugins
. 如果没有,请关闭 Eclipse 并返回到步骤 4 以获取一组新插件。
Using this I got my configuration to still be able to edit and debug Java files, but including only these plugins:
使用它,我的配置仍然能够编辑和调试 Java 文件,但只包括这些插件:
com.ibm.icu*
org.apache.*
org.eclipse.compare*
org.eclipse.core*
org.eclipse.debug*
org.eclipse.draw2d*
org.eclipse.ecf*
org.eclipse.epp.package.java*
org.eclipse.equinox*
org.eclipse.help*
org.eclipse.jdt*
org.eclipse.jface*
org.eclipse.ltk*
org.eclipse.osgi*
org.eclipse.platform*
org.eclipse.rcp*
org.eclipse.search*
org.eclipse.team.core
org.eclipse.team.ui
org.eclipse.text
org.eclipse.ui*
org.eclipse.update*
org.hamcrest*
org.sat4j*
Most of that is core stuff, but you might be able to trim it down further. Notably gone are Mylyn, the usage collector, EMF, CVS, WST, even JUnit (though I think you should keep JUnit).
其中大部分是核心内容,但您可能可以进一步精简。值得注意的是 Mylyn、使用收集器、EMF、CVS、WST,甚至 JUnit(虽然我认为你应该保留 JUnit)。
回答by Ross
If you only want to use Eclipse for editing / Debugging Java I would suggest using a plain Text editor. It seems an overkill to install Eclipse and not use most of its features.
如果您只想使用 Eclipse 进行编辑/调试 Java,我建议您使用纯文本编辑器。安装 Eclipse 而不使用它的大部分功能似乎是一种矫枉过正。
A very popular choice is VIM. Also check out this SO linkfor tips in using VIM as a Java editor. You can also debug Java code with a command line debugger as mentioned in this SO link.
一个非常流行的选择是VIM。另请查看此SO 链接以获取使用 VIM 作为 Java 编辑器的提示。您还可以使用此SO 链接中提到的命令行调试器调试 Java 代码。
回答by ykaganovich
回答by Andrew Niefer
You can download the empty Eclipse platform and then manually install the JDT tools.
您可以下载空的 Eclipse 平台,然后手动安装 JDT 工具。
- Go to the The Eclipse Project Downloads page.
- Choose the bundle you want, probably Latest Release.
- On the download page of the chosen bundle:
- Download Platform Runtime Binary
- Download JDT Runtime Binary
- Extract the Platform Runtime Binaryarchive file and run it (for example, by double clicking on
eclipse.exe
). - Install the JDT binary:
- Click Help → Install New Software → Add... → Archive.
- Choose the JDT zip file you downloaded.
- Uncheck Group Items by category.
- Select the Eclipse Java Development Tools.
- Click next to install and restart Eclipse when prompted.
- 转至Eclipse 项目下载页面。
- 选择你想要的包,可能是最新版本。
- 在所选捆绑包的下载页面上:
- 下载平台运行时二进制文件
- 下载JDT 运行时二进制文件
- 提取平台运行时二进制存档文件并运行它(例如,通过双击
eclipse.exe
)。 - 安装 JDT 二进制文件:
- 单击帮助 → 安装新软件 → 添加... → 存档。
- 选择您下载的 JDT zip 文件。
- 取消选中Group Items by category。
- 选择Eclipse Java 开发工具。
- 出现提示时,单击下一步安装并重新启动 Eclipse。
JDT from the Eclipse update site
来自 Eclipse 更新站点的 JDT
You can also install JDT from the Eclipse update site, instead of downloading the binary.
您还可以从 Eclipse 更新站点安装 JDT,而不是下载二进制文件。
To do this, do this following:
为此,请执行以下操作:
- Skip downloading the JDT Runtime Binary, only download, extract and run the Platform Runtime Binary.
- Go to the Install New Software, but instead of Archivechose the Eclipse download site.
- Search and install Eclipse Java Development Tools.
- 跳过下载JDT 运行时二进制文件,只下载、解压缩和运行平台运行时二进制文件。
- 转到Install New Software,但选择 Eclipse 下载站点而不是Archive。
- 搜索并安装Eclipse Java 开发工具。
回答by haylem
A bit late to this party, but I asked myself the same question for a while, and while now I'm back to a more fully-fledged Eclipse installation, I used to to the following to streamline it a bit. Hope it helps.
参加这个聚会有点晚了,但我问了自己一段时间同样的问题,虽然现在我回到了一个更成熟的 Eclipse 安装,但我习惯于使用以下方法来简化它。希望能帮助到你。
What I Needed
我需要什么
Functionalities:
功能:
- Java Support
- Java + Java EE (XML) + Debug Perspectives
- Java 支持
- Java + Java EE (XML) + 调试视角
Pretty much it. There's a lot of other things I like to use in Eclipse, but I needed to keep it down to the skinniest possible because I was in a 3GB environment where I also needed to run other servers in parallel, so I couldn't afford much.
差不多吧。我喜欢在 Eclipse 中使用很多其他东西,但我需要将它保持在尽可能小的范围内,因为我处于 3GB 环境中,我还需要并行运行其他服务器,所以我负担不起。
Resulting Perspectives:
结果观点:
- Lightweight Java
- Lightweight Browser (fairly tweaked for code reviews and code inspection - that one was actually heavier than the others)
- Lightweight Debug
- 轻量级 Java
- 轻量级浏览器(针对代码和代码检查进行了相当大的调整 - 实际上比其他浏览器重)
- 轻量级调试
What I Did
我做了什么
- Install Eclipse Java EE (install classic if not caring about the Java EE/XML bits)
- disable hungry views
- disable outline (when you need one, just do
CTRL+O
) - disable call and type hierarchies
- disable outline (when you need one, just do
- disable decorators
- disable menu entries (right-
- disable toolbar items
- even better: hide the toolbar
- disable hovers and actions associated with that
- disable spell-checking
- disable XML validation
- disable Mylyn
- disable non-needed search forms in
CTRL+H
dialog (I usually actually only use the "File Search" mode, sometimes the "Java" one) - disable usage reporting
- disable unnecessary plugins or features
- disables perspectives and plugins loaded automatically on startup
- restrict internal limits:
- some views have a scope (enclosing class, project, working set, workspace...)
- some views and UI elements have boundaries (console/loggers, highlighters, markers...)
- tweak the eclipse.ini to:
- -clean the workspace (slower, but I tend to prefer to do that)
- use G1GC
- reduce memory usage (I noticed that I can perfectly live with -xss128k and -xmx384 with G1, for instance. YMMV, of course, as always with JVM tuning.)
- use a server VM (and point directly to the VM's DLL)
- 安装 Eclipse Java EE(如果不关心 Java EE/XML 位,请安装经典)
- 禁用饥饿视图
- 禁用大纲(当你需要一个时,就做
CTRL+O
) - 禁用调用和类型层次结构
- 禁用大纲(当你需要一个时,就做
- 禁用装饰器
- 禁用菜单项(右-
- 禁用工具栏项目
- 更好的是:隐藏工具栏
- 禁用悬停和与之相关的操作
- 禁用拼写检查
- 禁用 XML 验证
- 禁用 Mylyn
- 在
CTRL+H
对话框中禁用不需要的搜索表单(我通常只使用“文件搜索”模式,有时使用“Java”模式) - 禁用使用报告
- 禁用不必要的插件或功能
- 禁用在启动时自动加载的透视图和插件
- 限制内部限制:
- 一些视图有一个范围(封闭类、项目、工作集、工作区......)
- 一些视图和 UI 元素有边界(控制台/记录器、荧光笔、标记...)
- 将 eclipse.ini 调整为:
- -清理工作区(较慢,但我倾向于这样做)
- 使用 G1GC
- 减少内存使用(我注意到我可以完美地使用 -xss128k 和 -xmx384 与 G1,例如。YMMV,当然,与 JVM 调优一样。)
- 使用服务器 VM(并直接指向 VM 的 DLL)
Also disable views you don't need in the "Debug" and "Code Browsing" perspectives.
还要禁用“调试”和“代码浏览”透视图中不需要的视图。
Sorry, I had actually saved all of these as a set of 3 lightweight perspectives to re-import everytime on my new project, but I cannot get my hands on them at the moment. If I ever find then, I'll add a link to them here.
抱歉,我实际上已将所有这些保存为一组 3 个轻量级透视图,以便每次在我的新项目中重新导入,但目前我无法使用它们。如果我找到了,我会在这里添加一个链接。
回答by Samih3
Instead of going for a ready package from Eclipse Downloads, from the same page go for the Eclipse Installer. Currently available for Mac, Windows & the beloved Linux. Launch the Installer which should update (or not if you are lucky enough :) ). Select "Eclipse Platform" which is the absolute minimum from this IDE, set your other installation preferences and install.
与其从Eclipse Downloads 中获取现成的包,不如从同一页面中获取 Eclipse 安装程序。目前可用于 Mac、Windows 和心爱的 Linux。启动应该更新的安装程序(如果你足够幸运,或者不更新:))。从这个 IDE 中选择绝对最小的“Eclipse Platform”,设置你的其他安装首选项并安装。
After the download/installation process, I'd suggest your head to Help->Install New Software and search for the Eclipse Marketplace (Yes, even that is not included in this package) just to make your life a bit easier.
在下载/安装过程之后,我建议您前往 Help->Install New Software 并搜索 Eclipse Marketplace(是的,即使它不包含在此软件包中),只是为了让您的生活更轻松。
回答by Erik Lievaart
I feel you man, when working with Eclipse, the application is constantly trying to help. Ignoring workspace corruptions, I spend my development time fighting all the "helpful" things Eclipse does. XML is not that hard to read, but it still confuses the shit out of me when I get the XML designer. All it does for me is add an extra manual step to click on the source tab. Every time a new version of eclipse comes out they redesign the front page and the distributions. At which time a new quest starts for finding a way to debloat Eclipse again. I have the same experience with extensions to Eclipse by third parties and avoid them if at all possible. WTP has somewhat usefull stuff, but overall I prefer a basic java eclipse.
我觉得你这个人,在使用 Eclipse 时,应用程序一直在努力提供帮助。忽略工作区损坏,我把我的开发时间花在 Eclipse 所做的所有“有用”的事情上。XML 并不难读,但当我得到 XML 设计器时,它仍然让我感到困惑。它对我所做的只是添加一个额外的手动步骤来单击源选项卡。每次有新版本的 eclipse 出现时,他们都会重新设计首页和发行版。届时,一个新的任务开始了,以寻找再次对 Eclipse 进行 deblot 的方法。我对第三方对 Eclipse 的扩展也有同样的经验,并尽可能避免使用它们。WTP 有一些有用的东西,但总的来说我更喜欢基本的 java eclipse。
It is a good idea start with the Platform Runtime Binary and add JDT. Manually extracting the JDT runtime doesn't seem to work for me these days, so it it better to use the update client. You can use the marketplace client, but personally I have always found it rather annoying. An alternative is to use the director. The director can install JDT without starting the GUI.
最好从 Platform Runtime Binary 开始并添加 JDT。这些天手动提取 JDT 运行时似乎对我不起作用,因此最好使用更新客户端。您可以使用市场客户端,但我个人一直觉得它很烦人。另一种方法是使用导向器。Director 可以在不启动 GUI 的情况下安装 JDT。
Here is a script that downloads eclipse Oxygen 4.7.3a and installs JDT unnattended:
这是一个下载 eclipse Oxygen 4.7.3a 并在无人值守的情况下安装 JDT 的脚本:
#!/bin/sh
die() {
echo >&2 "$@"
exit 1
}
[ "$#" -eq 1 ] || die "exactly 1 argument required [INSTALL_DIR]"
[ -e "" ] && die "*warning* Aborting! location exists, eclipse already installed?"
INSTALL_DIR=""
TARBALL=eclipse-platform-4.7.3a-linux-gtk-x86_64.tar.gz
mkdir -p $INSTALL_DIR
if [ ! -f $TARBALL ]
then
wget http://mirror.csclub.uwaterloo.ca/eclipse/eclipse/downloads/drops4/R-4.7.3a-201803300640/$TARBALL
fi
tar -v -xf "$TARBALL" -C "$INSTALL_DIR" --strip 1
echo "\nUsing director to install java development tools, this may take a while..."
$INSTALL_DIR/eclipse -noSplash -application org.eclipse.equinox.p2.director -repository http://download.eclipse.org/eclipse/updates/4.7 -installIUs org.eclipse.jdt.feature.group
Simply call the script with one argument, the directory you want Eclipse installed. Running the script gives me an unpacked install of roughly 129MB, which is more than 100MB smaller than the default download (zipped). That is not to say you would not be able to shrink it further, but it should rid you of most of the crap. The executable will be cached for future executions of the script, but it will still be slow, since it needs to go online to download JDT. Unfortunately, I do not know of a way to cache the plugin download in a local folder. You could of course zip the created installation, but the script is easier to commit to git.
只需使用一个参数调用脚本,即您希望安装 Eclipse 的目录。运行脚本给我一个大约 129MB 的解压安装,比默认下载(压缩)小 100MB 以上。这并不是说你不能进一步缩小它,但它应该让你摆脱大部分废话。可执行文件将被缓存以备将来执行脚本,但它仍然会很慢,因为它需要在线下载 JDT。不幸的是,我不知道在本地文件夹中缓存插件下载的方法。您当然可以压缩创建的安装,但脚本更容易提交到 git。
This script will only work for new users as long as the mirror stays up and will need some updates when a new version is released. But I am sure most developers are savvy enough to update the script if need be.
该脚本仅适用于新用户,只要镜像保持正常运行,并且在新版本发布时需要一些更新。但我相信大多数开发人员都足够精明,可以在需要时更新脚本。
回答by Andrew Grothe
Visual Studio Code
视觉工作室代码
Fast forward to 2019 and we now can use Visual Studio Code with Java plugins. They provide a plugin pack to get you started with lightweight debugger and auto complete. Other plugins include maven integration, dependency viewer and more.
快进到 2019 年,我们现在可以使用带有 Java 插件的 Visual Studio Code。他们提供了一个插件包,让你开始使用轻量级调试器和自动完成。其他插件包括 maven 集成、依赖查看器等。
Visual Studio Code is a new(ish) editor/mini-ide from Microsoft which runs on Win/Max/Linux and has plugins for many languages.
Visual Studio Code 是来自 Microsoft 的一个新的(ish)编辑器/迷你 IDE,它在 Win/Max/Linux 上运行,并具有适用于多种语言的插件。
Tutorial for setup: https://blog.usejournal.com/visual-studio-code-for-java-the-ultimate-guide-2019-8de7d2b59902
设置教程:https: //blog.usejournal.com/visual-studio-code-for-java-the-ultimate-guide-2019-8de7d2b59902
Edit2019-06-21: MS now has a dedicated installer for Java integration with VS Code, including Spring Boot support as well. While the Intelisense is not 100%, it's vastly improved and now my go-to Java editor for testing and trying new things. Announcing the Visual Studio Code Installer for Java
编辑2019-06-21:MS 现在有一个专用的安装程序,用于 Java 与 VS Code 的集成,还包括 Spring Boot 支持。虽然 Intelisense 不是 100%,但它已经有了很大的改进,现在是我用来测试和尝试新事物的首选 Java 编辑器。宣布适用于 Java 的 Visual Studio Code 安装程序