【问题标题】:Open Eclipse (STS) via AppleScript通过 AppleScript 打开 Eclipse (STS)
【发布时间】:2019-03-29 02:46:25
【问题描述】:

我可以在 Mac 上通过命令行打开 STS 实例:

open -a /Applications/STS.app --args -data ~/abc/spring-security/ -clean -showlocation  -vmargs -Xmx1024m -XX:MaxPermSize=256m

但是,一旦我尝试将其包装为 AppleScript,它就会停止工作:

do shell script "open -a /Applications/STS.app --args -data ~/abc/spring-security/ -clean -showlocation  -vmargs -Xmx1024m -XX:MaxPermSize=256m"

以下内容:

!SESSION 2018-10-24 10:27:37.172 -----------------------------------------------
eclipse.buildId=3.9.3.201803200915-RELEASE-e47
java.version=1.8.0_161
java.vendor=Oracle Corporation
BootLoader constants: OS=macosx, ARCH=x86_64, WS=cocoa, NL=en_US
Framework arguments:  -product org.springsource.sts.ide -showlocation
Command-line arguments:  -os macosx -ws cocoa -arch x86_64 -product org.springsource.sts.ide -data /Users/simeonleyzerzon/abc/spring-security/ -clean -showlocation

!ENTRY org.eclipse.ui 2 0 2018-10-24 10:27:49.063
!MESSAGE Warnings while parsing the images from the 'org.eclipse.ui.commandImages' extension point.
!SUBENTRY 1 org.eclipse.ui 2 0 2018-10-24 10:27:49.063
!MESSAGE Cannot bind to an undefined command: plug-in='org.eclipse.lsp4e', id='org.eclipse.lsp4e.togglehighlight'

!ENTRY org.eclipse.core.net 1 0 2018-10-24 10:27:49.243
!MESSAGE System property http.nonProxyHosts has been set to local|*.local|169.254/16|*.169.254/16 by an external source. This value will be overwritten using the values from the preferences

!ENTRY org.eclipse.jface 2 0 2018-10-24 10:27:54.986
!MESSAGE Keybinding conflicts occurred.  They may interfere with normal accelerator operation.
!SUBENTRY 1 org.eclipse.jface 2 0 2018-10-24 10:27:54.986
!MESSAGE A conflict occurred for ALT+COMMAND+R:
Binding(ALT+COMMAND+R,
    ParameterizedCommand(Command(org.python.pydev.debug.setnext,Set Next Statement,
        ,
        Category(org.python.pydev.ui.category.run,PyDev - Run,Python run category,true),
        org.eclipse.ui.internal.WorkbenchHandlerServiceHandler@6b84508a,
        ,,true),null),
    org.eclipse.ui.defaultAcceleratorConfiguration,
    org.eclipse.ui.contexts.window,,,system)
