96

My eclipse stops loading workbench. I tried already starting with ./eclipse --clean

When starting from console it throws following exception:

java.lang.NullPointerException
    at org.eclipse.core.internal.runtime.Log.isLoggable(Log.java:101)
    at org.eclipse.equinox.log.internal.ExtendedLogReaderServiceFactory.safeIsLoggable(ExtendedLogReaderServiceFactory.java:57)
    at org.eclipse.equinox.log.internal.ExtendedLogReaderServiceFactory.logPrivileged(ExtendedLogReaderServiceFactory.java:158)
    at org.eclipse.equinox.log.internal.ExtendedLogReaderServiceFactory.log(ExtendedLogReaderServiceFactory.java:146)
    at org.eclipse.equinox.log.internal.ExtendedLogServiceFactory.log(ExtendedLogServiceFactory.java:65)
    at org.eclipse.equinox.log.internal.ExtendedLogServiceImpl.log(ExtendedLogServiceImpl.java:87)
    at org.eclipse.equinox.log.internal.LoggerImpl.log(LoggerImpl.java:54)
    at org.eclipse.core.internal.runtime.Log.log(Log.java:60)
    at org.tigris.subversion.clientadapter.javahl.Activator.isAvailable(Activator.java:92)
    at org.tigris.subversion.clientadapter.Activator.getAnyClientAdapter(Activator.java:81)
    at org.tigris.subversion.subclipse.core.SVNClientManager.getAdapter(SVNClientManager.java:145)
    at org.tigris.subversion.subclipse.core.SVNClientManager.getSVNClient(SVNClientManager.java:92)
    at org.tigris.subversion.subclipse.core.SVNProviderPlugin.getSVNClient(SVNProviderPlugin.java:425)
    at org.tigris.subversion.subclipse.core.status.NonRecursiveStatusUpdateStrategy.statusesToUpdate(NonRecursiveStatusUpdateStrategy.java:53)
    at org.tigris.subversion.subclipse.core.status.StatusCacheManager.refreshStatus(StatusCacheManager.java:273)
    at org.tigris.subversion.subclipse.core.resourcesListeners.FileModificationManager.refreshStatus(FileModificationManager.java:179)
    at org.tigris.subversion.subclipse.core.resourcesListeners.FileModificationManager.resourceChanged(FileModificationManager.java:128)
    at org.eclipse.core.internal.events.NotificationManager$1.run(NotificationManager.java:291)
    at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
    at org.eclipse.core.internal.events.NotificationManager.notify(NotificationManager.java:285)
    at org.eclipse.core.internal.events.NotificationManager.broadcastChanges(NotificationManager.java:149)
    at org.eclipse.core.internal.resources.Workspace.broadcastPostChange(Workspace.java:395)
    at org.eclipse.core.internal.resources.Workspace.endOperation(Workspace.java:1530)
    at org.eclipse.core.internal.resources.InternalWorkspaceJob.run(InternalWorkspaceJob.java:45)
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)

It stops when loading com.android.ide.eclipse.adt

Whats wrong with my workbench?

Eclipse startup screen

Community
  • 1
  • 1
endian
  • 4,605
  • 7
  • 30
  • 54

22 Answers22

146

DISCLAIMER: THIS WILL DELETE ALL OF YOUR ECLIPSE WORKSPACE SETTINGS AND YOU WILL HAVE TO RE-IMPORT ALL YOUR PROJECTS, THERE ARE LESS DESTRUCTIVE ANSWERS HERE

Try the following:

  1. Delete the .metadata folder in your local workspace (this is what worked for me). It seems that it contains a .LOCK file that if not properly closed, prevents eclipse from starting properly. On Unix based systems you can type following on command line;

    rm -r workspace/.metadata
    
  2. Delete your .eclipse directory in your home directory. Launch eclipse. If that doesn't work,

  3. Open eclipse under another user account. If it loads, you know the problem is with your account, not your eclipse installation.

CQM
  • 36,672
  • 69
  • 214
  • 357
