Search code examples
eclipseinstallationworkspace

Eclipse set up for multiple languages


I have been using the Eclipse platform for Java, javaEE, c++, python and PHP - in various school projects. Now that I am a bit more comfortable with it I would like to have some more accurate instructions on how to set it up. I am on windows7 - I had dropped the eclipse itself in my Dropbox and created workspaces as needed but this ended up in a chaos of settings spread here and there and in various bugs (which showed up when I tried to update to Juno - now features like templates are broken).

So what is the recommended way of setting eclipse up for various languages ? Should I download the latest release, add the plugins I need (cdt, pdt etc) and then create different workspaces for the different languages (like eclipse_python, eclipse_java, eclipse_javaEE, etc )? How do you set Eclipse up ?


Solution

  • I've been using eclipse intensively for about 6 years now, and I'd recommend setting up a separate eclipse installation for up to 1 or 2 different programming languages. The reason is that with too many plug-ins, eclipse might consume too much memory or processor time (of course, depending on what the plug-ins do in background and so on...) which may lead to an unresponsive UI.

    I also recommend using separate workspaces for each eclipse installation so that the different configurations/installations don't interfere with each other.

    I wrote a little command line script which allows me to switch the .metadata directory in a workspace for use with a portable drive (supports two modes: home and portable) maybe someone finds that useful...

    @ECHO OFF
    
    REM This Script is used to ease using eclipse in a portable manner
    REM The script allows to easily switch between several workspace metadata
    
    REM arg1: eclipse runnable
    REM arg2: workspace dir
    REM arg3: metadata mode (portable or home)
    
    :CHECK_ARG_ONE
    IF %1 == "" GOTO :HELP
    IF /i %1 == "/h" GOTO :HELP
    IF /i %1 == "/?" GOTO :HELP
    IF /i %1 == "/help" GOTO :HELP
    IF /i %1 == "-h" GOTO :HELP
    IF /i %1 == "-?" GOTO :HELP
    IF /i %1 == "-help" GOTO :HELP
    IF /i %1 == "--h" GOTO :HELP
    IF /i %1 == "--?" GOTO :HELP
    IF /i %1 == "--help" GOTO :HELP
    
    
    :CHECK_ARG_TWO
    IF %2 == "" GOTO :ERROR_ARG_TWO
    
    
    :CHECK_ARG_THREE
    IF %3 == "" GOTO :ERROR_ARG_THREE
    
    
    :PREPARE
    SET "ECLIPSE_RUNNABLE=%1"
    SET "WORKSPACE_DIR=%2"
    ECHO Working Dir: %CD%
    ECHO Eclipse Runnable: %ECLIPSE_RUNNABLE%
    ECHO Workspace Dir: %WORKSPACE_DIR%
    SET "MD=.metadata"
    SET "MD_HOME=.metadata_home"
    SET "MD_PORTABLE=.metadata_portable"
    PUSHD %WORKSPACE_DIR%
    IF /i %3 == home GOTO :HOME
    IF /i %3 == portable GOTO :PORTABLE
    GOTO :ERROR_ARG_THREE_WRONG
    
    
    :HOME
    ECHO Starting home version
    IF EXIST %MD% (
        IF EXIST %MD_HOME% (
            IF EXIST %MD_PORTABLE% (
                GOTO :ERROR_MD_PORTABLE_EXISTS_ALREADY
            ) ELSE (
                REN %MD% %MD_PORTABLE%
                REN %MD_HOME% %MD%
            )
        )
    ) ELSE (
        IF NOT EXIST %MD_HOME% (
            GOTO :ERROR_MD_HOME_EXISTS_NOT
        ) ELSE (
            REN %MD_HOME% %MD%
        )
    )
    GOTO :RUN
    
    
    :PORTABLE
    ECHO Starting portable version
    IF EXIST "%MD%" (
        IF EXIST "%MD_PORTABLE%" (
            IF EXIST "%MD_HOME%" (
                GOTO :ERROR_MD_HOME_EXISTS_ALREADY
            ) ELSE (
                REN "%MD%" %MD_HOME%
                REN "%MD_PORTABLE%" %MD%
            )
        )
    ) ELSE (
        IF NOT EXIST "%MD_PORTABLE%" (
            GOTO :ERROR_MD_PORTABLE_EXISTS_NOT
        ) ELSE (
            REN "%MD_PORTABLE%" %MD%
        )
    )
    GOTO :RUN
    
    
    :ERROR_ARG_TWO
    ECHO No second argument supplied (workspace dir)
    GOTO :END_ERROR
    
    
    :ERROR_ARG_THREE
    ECHO No third argument supplied (metadata mode - home ^| portable)
    GOTO :END_ERROR
    
    
    :ERROR_ARG_THREE_WRONG
    ECHO Supplied third argument (metadata mode) must match (home ^| portable)
    GOTO :HELP
    
    
    :ERROR_MD_HOME_EXISTS_ALREADY
    ECHO Trying to rename "%MD%", but the metadata directory "%MD_HOME%" already exists!
    GOTO :END_ERROR
    
    
    :ERROR_MD_HOME_EXISTS_NOT
    ECHO Neither "%MD%" nor "%MD_HOME%" exist!
    GOTO :END_ERROR
    
    
    :ERROR_MD_PORTABLE_EXISTS_ALREADY
    ECHO Trying to rename "%MD%", but the metadata directory "%MD_PORTABLE%" already exists!
    GOTO :END_ERROR
    
    
    :ERROR_MD_PORTABLE_EXISTS_NOT
    ECHO Neither "%MD%" nor "%MD_PORTABLE%" exist!
    GOTO :END_ERROR
    
    
    :HELP
    ECHO.
    ECHO Eclipse starter script to switch between home and portable metadata
    ECHO ©Till Kolditz 2011 ([email protected])
    ECHO.
    ECHO This Script is used to ease using eclipse in a portable manner.
    ECHO It allows to easily switch between portable and "home" or stationary
    ECHO workspace metadata.
    ECHO.
    ECHO Usage: run.bat (eclipse_runnable) (workspace_dir) (home ^| portable)
    ECHO.
    ECHO Example1: run.bat eclipse\eclipse.exe workspace home
    ECHO Example2: run.bat "eclipse (x64)\eclipse.exe" workspace_special portable
    GOTO :END
    
    
    :RUN
    POPD
    START "Eclipse" %ECLIPSE_RUNNABLE% -data %WORKSPACE_DIR%
    GOTO :END
    
    
    :END_ERROR
    POPD
    REM PAUSE for debugging
    PAUSE
    GOTO :END
    
    
    :END
    GOTO :EOF