how to run Eclipse -clean on a Mac?

前端 未结 5 378
温柔的废话
温柔的废话 2021-01-30 10:35

I can run eclipse -clean on my PC, but on my Mac, the executable is Eclipse.app -- how do you run that with arguments on the command-line?

5条回答
  •  闹比i
    闹比i (楼主)
    2021-01-30 11:00

    Here is a script using macports to automate the restart. You can put this script e.g. on your desktop to be able to double click it.

    #!/bin/bash
    # WF 2014-03-14
    # start Eclipse cleanly
    pgrep -fl Eclipse.app
    if [ $? -eq 0 ]
    then
      echo "Eclipse is running - shall i kill and restart it with -clean? y/n?"
      read answer
      case $answer in
        y|Y) ;;
        *) echo "ok - I'm aborting this ..."
        exit 1;
        ;;
      esac
      echo "killing current eclipse"
      pkill -f Eclipse.app
    fi
    echo "starting eclipse cleanly ..."
    /Applications/eclipse/Eclipse.app/Contents/MacOS/eclipse -clean -clearPersistedState&
    

提交回复
热议问题