george
  • 1,528
  • 1
  • 10
  • 6
  • it happened to me after i clicked File->restart by mistake. – nurnachman Nov 12 '12 at 14:53
  • 68
    In most cases, `rm workspace/.metadata/.lock` works for me. Make sure to start eclipse using `./eclipse -clean -refresh` whatever you try. Thanks for teaching us `mv .eclipse .eclipse.old`, which did not help today. Today it helped to delete `workspace/.metadata/.plugins/`. All Plugins actually did work after that. Some settings gone. You can then use `Import...` to import all your existing projects at once. Deleting `workspace/.metadata` is the last choice, but works. You can keep `workspace/.metadata/.mylyn` if you don't want to loose your tasks. – sulai Dec 20 '12 at 12:46
  • Many Thanks for this! Saved me a lot of effort when Eclipse stopped responding abruptly..Stackoverflow rocks and so does the community ! – HungryForKnowledge Feb 09 '13 at 16:25
  • As @sulai commenteted: "Deleting workspace/.metadata is the last choice, but works". You have to import all projects again if you delete .metadata. I did it the hard way ;-) – jannej Feb 19 '13 at 13:58
  • First two steps did the job for me. Thanks! – Dragan Marjanović Feb 26 '13 at 10:08
  • move .metadata, start and close eclipse, then move original .metadata back again. Worked once for me; worth a try. – cdhabecker Oct 11 '13 at 21:29
  • 3
    Just delete the .lock file - no need to loose all of your settings! – slott Dec 12 '13 at 07:51
  • Just removed the .metadata directory and it still got stuck on "loading workbench". Only after running ./eclipse -clean -refresh did it start - with all my settings down the drain ;( – slott Dec 12 '13 at 21:47
  • Agreed with Gere as the command works just fine, no manual action for deleting at all: `$./eclipse -clean -refresh` – Ken Pega Sep 18 '14 at 01:52
  • 7
    deleting .lock did not help me but deleting `.metadata/.plugins/org.eclipse.core.resources/.snap` did – serge Oct 07 '14 at 16:36
  • this worked for me when my Xilinx SDK also hanged on "loading workbench". thanks a bunch. – hansioux Nov 09 '14 at 13:11
  • `rm -rf .lock` in the .`metadata` works for me very well. – michael-mammut May 22 '17 at 09:26
  • Deleting .metadata folder works for me,Thank you for your great answer – Rajesh Om Sep 17 '18 at 13:06
92

The procedure shown at http://off-topic.biz/en/eclipse-hangs-at-startup-showing-only-the-splash-screen/ worked for me:

  1. cd .metadata/.plugins
  2. mv org.eclipse.core.resources org.eclipse.core.resources.bak
  3. Start eclipse. (It should show an error message or an empty workspace because no project is found.)
  4. Close all open editors tabs.
  5. Exit eclipse.
  6. rm -rf org.eclipse.core.resources (Delete the newly created directory.)
  7. mv org.eclipse.core.resources.bak/ org.eclipse.core.resources (Restore the original directory.)
  8. Start eclipse and start working. :-)

In other answers:

eclipse -clean -clearPersistedState

is mentioned - which seems to have the same or even better effect.

Here is a script for MacOS (using Macports) and Linux (tested on Ubuntu with Eclipse Equinox) to do the start with an an optional kill of the running eclipse. You might want to adapt the script to your needs. If you add new platforms please edit the script right in this answer.

#!/bin/bash
# WF 2014-03-14
#
# ceclipse:
#   start Eclipse cleanly
#
#   this script calls eclipse with -clean and -clearPersistedState
#   if an instance of eclipse is already running the user is asked
#   if it should be killed first and if answered yes the process will be killed
#
# usage: ceclipse
#

#
# error
#
#   show an error message and exit
#
#   params:
#     1: l_msg - the message to display
error() {
  local l_msg="$1"
  echo "error: $l_msg" 1>&2
  exit 1 
}

#
# autoinstall
#
#  check that l_prog is available by calling which
#  if not available install from given package depending on Operating system
#
#  params: 
#    1: l_prog: The program that shall be checked
#    2: l_linuxpackage: The apt-package to install from
#    3: l_macospackage: The MacPorts package to install from
#
autoinstall() {
  local l_prog=$1
  local l_linuxpackage=$2
  local l_macospackage=$3
  echo "checking that $l_prog  is installed on os $os ..."
  which $l_prog 
  if [ $? -eq 1 ]
  then
    case $os in 
      # Mac OS
      Darwin) 
        echo "installing $l_prog from MacPorts package $l_macospackage"        
        sudo port install $l_macospackage
      ;;
      # e.g. Ubuntu/Fedora/Debian/Suse
      Linux)
        echo "installing $l_prog from apt-package $l_linuxpackage"        
        sudo apt-get install $l_linuxpackage
      ;;
      # git bash (Windows)
      MINGW32_NT-6.1)
        error "$l_prog ist not installed"
      ;;
      *)
        error "unknown operating system $os" 
    esac
  fi
}