Binding(ALT+COMMAND+R,


ParameterizedCommand(Command(org.eclipse.jdt.ui.edit.text.java.rename.element,Rename - Refactoring ,
            Rename the selected element,
            Category(org.eclipse.jdt.ui.category.refactoring,Refactor - Java,Java Refactoring Actions,true),
            org.eclipse.ui.internal.WorkbenchHandlerServiceHandler@3c48334b,
            ,,true),null),
        org.eclipse.ui.defaultAcceleratorConfiguration,
        org.eclipse.ui.contexts.window,,cocoa,system)
    !SUBENTRY 1 org.eclipse.jface 2 0 2018-10-24 10:27:54.986
    !MESSAGE A conflict occurred for COMMAND+SHIFT+T:
    Binding(COMMAND+SHIFT+T,
        ParameterizedCommand(Command(org.eclipse.jdt.ui.navigate.open.type,Open Type,
            Open a type in a Java editor,
            Category(org.eclipse.ui.category.navigate,Navigate,null,true),
            org.eclipse.ui.internal.WorkbenchHandlerServiceHandler@16923216,
            ,,true),null),
        org.eclipse.ui.defaultAcceleratorConfiguration,
        org.eclipse.ui.contexts.window,,,system)
    Binding(COMMAND+SHIFT+T,
        ParameterizedCommand(Command(org.eclipse.lsp4e.symbolinworkspace,Go to Symbol in Workspace,
            ,
            Category(org.eclipse.lsp4e.category,Language Servers,null,true),
            org.eclipse.ui.internal.WorkbenchHandlerServiceHandler@85a94c8,
            ,,true),null),
        org.eclipse.ui.defaultAcceleratorConfiguration,
        org.eclipse.ui.contexts.window,,,system)

    !ENTRY org.eclipse.ui 2 2 2018-10-24 10:27:56.170
    !MESSAGE org.eclipse.jdt.junit.ResultView: Deprecated relationship "fast" should be converted to "stack".

    !ENTRY org.eclipse.ui 2 2 2018-10-24 10:27:56.171
    !MESSAGE org.springframework.ide.eclipse.aop.ui.navigator.aopReferenceModelNavigator: Deprecated relationship "fast" should be converted to "stack".

    !ENTRY org.eclipse.ui 2 2 2018-10-24 10:27:56.171
    !MESSAGE org.eclipse.contribution.xref.ui.views.XReferenceView: Deprecated relationship "fast" should be converted to "stack".

    !ENTRY org.eclipse.jface.text 2 0 2018-10-24 10:27:57.578
    !MESSAGE Duplicate template id: 'org.eclipse.wst.xslt.templates.xpath.number'

    !ENTRY org.eclipse.jface.text 2 0 2018-10-24 10:27:57.579
    !MESSAGE Duplicate template id: 'org.eclipse.wst.xslt.templates.xpath.round'

    !ENTRY org.jkiss.dbeaver.model 2 0 2018-10-24 10:28:00.355
    !MESSAGE Project 'RemoteSystemsTempFiles' not found in registry
    !SESSION 2018-10-24 10:37:18.756 -----------------------------------------------
    eclipse.buildId=3.9.3.201803200915-RELEASE-e47
    java.version=10
    java.vendor=Oracle Corporation
    BootLoader constants: OS=macosx, ARCH=x86_64, WS=cocoa, NL=en_US
    Framework arguments:  -product org.springsource.sts.ide -showlocation
    Command-line arguments:  -os macosx -ws cocoa -arch x86_64 -product org.springsource.sts.ide -data /Users/simeonleyzerzon/abc/spring-security/ -clean -showlocation

    !ENTRY org.eclipse.osgi 4 0 2018-10-24 10:37:31.529
    !MESSAGE Application error
    !STACK 1
    org.eclipse.e4.core.di.InjectionException: java.lang.NoClassDefFoundError: javax/annotation/PostConstruct
        at org.eclipse.e4.core.internal.di.InjectorImpl.internalMake(InjectorImpl.java:410)
        at org.eclipse.e4.core.internal.di.InjectorImpl.make(InjectorImpl.java:318)
        at org.eclipse.e4.core.contexts.ContextInjectionFactory.make(ContextInjectionFactory.java:162)
        at org.eclipse.e4.ui.internal.workbench.swt.E4Application.createDefaultHeadlessContext(E4Application.java:491)
        at org.eclipse.e4.ui.internal.workbench.swt.E4Application.createDefaultContext(E4Application.java:505)
        at org.eclipse.e4.ui.internal.workbench.swt.E4Application.createE4Workbench(E4Application.java:204)
        at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:614)
        at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336)
        at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:594)
        at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:148)
        at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:151)
        at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
        at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
        at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
        at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:388)
        at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:243)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:564)
        at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:653)
        at org.eclipse.equinox.launcher.Main.basicRun(Main.java:590)
        at org.eclipse.equinox.launcher.Main.run(Main.java:1499)
    Caused by: java.lang.NoClassDefFoundError: javax/annotation/PostConstruct
        at org.eclipse.e4.core.internal.di.InjectorImpl.inject(InjectorImpl.java:124)
        at org.eclipse.e4.core.internal.di.InjectorImpl.internalMake(InjectorImpl.java:399)
        ... 22 more
    Caused by: java.lang.ClassNotFoundException: javax.annotation.PostConstruct cannot be found by org.eclipse.e4.core.di_1.6.100.v20170421-1418
        at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:433)
        at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:395)
        at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:387)
        at org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(ModuleClassLoader.java:150)
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:499)
        ... 24 more

    !ENTRY org.eclipse.e4.ui.workbench 4 0 2018-10-24 10:37:31.537
    !MESSAGE FrameworkEvent ERROR
    !STACK 0
    java.lang.NoClassDefFoundError: javax/annotation/PreDestroy
        at org.eclipse.e4.core.internal.di.InjectorImpl.disposed(InjectorImpl.java:450)
        at org.eclipse.e4.core.internal.di.Requestor.disposed(Requestor.java:156)
        at org.eclipse.e4.core.internal.contexts.ContextObjectSupplier$ContextInjectionListener.update(ContextObjectSupplier.java:78)
        at org.eclipse.e4.core.internal.contexts.TrackableComputationExt.update(TrackableComputationExt.java:111)
        at org.eclipse.e4.core.internal.contexts.TrackableComputationExt.handleInvalid(TrackableComputationExt.java:74)
        at org.eclipse.e4.core.internal.contexts.EclipseContext.dispose(EclipseContext.java:178)
        at org.eclipse.e4.core.internal.contexts.osgi.EclipseContextOSGi.dispose(EclipseContextOSGi.java:99)
        at org.eclipse.e4.core.internal.contexts.osgi.EclipseContextOSGi.bundleChanged(EclipseContextOSGi.java:141)
        at org.eclipse.osgi.internal.framework.BundleContextImpl.dispatchEvent(BundleContextImpl.java:908)
        at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
        at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:148)
        at org.eclipse.osgi.internal.framework.EquinoxEventPublisher.publishBundleEventPrivileged(EquinoxEventPublisher.java:213)
        at org.eclipse.osgi.internal.framework.EquinoxEventPublisher.publishBundleEvent(EquinoxEventPublisher.java:120)
        at org.eclipse.osgi.internal.framework.EquinoxEventPublisher.publishBundleEvent(EquinoxEventPublisher.java:112)
        at org.eclipse.osgi.internal.framework.EquinoxContainerAdaptor.publishModuleEvent(EquinoxContainerAdaptor.java:168)
        at org.eclipse.osgi.container.Module.publishEvent(Module.java:476)
        at org.eclipse.osgi.container.Module.doStop(Module.java:634)
        at org.eclipse.osgi.container.Module.stop(Module.java:498)
        at org.eclipse.osgi.container.SystemModule.stop(SystemModule.java:202)
        at org.eclipse.osgi.internal.framework.EquinoxBundle$SystemBundle$EquinoxSystemModule$1.run(EquinoxBundle.java:165)
        at java.base/java.lang.Thread.run(Thread.java:844)
    Caused by: java.lang.ClassNotFoundException: javax.annotation.PreDestroy cannot be found by org.eclipse.e4.core.di_1.6.100.v20170421-1418
        at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:433)
        at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:395)
        at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:387)
        at org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(ModuleClassLoader.java:150)
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:499)
        ... 21 more
    !SESSION 2018-10-24 10:37:46.365 -----------------------------------------------
    eclipse.buildId=3.9.3.201803200915-RELEASE-e47
    java.version=10
    java.vendor=Oracle Corporation
    BootLoader constants: OS=macosx, ARCH=x86_64, WS=cocoa, NL=en_US
    Framework arguments:  -product org.springsource.sts.ide -showlocation
    Command-line arguments:  -os macosx -ws cocoa -arch x86_64 -product org.springsource.sts.ide -data /Users/simeonleyzerzon/abc/spring-security/ -clean -showlocation

    !ENTRY org.eclipse.osgi 4 0 2018-10-24 10:37:57.312
    !MESSAGE Application error
    !STACK 1
    org.eclipse.e4.core.di.InjectionException: java.lang.NoClassDefFoundError: javax/annotation/PostConstruct
        at org.eclipse.e4.core.internal.di.InjectorImpl.internalMake(InjectorImpl.java:410)
        at org.eclipse.e4.core.internal.di.InjectorImpl.make(InjectorImpl.java:318)
        at org.eclipse.e4.core.contexts.ContextInjectionFactory.make(ContextInjectionFactory.java:162)
        at org.eclipse.e4.ui.internal.workbench.swt.E4Application.createDefaultHeadlessContext(E4Application.java:491)
        at org.eclipse.e4.ui.internal.workbench.swt.E4Application.createDefaultContext(E4Application.java:505)
        at org.eclipse.e4.ui.internal.workbench.swt.E4Application.createE4Workbench(E4Application.java:204)
        at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:614)
        at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336)
        at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:594)
        at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:148)
        at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:151)
        at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
        at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
        at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
        at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:388)
        at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:243)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:564)
        at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:653)
        at org.eclipse.equinox.launcher.Main.basicRun(Main.java:590)
        at org.eclipse.equinox.launcher.Main.run(Main.java:1499)
    Caused by: java.lang.NoClassDefFoundError: javax/annotation/PostConstruct
        at org.eclipse.e4.core.internal.di.InjectorImpl.inject(InjectorImpl.java:124)
        at org.eclipse.e4.core.internal.di.InjectorImpl.internalMake(InjectorImpl.java:399)
        ... 22 more
    Caused by: java.lang.ClassNotFoundException: javax.annotation.PostConstruct cannot be found by org.eclipse.e4.core.di_1.6.100.v20170421-1418
        at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:433)
        at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:395)
        at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:387)
        at org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(ModuleClassLoader.java:150)
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:499)
        ... 24 more

    !ENTRY org.eclipse.e4.ui.workbench 4 0 2018-10-24 10:37:57.319
    !MESSAGE FrameworkEvent ERROR
    !STACK 0
    java.lang.NoClassDefFoundError: javax/annotation/PreDestroy
        at org.eclipse.e4.core.internal.di.InjectorImpl.disposed(InjectorImpl.java:450)
        at org.eclipse.e4.core.internal.di.Requestor.disposed(Requestor.java:156)
        at org.eclipse.e4.core.internal.contexts.ContextObjectSupplier$ContextInjectionListener.update(ContextObjectSupplier.java:78)
        at org.eclipse.e4.core.internal.contexts.TrackableComputationExt.update(TrackableComputationExt.java:111)
        at org.eclipse.e4.core.internal.contexts.TrackableComputationExt.handleInvalid(TrackableComputationExt.java:74)
        at org.eclipse.e4.core.internal.contexts.EclipseContext.dispose(EclipseContext.java:178)
        at org.eclipse.e4.core.internal.contexts.osgi.EclipseContextOSGi.dispose(EclipseContextOSGi.java:99)
        at org.eclipse.e4.core.internal.contexts.osgi.EclipseContextOSGi.bundleChanged(EclipseContextOSGi.java:141)
        at org.eclipse.osgi.internal.framework.BundleContextImpl.dispatchEvent(BundleContextImpl.java:908)
        at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
        at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:148)
        at org.eclipse.osgi.internal.framework.EquinoxEventPublisher.publishBundleEventPrivileged(EquinoxEventPublisher.java:213)
        at org.eclipse.osgi.internal.framework.EquinoxEventPublisher.publishBundleEvent(EquinoxEventPublisher.java:120)
        at org.eclipse.osgi.internal.framework.EquinoxEventPublisher.publishBundleEvent(EquinoxEventPublisher.java:112)
        at org.eclipse.osgi.internal.framework.EquinoxContainerAdaptor.publishModuleEvent(EquinoxContainerAdaptor.java:168)
        at org.eclipse.osgi.container.Module.publishEvent(Module.java:476)
        at org.eclipse.osgi.container.Module.doStop(Module.java:634)
        at org.eclipse.osgi.container.Module.stop(Module.java:498)
        at org.eclipse.osgi.container.SystemModule.stop(SystemModule.java:202)
        at org.eclipse.osgi.internal.framework.EquinoxBundle$SystemBundle$EquinoxSystemModule$1.run(EquinoxBundle.java:165)
        at java.base/java.lang.Thread.run(Thread.java:844)
    Caused by: java.lang.ClassNotFoundException: javax.annotation.PreDestroy cannot be found by org.eclipse.e4.core.di_1.6.100.v20170421-1418
        at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:433)
        at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:395)
        at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:387)
        at org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(ModuleClassLoader.java:150)
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:499)
        ... 21 more


