0

Я пытаюсь запустить затмение Java форматировщик в командной строке с помощью code formatter docs но это сбой с сообщением исключения изЗапуск форматировщик Eclipse, Java из командной строки с затмение 4,4

<current working directory>/--launcher.library file does not exist. 

Глядя на code formatter application code похоже, что происходит то, что некоторые аргументы eclipse интерпретируются синтаксическим анализатором командной строки в качестве относительных имен файлов, которых не существует.

Я знаю, что some people used to be able to get this to work, но это было более 5 лет назад, используя более старую версию eclipse, и мне интересно, смог ли кто-то использовать ту же функцию с eclipse 4.4?

Update 1:

Вот командная строка, которую я использовал:

/home/alexq/eclipse-luna-SR2-4.4.2/eclipse/eclipse -nosplash -consolelog -debug -application org.eclipse.jdt.core.JavaCodeFormatter -verbose -config /home/alexq/eclipse-user-files/formatter-config-for-scripts/MyCodingStandards.ini /home/alexq/eclipse-4.4.2-workspaces/MyWorkspace/MyProject/src/com/example/myproject/MyClassToBeFormatted.java 

Вот содержание моего eclipse.ini файла:

-showlocation 
-vm 
/home/alexq/JavaSE8/jdk1.8/bin/java 
-startup 
plugins/org.eclipse.equinox.launcher_1.3.0.v20140415-2008.jar 
--launcher.library 
plugins/org.eclipse.equinox.launcher.gtk.linux.x86_64_1.1.200.v20150204-1316 
-product 
org.eclipse.epp.package.jee.product 
--launcher.defaultAction 
openFile 
-showsplash 
org.eclipse.platform 
--launcher.XXMaxPermSize 
256m 
--launcher.defaultAction 
openFile 
--launcher.appendVmargs 
-vmargs 
-Dosgi.requiredJavaVersion=1.6 
-XX:MaxPermSize=256m 
-Xms40m 
-Xmx512m 
-Dorg.eclipse.swt.browser.XULRunnerPath='' 

И вот выход от этой команды:

Start VM: /home/alexq/JavaSE8/jdk1.8/bin/java 
-Dosgi.requiredJavaVersion=1.6 
-XX:MaxPermSize=256m 
-Xms40m 
-Xmx512m 
-Dorg.eclipse.swt.browser.XULRunnerPath='' 
-jar /home/alexq/eclipse-luna-SR2-4.4.2/eclipse//plugins/org.eclipse.equinox.launcher_1.3.0.v20140415-2008.jar 
-os linux 
-ws gtk 
-arch x86_64 
-launcher /home/alexq/eclipse-luna-SR2-4.4.2/eclipse/eclipse 
-name Eclipse 
--launcher.library /home/alexq/eclipse-luna-SR2-4.4.2/eclipse//plugins/org.eclipse.equinox.launcher.gtk.linux.x86_64_1.1.200.v20150204-1316/eclipse_1607.so 
-startup /home/alexq/eclipse-luna-SR2-4.4.2/eclipse//plugins/org.eclipse.equinox.launcher_1.3.0.v20140415-2008.jar 
--launcher.appendVmargs 
-exitdata 1008087 
-showlocation 
-product org.eclipse.epp.package.jee.product 
-consolelog 
-debug 
-application org.eclipse.jdt.core.JavaCodeFormatter 
-verbose 
-config /home/alexq/eclipse-user-files/formatter-config-for-scripts/MyCodingStandards.ini 
/home/alexq/eclipse-4.4.2-workspaces/MyWorkspace/MyProject/src/com/example/myproject/MyClass.java 
-vm /home/alexq/JavaSE8/jdk1.8/bin/java 
-vmargs 
-Dosgi.requiredJavaVersion=1.6 
-XX:MaxPermSize=256m 
-Xms40m 
-Xmx512m 
-Dorg.eclipse.swt.browser.XULRunnerPath='' 
-jar /home/alexq/eclipse-luna-SR2-4.4.2/eclipse//plugins/org.eclipse.equinox.launcher_1.3.0.v20140415-2008.jar 
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=256m; support was removed in 8.0 
Install location: 
    file:/home/alexq/eclipse-luna-SR2-4.4.2/eclipse/ 
Configuration file: 
    file:/home/alexq/eclipse-luna-SR2-4.4.2/eclipse/configuration/config.ini loaded 
Configuration location: 
    file:/home/alexq/eclipse-luna-SR2-4.4.2/eclipse/configuration/ 
Framework located: 
    file:/home/alexq/eclipse-luna-SR2-4.4.2/eclipse/plugins/org.eclipse.osgi_3.10.2.v20150203-1939.jar 
Loading extension: reference:file:org.eclipse.osgi.compatibility.state_1.0.1.v20140709-1414.jar 
     eclipse.properties not found 
Framework classpath: 
    file:/home/alexq/eclipse-luna-SR2-4.4.2/eclipse/plugins/org.eclipse.osgi_3.10.2.v20150203-1939.jar 
    file:/home/alexq/eclipse-luna-SR2-4.4.2/eclipse/plugins/ 
    file:/home/alexq/eclipse-luna-SR2-4.4.2/eclipse/plugins/org.eclipse.osgi.compatibility.state_1.0.1.v20140709-1414.jar 
Debug options: 
    file:/home/alexq/eclipse-4.4.2-workspaces/MyWorkspace/MyProject/.options not found 
Time to load bundles: 3 
org.eclipse.m2e.logback.configuration: The org.eclipse.m2e.logback.configuration bundle was activated before the state location was initialized. Will retry after the state location is initialized. 
Starting application: 1459 
org.eclipse.m2e.logback.configuration: Logback config file: /home/alexq/workspace/.metadata/.plugins/org.eclipse.m2e.logback.configuration/logback.1.5.1.20150109-1820.xml 
org.eclipse.m2e.logback.configuration: Initializing logback 
/home/alexq/eclipse-4.4.2-workspaces/MyWorkspace/MyProject/-showlocation does not exist. Please try specifying valid absolute path. 

Usage: eclipse -application org.eclipse.jdt.core.JavaCodeFormatter [ OPTIONS ] -config <configFile> <files> 

    <files> Java source files and/or directories to format. 
      Only files ending with .java will be formatted in the given directory. 
    -config <configFile> Use the formatting style from the specified properties file. 
         Refer to the help documentation to find out how to generate this file. 

OPTIONS: 

    -help    Display this message. 
    -quiet    Only print error messages. 
    -verbose    Be verbose about the formatting job. 
+0

Что привело к тому, что команда, использующая форматирование, в итоге? – nitind

ответ

0

В качестве обходного решения я загружаю eclipse 3.6 из here и пытался запустить ту же команду форматирования eclipse, и это удалось.

0

Другой обходной путь - с помощью Eclipse, Neon.2, я только удалил -showlocation с начала eclipse.ini и теперь файл выглядит следующим образом:

-startup 
plugins/org.eclipse.equinox.launcher_1.3.201.v20161025-1711.jar 
--launcher.library 
plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.401.v20161122-1740 
-product 
org.eclipse.epp.package.jee.product 
--launcher.defaultAction 
openFile 
-showsplash 
org.eclipse.platform 
--launcher.defaultAction 
openFile 
--launcher.appendVmargs 
-vmargs 
-Dosgi.requiredJavaVersion=1.8 
-XX:+UseG1GC 
-XX:+UseStringDeduplication 
-Dosgi.requiredJavaVersion=1.8 
-Xms2048m 
-Xmx2048m 

JavaCodeFormatter теперь работает из командной строки.

 Смежные вопросы

  • Нет связанных вопросов^_^