# global operating system variable
os=`uname`

# first set 
#  eclipse_proc - the name of the eclipse process to look for
#  eclipse_app - the name of the eclipse application to start
case $os in 
    # Mac OS
    Darwin) 
      eclipse_proc="Eclipse.app" 
      eclipse_app="/Applications/eclipse/Eclipse.app/Contents/MacOS/eclipse"
      ;;
    # e.g. Ubuntu/Fedora/Debian/Suse
    Linux)
      eclipse_proc="/usr/lib/eclipse//plugins/org.eclipse.equinox.launcher_1.2.0.dist.jar"
      eclipse_app=`which eclipse`
      ;;
    # git bash (Windows)
    MINGW32_NT-6.1)
      eclipse_app=`which eclipse`
      error "$os not implemented yet"
      ;;
    *)
      error "unknown operating system $os" 
esac

# check that pgrep is installed or install it
autoinstall pgrep procps

# check whether eclipse process is running
# first check that we only find one process
echo "looking for $eclipse_proc process"
pgrep -fl "$eclipse_proc"
# can't use -c option on MacOS - use platform independent approach 
#eclipse_count=`pgrep -cfl "$eclipse_proc"`
eclipse_count=`pgrep -fl "$eclipse_proc" | wc -l | tr -d ' '`

# check how many processes matched
case $eclipse_count in
  # no eclipse - do nothing
  0) ;;
  # exactly one - offer to kill it
  1) 
     echo "Eclipse is running - shall i kill and restart it with -clean? y/n?"
       read answer
       case $answer in
         y|Y) ;;
           *) error "aborted ..." ;;
       esac
     echo "killing current $eclipse_proc"
     pkill -f "$eclipse_proc"
     ;;
  # multiple - this is bogus
  *) error "$eclipse_count processes matching $eclipse_proc found - please adapt $0";;
esac

tmp=/tmp/eclipse$$
echo "starting eclipse cleanly ... using $tmp for nohup.out"
mkdir -p $tmp
cd $tmp

# start eclipse with clean options
nohup $eclipse_app -clean -clearPersistedState&
Wolfgang Fahl
  • 12,097
  • 9
  • 75
  • 150
  • 1
    thanks! this is a better approach then just deleting the entire .metadata folder. it worked perfectly – Jakob Dec 04 '13 at 12:12
  • 1
    Much better. Helped on Kepler on Mac OS X Mavericks – Robert Sösemann Jan 16 '14 at 14:52
  • Fixed my issue on Windows7, eclipse version Kepler – Cam Feb 11 '14 at 19:29
  • Thank you, this helped me! – thSoft Feb 24 '14 at 15:53
  • Worked for me on linux mint! Great! – remi Mar 03 '14 at 09:59
  • 5
    This "eclipse -clean -clearPersistedState" helped me, thank you! – Michal Apr 09 '14 at 20:31
  • ./eclipse -clean -clearPersistedState worked for me, combined with the 8 step process (I renamed org.eclipse.core.resources to org.eclipse.core.resources.bak, ran eclipse -clean -clearPersistedState, closed Eclipse, renamed org.eclipse.core.resources.bak back to org.eclipse.core.resources, then restarted Eclipse). The 8-step process as listed had worked in the past, but this time when I started Eclipsed after the rename of the directory, Eclipse hung in the editor, saying, "file does not exist". – hBrent Jun 13 '14 at 21:14
  • Thanks Wolfgang Fahl,"eclipse -clean -clearPersistedState" worked for me like a charm – Ritesh Gune Sep 12 '14 at 13:55
  • 2
    -clean -clearPersistedState worked for me in Aptana Studio 3 on win 7 – Lorenz Haase Oct 27 '14 at 10:28
  • 2
    eclipse -clean -clearPersistedState Worked in Kepler Win 7 – Yitzchak Jan 11 '15 at 13:28
  • Thank you so much! You saved me from chucking my MBP at a wall, figuratively .. maybe. – CaffiendFrog Mar 03 '15 at 23:18
  • This worked for me on a mac! I ran this on Terminal: Eclipse.app/Contents/MacOS/eclipse -clean -clearPersistedState – Josh Sep 10 '15 at 16:08
  • "-clean -clearPersistedState -refresh" Worked for me on STS was hanging on org.eclipse.debug.ui. I believe "clearPersistedState" was the key. Had to use this after STS hung on "Saving Workspace..." after attempting a restart within STS. – GameSalutes Oct 09 '15 at 18:38
  • `eclipse -clean -clearPersistedState` works only like this, running it again without the options results in the original problem. Opening eclipse without the ressources and closing tab works, but whenever I later close eclipse with any tabs open it results in the original problem too. – 816-8055 Feb 10 '17 at 07:22
  • I did this and lost all my projects – Huangism Jan 17 '18 at 16:37
  • What exactly did you do? What do you mean with "this". This procedure is not meant to destroy anything valuable. That is what makes it different from other answers. – Wolfgang Fahl Jan 17 '18 at 16:53
  • Most answers here are old, but this still worked in Oct 2018 after I tried almost everything else in this thread. Mine was stuck loading the org.eclipse.ltk.ui.refactoring plugin on Oxygen.3a version. – SilverSideDown Oct 17 '18 at 12:33
