我尝试将eclipse google风格格式化程序应用于现有代码,但失败了。我正在使用eclipse luna,Java 8和Windows 8.
我导入eclipse Google Java样式模板。我启用了项目特定设置。但是当我尝试按照/ 0 /使用命令窗口并调用命令/ 1 /时。我收到错误/ 3 /。我尝试将/ 2 /添加到我复制的文件中:com.google.gdt.eclipse.suite.prefs。它显示相同的错误。
任何提示?或者我应该使用其他工具,例如Jalopy或JIndent?
/ 0 /
http://www.peterfriese.de/formatting-your-code-using-the-eclipse-code-formatter/
/ 1 /
C:\eclipse_luna_nemuNew_gwt_gradle_scala\eclipse\eclipse.exe -vm "C:\Program Files\Java\jdk1.8.0_40\bin\java.exe" -application **org.eclipse.jdt.core.JavaCodeFormatter** -verbose -config C:\sjj\GeneralTest\lib\org.eclipse.jdt.core.prefs C:\sjj\GeneralTest\src\main\java\com\callstats\general\exer\jackson\*.java
/ 2 /
org.eclipse.jdt.core.compiler.compliance=1.5
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
org.eclipse.jdt.core.compiler.source=1.5
/ 3 /
!SESSION 2015-10-20 19:20:52.563 -----------------------------------------------
eclipse.buildId=4.4.2.M20150204-1700
java.version=1.8.0_40
java.vendor=Oracle Corporation
BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=en_US
Framework arguments: -product org.eclipse.epp.package.standard.product -application **org.eclipse.jdt.core.JavaCodeFormatter** -verbose -config C:\sjj\GeneralTest\lib\org.eclipse.jdt.core.prefs C:\sjj\GeneralTest\src\main\java\com\callstats\general\exer\jackson\ConInfo.java C:\sjj\GeneralTest\src\main\java\com\callstats\general\exer\jackson\JacksonExample.java C:\sjj\GeneralTest\src\main\java\com\callstats\general\exer\jackson\JSONUtil.java C:\sjj\GeneralTest\src\main\java\com\callstats\general\exer\jackson\User.java
Command-line arguments: -os win32 -ws win32 -arch x86_64 -product org.eclipse.epp.package.standard.product -application **org.eclipse.jdt.core.JavaCodeFormatter** -verbose -config C:\sjj\GeneralTest\lib\org.eclipse.jdt.core.prefs C:\sjj\GeneralTest\src\main\java\com\callstats\general\exer\jackson\ConInfo.java C:\sjj\GeneralTest\src\main\java\com\callstats\general\exer\jackson\JacksonExample.java C:\sjj\GeneralTest\src\main\java\com\callstats\general\exer\jackson\JSONUtil.java C:\sjj\GeneralTest\src\main\java\com\callstats\general\exer\jackson\User.java
!ENTRY org.eclipse.osgi 4 0 2015-10-20 19:20:54.784
!MESSAGE Application error
!STACK 1
java.lang.RuntimeException: Application "**org.eclipse.jdt.core.JavaCodeFormatter**" could not be found in the registry. The applications available are: org.eclipse.ant.core.antRunner, org.eclipse.ant.ui.antRunner, org.eclipse.e4.ui.workbench.swt.E4Application, org.eclipse.e4.ui.workbench.swt.GenTopic, org.eclipse.equinox.app.error, org.eclipse.equinox.p2.director, org.eclipse.equinox.p2.garbagecollector.application, org.eclipse.equinox.p2.publisher.InstallPublisher, org.eclipse.equinox.p2.publisher.EclipseGenerator, org.eclipse.equinox.p2.publisher.ProductPublisher, org.eclipse.equinox.p2.publisher.FeaturesAndBundlesPublisher, org.eclipse.equinox.p2.reconciler.application, org.eclipse.equinox.p2.repository.repo2runnable, org.eclipse.equinox.p2.repository.metadataverifier, org.eclipse.equinox.p2.artifact.repository.mirrorApplication, org.eclipse.equinox.p2.metadata.repository.mirrorApplication, org.eclipse.equinox.p2.updatesite.UpdateSitePublisher, org.eclipse.equinox.p2.publisher.UpdateSitePublisher, org.eclipse.equinox.p2.publisher.CategoryPublisher, org.eclipse.help.base.infocenterApplication, org.eclipse.help.base.helpApplication, org.eclipse.help.base.indexTool, org.eclipse.jdt.apt.core.aptBuild, org.eclipse.jdt.core.JavaCodeFormatter, org.eclipse.jdt.core.JavaIndexer, org.eclipse.pde.build.Build, org.eclipse.pde.junit.runtime.uitestapplication, org.eclipse.pde.junit.runtime.legacytestapplication, org.eclipse.pde.junit.runtime.coretestapplication, org.eclipse.pde.junit.runtime.coretestapplicationnonmain, org.eclipse.pde.junit.runtime.nonuithreadtestapplication, org.eclipse.ui.ide.workbench, com.google.gwt.eclipse.core.GWTCodeFormatterApplication, org.eclipse.emf.codegen.CodeGen, org.eclipse.emf.codegen.JMerger, org.eclipse.wst.jsdt.core.JavaCodeFormatter.
at org.eclipse.equinox.internal.app.EclipseAppContainer.startDefaultApp(EclipseAppContainer.java:248)
at org.eclipse.equinox.internal.app.MainApplicationLauncher.run(MainApplicationLauncher.java:29)
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:380)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:235)
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 org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:648)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:603)
at org.eclipse.equinox.launcher.Main.run(Main.java:1465)
at org.eclipse.equinox.launcher.Main.main(Main.java:1438)
更新
现在,在每个文件中,当我尝试ctr + shift + f时,我将现有文件格式化。 当我尝试/ 4 /时,代码样式听起来像Eclipse默认代码样式。为什么我不能将google样式应用于现有的java文件?
/ 4 /
C:\eclipse_luna_nemuNew_gwt_gradle_scala\eclipse\eclipse.exe -vm "C:\Program Files\Java\jdk1.8.0_40\bin\java.exe" -application org.eclipse.jdt.core.JavaCodeFormatter -verbose -config C:\sjj\GeneralTest\lib\com.google.gdt.eclipse.suite.prefs C:\sjj\GeneralTest\src\main\java\com\callstats\general\exer\jackson\*.java
/ 5 /
eclipse.preferences.version=1
id=1433316730347