[eclipse] Eclipse hangs on loading workbench

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

This question is related to eclipse macos osx-snow-leopard

The answer is


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.


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.


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&

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


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


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


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.


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

metadata\.plugins\*.snap


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


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.


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


Looks like you are possibly having this issue:

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


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.


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!


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


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


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!


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.


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


./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


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


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!


Examples related to eclipse

How do I get the command-line for an Eclipse run configuration? My eclipse won't open, i download the bundle pack it keeps saying error log strange error in my Animation Drawable How to uninstall Eclipse? How to resolve Unable to load authentication plugin 'caching_sha2_password' issue Class has been compiled by a more recent version of the Java Environment Eclipse No tests found using JUnit 5 caused by NoClassDefFoundError for LauncherFactory How to downgrade Java from 9 to 8 on a MACOS. Eclipse is not running with Java 9 "The POM for ... is missing, no dependency information available" even though it exists in Maven Repository The origin server did not find a current representation for the target resource or is not willing to disclose that one exists. on deploying to tomcat

Examples related to macos

Problems with installation of Google App Engine SDK for php in OS X dyld: Library not loaded: /usr/local/opt/openssl/lib/libssl.1.0.0.dylib dyld: Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.62.dylib error running php after installing node with brew on Mac Could not install packages due to an EnvironmentError: [Errno 13] How do I install Java on Mac OSX allowing version switching? Git is not working after macOS Update (xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools) Can't compile C program on a Mac after upgrade to Mojave You don't have write permissions for the /Library/Ruby/Gems/2.3.0 directory. (mac user) How can I install a previous version of Python 3 in macOS using homebrew? Could not install packages due to a "Environment error :[error 13]: permission denied : 'usr/local/bin/f2py'"

Examples related to osx-snow-leopard

Check mySQL version on Mac 10.8.5 PostgreSQL error 'Could not connect to server: No such file or directory' Eclipse hangs on loading workbench Running script upon login mac Authorize a non-admin developer in Xcode / Mac OS How do you uninstall MySQL from Mac OS X? can't start MySql in Mac OS 10.6 Snow Leopard Easiest way to activate PHP and MySQL on Mac OS 10.6 (Snow Leopard), 10.7 (Lion), 10.8 (Mountain Lion)?