37
./eclipse -clean -refresh

as mentioned in comment by sulai Dec 20 '12 at 12:46, that worked for me.

However, on the Mac OS X, I had to figure out how to get to ./eclipse

Here's the solution:

cd Eclipse.app/Contents/MacOS/

Thank you Andrew's comment for this post: https://stackoverflow.com/a/1783448/2162226

Community
  • 1
  • 1
Gene Bo
  • 8,869
  • 6
  • 70
  • 118
  • 2
    I had to open a new workspace first (I named it test) using -clean -refresh. And when Eclipse (in my case it was GGTS) opened, I chose File > Switch Workspace and went back to the workspace which originally caused the freezing problem. – pm_labs Apr 01 '14 at 09:17
  • On Eclipse Luna the application is actually just the file, no need to cd into the folder. Just running `./eclipse -clean -refresh` fixed it for me – Allison Feb 06 '15 at 13:57
20

The best solution I found is to delete this file: workspace/.metadata/.plugins/org.eclipse.e4.workbench/workbench

user1252459
  • 533
  • 7
  • 7
13

no need to delete the entire metadata. just try deleting the .snap file under org.eclipse.core.resources in your workspace folder ex.

workspaceFolder.metadata.plugins\org.eclipse.core.resources

user742102
  • 1,205
  • 7
  • 29
  • 48
11

I solved deleting *.snap from the workspace dir (and all subdirectories):

metadata\.plugins\*.snap

lujop
  • 12,544
  • 9
  • 55
  • 90
10

Pretty old question but the most simple answer isn't yet posted.
Here it is :
1) In [workspace]\.metadata\.plugins\org.eclipse.e4.workbench delete workbench.xmi file.
In most cases it's enough - try to load Eclipse.
Still you have to re-configure your specific perspective settings (if any)

2) Now getting problems with building projects that worked perfectly? As of my experience following steps help:
- uncheck Projects->Build automatically
- switch to Java perspective (if not yet): Window -> Open perspective -> Java
- locate Problems view or open it: Window -> Show view -> Problems
- right-click on problem groups and select Delete. Be sure to delete Lint errors
- clean the workspace: Project -> Clean... with option Clean all projects
- check Projects->Build automatically
- if problems persist for some projects: right-click project, select Properties -> Android and make sure appropriate Project Build Target is chosen

3) It was always sufficient for me. But if you still get problems - try @george post recommendations

sberezin
  • 3,065
  • 20
  • 24
6

Following procedure worked on my MacOS (Mavericks) and Eclipse Luna 4.4.1:

Delete .snap file under the path "workspaceFolder".metadata.plugins\org.eclipse.core.resources\

If you don't know how to navigate to this folder on Mac, press Cmd + Shift + G (Go to the folder) and type the full address you want to navigate for.

user3087315
  • 61
  • 1
  • 2
3

deleting workspace/.metadata/.lock and starting eclipse with -clean -refresh worked for me.

3

Looks like you are possibly having this issue:

https://bugs.eclipse.org/bugs/show_bug.cgi?id=357199

katsharp
  • 2,541
  • 22
  • 27
2

