PyCharm启动失败

PyCharm startup failure

我的 PyCharm 在系统更新重启后无法启动,它在显示启动画面后就消失了。

当我尝试从命令行启动它时,它显示以下错误:

C:\Program Files (x86)\JetBrains\PyCharm Community Edition 4.5.3\bin>pycharm.bat
Java HotSpot(TM) Server VM warning: ignoring option MaxPermSize=250m; support was removed in 8.0

Start Failed: Internal error. Please report to https://youtrack.jetbrains.com

java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:497)
        at com.intellij.ide.Bootstrap.main(Bootstrap.java:39)
        at com.intellij.idea.Main.main(Main.java:83)
Caused by: java.lang.ExceptionInInitializerError
        at com.intellij.util.ui.UIUtil.isUnderDarcula(UIUtil.java:1295)
        at com.intellij.ui.JBColor.<clinit>(JBColor.java:34)
        at com.intellij.util.ui.UIUtil.<clinit>(UIUtil.java:232)
        at com.intellij.ide.plugins.PluginManager.start(PluginManager.java:71)
        ... 6 more
Caused by: java.lang.IllegalArgumentException: 36 incompatible with Text-specific LCD contrast key
        at java.awt.RenderingHints.put(RenderingHints.java:1075)
        at sun.awt.windows.WDesktopProperties.getDesktopAAHints(WDesktopProperties.java:312)
        at sun.awt.windows.WToolkit.getDesktopAAHints(WToolkit.java:1035)
        at sun.awt.SunToolkit.getDesktopFontHints(SunToolkit.java:1848)
        at sun.awt.windows.WDesktopProperties.getProperties(WDesktopProperties.java:249)
        at sun.awt.windows.WToolkit.lazilyInitWProps(WToolkit.java:911)
        at sun.awt.windows.WToolkit.lazilyLoadDesktopProperty(WToolkit.java:900)
        at java.awt.Toolkit.getDesktopProperty(Toolkit.java:1803)
        at javax.swing.UIManager.<clinit>(UIManager.java:380)
        ... 10 more


Also, an UI exception occurred on attempt to show above message:
java.lang.NoClassDefFoundError: Could not initialize class javax.swing.UIManager
        at javax.swing.text.JTextComponent.updateUI(JTextComponent.java:338)
        at javax.swing.text.JTextComponent.<init>(JTextComponent.java:312)
        at javax.swing.JEditorPane.<init>(JEditorPane.java:199)
        at javax.swing.JTextPane.<init>(JTextPane.java:90)
        at com.intellij.idea.Main.showMessage(Main.java:231)
        at com.intellij.idea.Main.showMessage(Main.java:217)
        at com.intellij.idea.Main.main(Main.java:86)

注意到它说"incompatible with Text-specific LCD contrast key",我开始在我的电脑上尝试各种显示设置,最后发现如果我关闭"ClearType",它就能成功启动。

如何在不关闭 ClearType 的情况下修复它?

好的,终于找到原因了。注册表中有一项设置可能会被 PyCharm 读取,然后导致它崩溃:

HKEY_CURRENT_USER\Control Panel\Desktop\FontSmoothingGamma

前段时间我手动添加了这个键,试图改善ClearType文本显示,参考this link

删除此项后,PyCharm 可以在启用 ClearType 的情况下启动。