Getting a lightweight installation of Java Eclipse

前端 未结 9 1368
北海茫月
北海茫月 2021-01-29 22:36

Having dealt with yet another stupid eclipse problem, I want to try to get the lightest, most minimal Eclipse installation as possible.

To be clear, I use eclipse for tw

相关标签:
9条回答
  • 2021-01-29 23:19

    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.

    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.

    0 讨论(0)
  • 2021-01-29 23:22

    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.

    What I Needed

    Functionalities:

    • Java Support
    • Java + Java EE (XML) + Debug Perspectives

    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.

    Resulting Perspectives:

    • Lightweight Java
    • Lightweight Browser (fairly tweaked for code reviews and code inspection - that one was actually heavier than the others)
    • Lightweight Debug

    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 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)

    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.

    0 讨论(0)
  • 2021-01-29 23:22

    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.

    A very popular choice is VIM. Also check out this SO link for 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.

    0 讨论(0)
  • 2021-01-29 23:22

    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.

    Visual Studio Code is a new(ish) editor/mini-ide from Microsoft which runs on Win/Max/Linux and has plugins for many languages.

    Tutorial for setup: https://blog.usejournal.com/visual-studio-code-for-java-the-ultimate-guide-2019-8de7d2b59902

    Edit 2019-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

    0 讨论(0)
  • 2021-01-29 23:23

    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.

    See this comparison: http://www.eclipse.org/downloads/compare.php

    0 讨论(0)
  • 2021-01-29 23:24

    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.

    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.

    Here is a script that downloads eclipse Oxygen 4.7.3a and installs JDT unnattended:

    #!/bin/sh
    
    die() {
        echo >&2 "$@"
        exit 1
    }
    
    [ "$#" -eq 1 ] || die "exactly 1 argument required [INSTALL_DIR]"
    [ -e "$1" ] && die "*warning* Aborting! location exists, eclipse already installed?"
    
    INSTALL_DIR="$1"
    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.

    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.

    0 讨论(0)
提交回复
热议问题