You have to delete org.eclipse.e4.workbench folder inside metadata.plugins\ which you can find in your workspace folder. Deleting this folder solved the problem for me, hope it helps someone else!

Guillermo Zooby
  • 546
  • 2
  • 12
  • 30
1

I had this problem in Windows 7, this is what fixed it for me.

http://letsgetdugg.com/2009/04/19/recovering-a-corrupt-eclipse-workspace/

cd ~/Documents/workspace/.metalog/.plugins

rm -rf org.eclipse.core.resources

Alok Omkar
  • 583
  • 5
  • 18
0

There are many possible reasons for this sort of behaviour. In addition to running from a shell prompt as you have, it's worth looking for clues in your workspace log file, which is the file .metadata/.log under your workspace directory—the NPE that's coming up for you looks like it could have to do with the logging code itself, but the log may still help determine what was going on before the error.

Web searches for messages you find often yield suggestions for deleting various directories or files and starting again. I've sometimes been able to just remove parts of .metadata/.plugins/org.eclipse.ui.workbench/workbench.xml, though, for less destructive solutions.

Michael Scheper
  • 5,371
  • 7
  • 45
  • 71
0

The trouble with deleting files in .metadata directory is that you would have to start your workbench from scratch. So, it might take awhile to restore all your projects, especially if you have a number of them. Restoring .metadata from a backup just by replacing the existing files with the old backed up ones worked for me.

lulan
  • 1
0

It might also help to try to load and save the workspace with a newer eclipse version:

I am using eclipse 3.8. When starting up the splash screen would hang. There were no error messages in the log. What helped was to open the workspace with eclipse 4.2.2. After opening and closing the workspace I was able to load it again with 3.8.

e1i45
  • 1,339
  • 1
  • 13
  • 19
0

After some investigation about file dates I solved the same issue (which is a randomly recurrent trouble on my Kepler) by simply deleting the following file in my local workspace: .metadata.plugins\org.eclipse.jdt.core\variablesAndContainers.dat

with negligible impact on the workspace restoring.

I hope it can help someone else...

rpaulin56
  • 406
  • 7
  • 11
0

In your workspace you will find hidden folder name .metadata in which you will find another hidden folder ".mylyn" delete it and empty your trash go to task manager stop the process of Eclipse and start again Eclipse this time it will work.

Enjoy!

Faakhir
  • 3,170
  • 34
  • 32
0

Here's a less destructive method that worked for me:

I'm on Windows machine with a copy of Spring Tool Suite (an extension of Eclipse) which I'm running from a random directory. In my command line prompt, I had to navigate to the directory which contained my STS.exe and run: STS.exe -refresh.

After that, I could open my Eclipse the normal way (which was through a pinned taskbar icon).

Xchai
  • 963
  • 7
  • 10
0

Get a backup copy of the .metadata/.plugin/org.eclipse.core.resources folder, then delete that folder and launch eclipse. That should launch the workspace, but all projects will be gone as org.eclipse.core.resources keeps a list of all projects.

Next, close eclipse properly and copy back org.eclipse.core.resources from back up to .metadata/.plugins/ folder overriding the existing one.

Open eclipse and things should work fine with all your projects back to normal.

Rasoul
  • 167
  • 2
  • 9
0

Eclipse freezing at startup - before loading workspace very good answer on this post. repeating the answer that worked for me

In your workspace directory perform the following steps:

cd .metadata/.plugins

mv org.eclipse.core.resources org.eclipse.core.resources.bak

Start eclipse. (It should show an error message or an empty workspace because no project is found.)

Close all open editors tabs.

Exit eclipse.

rm -rf org.eclipse.core.resources (Delete the newly created directory.)

mv org.eclipse.core.resources.bak/ org.eclipse.core.resources (Restore the original directory.)

Start eclipse and start working. :-)

Answer by CharlesB

Aparna
  • 743
  • 6
  • 10
-1

None of the solution helped me for my case.

I found the working solution though. I read that this happens when ADT plugin is not updated properly in Eclipse.

Solution
From Eclipse. . .
1. Go to Help Tap
2. Click Check for Updates

Update everything and whoa! No longer freezing at starting Eclipse!

coolcool1994
  • 3,085
  • 3
  • 32
  • 38
-1

I didn't try all these. I restarted by laptop/machine . And everything was back to normal after that.

Puneet
  • 655
  • 3
  • 8
  • 21