How does one create a script to start Eclipse (STS) on a Mac?  I'm trying to replicate on a Mac a similar behavior of a Windows batch file, e.g.: 

    start /B C:\sts-bundle\sts-3.8.4.RELEASE\STS.exe -data %~dp0 -clean -showlocation -vmC:\Java\java-8 -vmargs -Xmx1024m -XX:MaxPermSize=256m -javaagent:"C:\Users\Simeon\.m2\repository\org\projectlombok\lombok\1.16.8\lombok-1.16.8.jar" -Xbootclasspath/a:"C:\Users\Simeon\.m2\repository\org\projectlombok\lombok\1.16.8\lombok-1.16.8.jar"

Any pointers and best practices in AppleScript are appreciated.

更新:

根据@greg-449 的评论,我已在脚本编辑器中更新了命令(删除了空格):

do shell script "open -a /Applications/STS.app --args -data ~/abc/spring-security/ -clean -showlocation  -vm 
/Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk -vmargs -Xmx1024m -XX:MaxPermSize=256m"

其中:

  1. 弹出一个错误对话框(内容相同,然后保存在 Apple 脚本编辑器中):

错误“sh: line 1: /Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk: is a directory”编号 126

  1. 允许打开 STS(与以前不同)

  2. 在 STS 的 .metadata/.log 中包含以下错误:

    !SESSION 2018-10-24 21:03:22.116 --------------------------------- ------------ eclipse.buildId=3.9.3.201803200915-RELEASE-e47 java.version=10 java.vendor=Oracle Corporation BootLoader 常量:OS=macosx, ARCH=x86_64, WS=cocoa, NL =en_US 框架参数:-product org.springsource.sts.ide 命令行参数:-os macosx -ws cocoa -arch x86_64 -product org.springsource.sts.ide -data /Users/simeonleyzerzon/abc/spring-security/ -clean

    !ENTRY org.eclipse.ui 2 0 2018-10-24 21:03:37.575 !MESSAGE 解析来自“org.eclipse.ui.commandImages”扩展点的图像时发出警告。 !SUBENTRY 1 org.eclipse.ui 2 0 2018-10-24 21:03:37.575 !MESSAGE 无法绑定到未定义的命令:插件='org.eclipse.lsp4e',id='org.eclipse.lsp4e。切换高亮'

    !ENTRY org.eclipse.core.net 1 0 2018-10-24 21:03:37.846 !MESSAGE 系统属性 http.nonProxyHosts 已设置为本地|.local|169.254/16|.169.254/16 来自外部来源。此值将使用首选项中的值覆盖

    !ENTRY org.eclipse.jface 2 0 2018-10-24 21:03:45.223 !MESSAGE 发生键绑定冲突。它们可能会干扰正常的加速器操作。 !SUBENTRY 1 org.eclipse.jface 2 0 2018-10-24 21:03:45.224 !MESSAGE 发生冲突 ALT+COMMAND+R: Binding(ALT+COMMAND+R, ParameterizedCommand(Command(org.python.pydev. debug.setnext,Set Next Statement, , Category(org.python.pydev.ui.category.run,PyDev - Run,Python 运行类别,true), org.eclipse.ui.internal.WorkbenchHandlerServiceHandler@a0682a3, ,,true) ,null), org.eclipse.ui.defaultAcceleratorConfiguration, org.eclipse.ui.contexts.window,,,system) 绑定(ALT+COMMAND+R, ParameterizedCommand(Command(org.eclipse.jdt.ui.edit.text. java.rename.element,重命名 Refactoring , 重命名选中元素, Category(org.eclipse.jdt.ui.category.refactoring,Refactor - Java,Java Refactoring Actions,true), org.eclipse.ui.internal.WorkbenchHandlerServiceHandler@1f018208, ,,true),null ), org.eclipse.ui.defaultAcceleratorConfiguration, org.eclipse.ui.contexts.window,,cocoa,system) !SUBENTRY 1 org.eclipse.jface 2 0 2018-10-24 21:03:45.224 !MESSAGE 发生冲突对于 COMMAND+SHIFT+T:Binding(COMMAND+SHIFT+T, ParameterizedCommand(Command(org.eclipse.jdt.ui.navigate.open.type,Open Type, 在 Java 编辑器中打开一个类型,Category(org.eclipse. ui.category.navigate,Navigate,null,true), org.eclipse.ui.internal.WorkbenchHandlerServiceHandler@801c0e8, ,,true),null), org.eclipse.ui.defaultAcceleratorConfiguration, org.eclipse.ui.contexts.window ,,,system) Binding(COMMAND+SHIFT+T, ParameterizedCommand(Command(org.eclipse.lsp4e.symbolinworkspace,转到工作区中的符号, , Category(org.ecli pse.lsp4e.category,语言服务器,null,true), org.eclipse.ui.internal.WorkbenchHandlerServiceHandler@5aa2493f, ,,true),null), org.eclipse.ui.defaultAcceleratorConfiguration, org.eclipse.ui.contexts。窗口,,,系统)

    !ENTRY org.eclipse.ui 2 2 2018-10-24 21:03:46.694 !MESSAGE org.eclipse.jdt.junit.ResultView:不推荐使用的关系“快速”应转换为“堆栈”。

    !ENTRY org.eclipse.ui 2 2 2018-10-24 21:03:46.695 !MESSAGE org.springframework.ide.eclipse.aop.ui.navigator.aopReferenceModelNavigator:不推荐使用的关系“快速”应转换为“堆栈”。

    !ENTRY org.eclipse.ui 2 2 2018-10-24 21:03:46.695 !MESSAGE org.eclipse.contribution.xref.ui.views.XReferenceView:不推荐使用的关系“快速”应转换为“堆栈” .

    !ENTRY org.eclipse.jface.text 2 0 2018-10-24 21:03:48.503 !MESSAGE 模板 ID 重复:'org.eclipse.wst.xslt.templates.xpath.number'

    !ENTRY org.eclipse.jface.text 2 0 2018-10-24 21:03:48.504 !MESSAGE 模板 id 重复:'org.eclipse.wst.xslt.templates.xpath.round'

    !ENTRY org.jkiss.dbeaver.model 2 0 2018-10-24 21:03:51.613 !MESSAGE Project 'RemoteSystemsTempFiles' not found in registry

