如何使 Eclipse 在 Windows7任务栏中表现良好?

所有其他可以固定在任务栏上的应用程序运行良好。 但是当我右键单击 Eclipse 时,它不会显示最近打开的项目。 它也不允许在其中固定一些项目。 注意,我有 Eclipse Helios 的 JS 版本,它在加载后会生成一个新的和不同的任务栏图标。

27141 次浏览

Specify the latest available Java VM in your eclipse.ini. I.e.:

-vm
jdk1.6.0_10\jre\bin\client\jvm.dll
  1. Make sure they are on separate lines
  2. Anything after the "vmargs" is taken to be vm arguments

(More info)

Or alternatively add the java bin folder to your Windows PATH before the "windows32" folder, because otherwise eclipse uses "javaw.exe" in the win32 folder instead of the JDK one.

setting eclipse.exe to compatibility mode works

Riccardo's solution from the Eclipse bug report worked for me, but I don't get recently opened projects, etc. from the task bar. Is anyone experiencing that these workarounds restore that behavior?

I have the same problem on Windows 7 x64 with Helios x64, but for me the following workaround works with the option "Always combine, hide labels" for taskbar buttons.

  • Check your "eclipse.ini" for the specified VM and make sure the path points to the bin directory of your JDK or JRE (and not to javaw.exe). For me the argument is "D:/Development/Languages/Java/Development Kit/bin/" without quotes.
  • Unpin Eclipse from the taskbar or delete the shortcut
  • Run "eclipse.exe" from the explorer and choose your workspace
  • Pin Eclipse to the taskbar after the splash screen was loaded and when the main window is shown

I think it's important to mention that at least for me it was important to add the path to the vm in the eclipse.ini with forward slashes, even though I'm working with Windows (7, that is). Eclipse didn't start when I used backslashes.

Recently Timo Kinnunen has pinpointed the problem

Edit eclipse.ini find the line:

--launcher.appendVmargs:

and change it to

--launcher.appendVmargs:-vm <PATH_TO_JAVA>/jdk1.8.0/jre/bin/server/jvm.dll

This causes the JVM to be launched in the same process as eclipse.exe rather than as a child process and avoids the intricacies of Host Processes with AppUserModelIDs.

And it works !!!

I just want to add this for the Win10 users.

Edit eclipse.ini to add these lines at the end before the line --launcher.appendVmargs:

C:/Program Files/Java/jdk1.8.0/jre/bin/server/jvm.dll

You need set the compatibility to Windows Vista as well in order for it to work.

The solutions offered here on StackOverflow so far, don't have an easy fix for running multiple Eclipses while each having their own Application ID, and making grouping of icons work as expected. The answer here does provide a reference to the underlying System.AppUserModel.ID property.

Here's a quick HOWTO:

  1. Do the -vm setting as plenty of people here have mentioned
  2. Run the eclipse app
  3. Right click on the running taskbar icon, Pin this program to taskbar
  4. Navigate to %AppData%\Microsoft\Internet Explorer\Quick Launch\User Pinned\Taskbar
  5. Copy the newly created shortcut to another location. It will be named eclipse, eclipse (2), or eclipse (3) and so on
  6. Right click on the running taskbar icon, Unpin this program from taskbar
  7. Use the Shortcut Properties dialog to copy all individual fields (target + parameters, workdir, icon, anything else) to the new shortcut
  8. Rename the new shortcut
  9. Drag the new shortcut to the Windows Taskbar
  10. Done

Here's an extended HOWTO, helpful if you want icon grouping separated per individual Eclipse instance (if you have multiple instances running):

  1. Find out what your startup plugin is, for example org.eclipse.epp.package.java_2.0.1.20130919-0803. Open the plugin.xml file of that folder.
  2. Edit the following XML location in that file: /plugin/extension/product/property[@name="appName"], set attribute value to something else. Don't use spaces, keep length below (up until) 40.
  3. Optionally also set the window title: /plugin/extension/product/property[@name], set attribute name to something else.
  4. In your existing Eclipse shortcut, append -clean and run it once. You will notice the //product/property[@name] attribute being used in the Eclipse window title. Afterwards, you can remove -clean again.
  5. Follow the quick HOWTO above

A quick explanation on What's going on here:

  1. Inside the .lnk file, an attribute is stored, which can't be entered by using the windows Shortcut Property dialog. If you copy a .lnk file, the attribute will copy with it.
  2. Windows groups by identical System.AppUserModel.ID property, AppID for short
  3. Eclipse does not have an AppID at startup. First the JVM is started, then the eclipse core/platform is started, and then the startup plugin is loaded. In this last stage, an API call is done to set the AppID to the value inside a plugin.xml file. See above: extended HOWTO item 2
  4. When you drag a manually created shortcut .lnk file to the taskbar, it makes sense that windows can't put this AppID into the new 'pinned' version of the .lnk file. It can only be detected at runtime.
  5. When you start an Eclipse application, right click on the running taskbar icon, Pin this program to taskbar -> then Windows will detect the AppID and store it in the 'pinned' .lnk. But, partly because of the JVM process redirection, Windows does not detect the command-line parameters, environment, working folder (at startup at least), and the icon path + icon index. So you have to:
    1. Do a file copy of the .lnk file and fill in the missing gaps yourself
    2. Or, use a shortcut creation tool that understands System.AppUserModel.ID properties (there are plenty)
    3. Or, use the Windows API directly

Sincerely hope this will reduce the amount of haywire Eclipse taskbars icons on the workstations around me,

Cheers, TW