看起来我已经走得更远了,但仍然存在一些问题。是的,我确实安装了 PyDev、DBeaver 插件,这些插件到现在都没有引起问题。

===

根据 Martin 的建议,我试图指出 Java 可执行文件是 Apple 脚本:

do shell script "open -a /Applications/STS.app --args -data ~/abc/spring-security/ -clean -showlocation  -vm 
/Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home/bin/java -vmargs -Xmx1024m -XX:MaxPermSize=256m"

现在,脚本编辑器抱怨以下内容:

error "Unrecognized option: -vmargs
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit." number 1

新工作区(和一个 STS 实例)正在使用以下内容创建(看起来与之前的尝试非常相似,但没有指向 java exec:

!SESSION 2018-10-25 13:52:05.053 -----------------------------------------------
eclipse.buildId=3.9.3.201803200915-RELEASE-e47
java.version=10
java.vendor=Oracle Corporation
BootLoader constants: OS=macosx, ARCH=x86_64, WS=cocoa, NL=en_US
Framework arguments:  -product org.springsource.sts.ide
Command-line arguments:  -os macosx -ws cocoa -arch x86_64 -product org.springsource.sts.ide -data /Users/simeonleyzerzon/abc/spring-security/ -clean

!ENTRY org.eclipse.ui 2 0 2018-10-25 13:52:20.096
!MESSAGE Warnings while parsing the images from the 'org.eclipse.ui.commandImages' extension point.
!SUBENTRY 1 org.eclipse.ui 2 0 2018-10-25 13:52:20.096
!MESSAGE Cannot bind to an undefined command: plug-in='org.eclipse.lsp4e', id='org.eclipse.lsp4e.togglehighlight'

!ENTRY org.eclipse.core.net 1 0 2018-10-25 13:52:20.356
!MESSAGE System property http.nonProxyHosts has been set to local|*.local|169.254/16|*.169.254/16 by an external source. This value will be overwritten using the values from the preferences

!ENTRY org.eclipse.jface 2 0 2018-10-25 13:52:26.785
!MESSAGE Keybinding conflicts occurred.  They may interfere with normal accelerator operation.
!SUBENTRY 1 org.eclipse.jface 2 0 2018-10-25 13:52:26.786
!MESSAGE A conflict occurred for ALT+COMMAND+R:
Binding(ALT+COMMAND+R,
    ParameterizedCommand(Command(org.python.pydev.debug.setnext,Set Next Statement,
        ,
        Category(org.python.pydev.ui.category.run,PyDev - Run,Python run category,true),
        org.eclipse.ui.internal.WorkbenchHandlerServiceHandler@7a8623b1,
        ,,true),null),
    org.eclipse.ui.defaultAcceleratorConfiguration,
    org.eclipse.ui.contexts.window,,,system)
Binding(ALT+COMMAND+R,
    ParameterizedCommand(Command(org.eclipse.jdt.ui.edit.text.java.rename.element,Rename - Refactoring ,
        Rename the selected element,
        Category(org.eclipse.jdt.ui.category.refactoring,Refactor - Java,Java Refactoring Actions,true),
        org.eclipse.ui.internal.WorkbenchHandlerServiceHandler@3b2fac55,
        ,,true),null),
    org.eclipse.ui.defaultAcceleratorConfiguration,
    org.eclipse.ui.contexts.window,,cocoa,system)
!SUBENTRY 1 org.eclipse.jface 2 0 2018-10-25 13:52:26.786
!MESSAGE A conflict occurred for COMMAND+SHIFT+T:
Binding(COMMAND+SHIFT+T,
    ParameterizedCommand(Command(org.eclipse.jdt.ui.navigate.open.type,Open Type,
        Open a type in a Java editor,
        Category(org.eclipse.ui.category.navigate,Navigate,null,true),
        org.eclipse.ui.internal.WorkbenchHandlerServiceHandler@4866eb17,
        ,,true),null),
    org.eclipse.ui.defaultAcceleratorConfiguration,
    org.eclipse.ui.contexts.window,,,system)
Binding(COMMAND+SHIFT+T,
    ParameterizedCommand(Command(org.eclipse.lsp4e.symbolinworkspace,Go to Symbol in Workspace,
        ,
        Category(org.eclipse.lsp4e.category,Language Servers,null,true),
        org.eclipse.ui.internal.WorkbenchHandlerServiceHandler@45b94c10,
        ,,true),null),
    org.eclipse.ui.defaultAcceleratorConfiguration,
    org.eclipse.ui.contexts.window,,,system)

!ENTRY org.eclipse.ui 2 2 2018-10-25 13:52:28.210
!MESSAGE org.eclipse.jdt.junit.ResultView: Deprecated relationship "fast" should be converted to "stack".

!ENTRY org.eclipse.ui 2 2 2018-10-25 13:52:28.213
!MESSAGE org.springframework.ide.eclipse.aop.ui.navigator.aopReferenceModelNavigator: Deprecated relationship "fast" should be converted to "stack".

!ENTRY org.eclipse.ui 2 2 2018-10-25 13:52:28.213
!MESSAGE org.eclipse.contribution.xref.ui.views.XReferenceView: Deprecated relationship "fast" should be converted to "stack".

!ENTRY org.eclipse.jface.text 2 0 2018-10-25 13:52:30.187
!MESSAGE Duplicate template id: 'org.eclipse.wst.xslt.templates.xpath.number'

!ENTRY org.eclipse.jface.text 2 0 2018-10-25 13:52:30.187
!MESSAGE Duplicate template id: 'org.eclipse.wst.xslt.templates.xpath.round'

!ENTRY org.jkiss.dbeaver.model 2 0 2018-10-25 13:52:32.968
!MESSAGE Project 'RemoteSystemsTempFiles' not found in registry

顺便说一句,过去(在Windows机器上)我总是指向Java的家,它从不抱怨,也从不抱怨-vm之后没有空格:

start /B C:\sts-bundle\sts-3.8.4.RELEASE\STS.exe -data %~dp0 -clean -showlocation -vmC:\Java\java-8 -vmargs -Xmx1024m -XX:MaxPermSize=256m -javaagent:"C:\Users\Simeon\.m2\repository\org\projectlombok\lombok\1.16.8\lombok-1.16.8.jar" -Xbootclasspath/a:"C:\Users\Simeon\.m2\repository\org\projectlombok\lombok\1.16.8\lombok-1.16.8.jar"

【问题讨论】:

  • 失败的运行使用的是 Java 10 - 看起来 STS 尚未更新以理解 Java 10
  • 我想知道是什么原因造成的。通过do shell script "open -a /Applications/STS.app --args -data ~/abc/spring-security/ -clean -showlocation -vm/Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/ -vmargs -Xmx1024m -XX:MaxPermSize=256m" 强制使用java 8 似乎并没有改变错误行为。 which java 产生 /Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home/bin/java
  • -vm/Library..... 之间需要一个空格,路径可能还需要是/Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home
  • 我建议明确写主路径-data /home/you/abc/spring-security/。此外,将该命令包装在一个 shell 脚本中并尝试从 AppleScript 启动它。
  • @greg-449:添加了空格后,我看到了一种新的(但仍然是部分错误的)行为 - 请参阅问题中的更新。扩展 java 路径并没有什么不同。谢谢。

标签: eclipse bash macos pydev spring-tool-suite


【解决方案1】:

我使用最新的 Spring Tools 4 for Eclipse 发行版进行了尝试,它似乎工作正常。以下是我所做的以及我认为重要的事情:

  • 首先尝试纯命令行并在其中包含 -vm 选项。

我试过了,它工作得很好,使用指定的 JDK 启动我的发行版:

open -a /sts4r/SpringToolSuite4.app --args -vm /Library/Java/JavaVirtualMachines/jdk-10.0.2.jdk/Contents/Home/bin/java -data ~/Documents/workspace-from-command-line1/ -clean -showlocation -vmargs -Xmx1024m -XX:MaxPermSize=256m

请注意-vm 选项是--args 之后的第一个选项,我认为这很重要。

  • 然后我像您一样将其包装在 Apple 脚本中:

do shell script "open -a /sts4r/SpringToolSuite4.app --args -vm /Library/Java/JavaVirtualMachines/jdk-10.0.2.jdk/Contents/Home/bin/java -data ~/Documents/workspace-from-command-line1/ -clean -showlocation -vmargs -Xmx1024m -XX:MaxPermSize=256m"

这也有效(在脚本编辑器中尝试过)。

我建议使用 JDK 8(不是我在这里使用的 JDK 10)运行 STS 安装。

希望这会有所帮助!

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-06-27
    • 2018-08-16
    • 1970-01-01
    • 2020-03-08
    • 2019-03-28
    • 2010-09-23
    • 1970-01-01
    相关资源
    最近更新 更多