Bug 477612 - [formatter] command line Java formatter tries to read eclipse arguments as file names
Summary: [formatter] command line Java formatter tries to read eclipse arguments as fi...
Status: NEW
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 4.7.3   Edit
Hardware: All Linux
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
Depends on:
Blocks:
 
Reported: 2015-09-16 12:51 EDT by Missing name Mising name CLA
Modified: 2022-08-04 08:46 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Missing name Mising name CLA 2015-09-16 12:51:45 EDT
I'm trying to run the eclipse java formatter on the command line but it fails with an error message that makes it appear that the eclipse command line arguments are trying to be parsed as relative file names. See below for the error message.

Here is the command line that I used:

-------------------------------------------

    /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

-------------------------------------------

Here is the content of my eclipse.ini file:

-------------------------------------------

    -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=''

-------------------------------------------

And here is the output from that command:

-------------------------------------------

    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.

-------------------------------------------

See also: http://stackoverflow.com/questions/32599714/running-the-eclipse-java-formatter-on-the-command-line-with-eclipse-4-4
Comment 1 Eclipse Genie CLA 2020-07-21 14:53:32 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.
Comment 2 Missing name Mising name CLA 2020-07-21 17:38:25 EDT
I am still able to reproduce the issue with eclipse 4.7.3a oxygen


Here is the command line that I used:

-------------------------------------------

/home/alexq/eclipse/4.7.3a-oxygen/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

-------------------------------------------

Here is the content of my eclipse.ini file:

-------------------------------------------
-showlocation
-vm
/home/alexq/JavaSE8/jdk1.8/bin/java
-startup
plugins/org.eclipse.equinox.launcher_1.4.0.v20161219-1356.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.gtk.linux.x86_64_1.1.551.v20171108-1834
-product
org.eclipse.epp.package.java.product
-showsplash
org.eclipse.epp.package.common
--launcher.defaultAction
openFile
--launcher.defaultAction
openFile
--launcher.appendVmargs
-vmargs
-Dosgi.requiredJavaVersion=1.8
-Dosgi.instance.area.default=@user.home/eclipse-workspace
-XX:+UseG1GC
-XX:+UseStringDeduplication
--add-modules=ALL-SYSTEM
-Dosgi.requiredJavaVersion=1.8
-Xms500m
-Xmx2g
--add-modules=ALL-SYSTEM
-Dorg.eclipse.swt.internal.gtk.cairoGraphics=false
-------------------------------------------

And here is the output from that command:

-------------------------------------------
Start VM: /home/alexq/JavaSE8/jdk1.8/bin/java
-Dosgi.requiredJavaVersion=1.8
-Dosgi.instance.area.default=@user.home/eclipse-workspace
-XX:+UseG1GC
-XX:+UseStringDeduplication
-Dosgi.requiredJavaVersion=1.8
-Xms500m
-Xmx2g
-Dorg.eclipse.swt.internal.gtk.cairoGraphics=false
-jar /home/alexq/eclipse/4.7.3a-oxygen//plugins/org.eclipse.equinox.launcher_1.4.0.v20161219-1356.jar
-os linux
-ws gtk
-arch x86_64
-launcher /home/alexq/eclipse/4.7.3a-oxygen/eclipse
-name Eclipse
--launcher.library /home/alexq/eclipse/4.7.3a-oxygen//plugins/org.eclipse.equinox.launcher.gtk.linux.x86_64_1.1.551.v20171108-1834/eclipse_1630.so
-startup /home/alexq/eclipse/4.7.3a-oxygen//plugins/org.eclipse.equinox.launcher_1.4.0.v20161219-1356.jar
--launcher.appendVmargs
-exitdata 2c60017
-showlocation
-product org.eclipse.epp.package.java.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/MyClassToBeFormatted.java
-vm /home/alexq/JavaSE8/jdk1.8/bin/java
-vmargs
-Dosgi.requiredJavaVersion=1.8
-Dosgi.instance.area.default=@user.home/eclipse-workspace
-XX:+UseG1GC
-XX:+UseStringDeduplication
-Dosgi.requiredJavaVersion=1.8
-Xms500m
-Xmx2g
-Dorg.eclipse.swt.internal.gtk.cairoGraphics=false
-jar /home/alexq/eclipse/4.7.3a-oxygen//plugins/org.eclipse.equinox.launcher_1.4.0.v20161219-1356.jar 
Install location:
    file:/home/alexq/eclipse/4.7.3a-oxygen/
Configuration file:
    file:/home/alexq/eclipse/4.7.3a-oxygen/configuration/config.ini loaded
Configuration location:
    file:/home/alexq/eclipse/4.7.3a-oxygen/configuration/
Framework located:
    file:/home/alexq/eclipse/4.7.3a-oxygen/plugins/org.eclipse.osgi_3.12.100.v20180210-1608.jar
Loading extension: reference:file:org.eclipse.osgi.compatibility.state_1.1.0.v20170516-1513.jar
	eclipse.properties not found
Framework classpath:
    file:/home/alexq/eclipse/4.7.3a-oxygen/plugins/org.eclipse.osgi_3.12.100.v20180210-1608.jar
    file:/home/alexq/eclipse/4.7.3a-oxygen/plugins/
    file:/home/alexq/eclipse/4.7.3a-oxygen/plugins/org.eclipse.osgi.compatibility.state_1.1.0.v20170516-1513.jar
Debug options:
    file:/home/alexq/eclipse/4.7.3a-oxygen/.options not found
Time to load bundles: 5
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: 4030
org.eclipse.m2e.logback.configuration: Logback config file: /home/alexq/eclipse-workspace/.metadata/.plugins/org.eclipse.m2e.logback.configuration/logback.1.8.3.20180227-2137.xml
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [bundleresource://496.fwk1693003105:1/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [bundleresource://496.fwk1693003105:2/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [ch.qos.logback.classic.util.ContextSelectorStaticBinder]
org.eclipse.m2e.logback.configuration: Initializing logback
/home/alexq/eclipse/4.7.3a-oxygen/-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.
-------------------------------------------
Comment 3 Eclipse Genie CLA 2022-08-04 08:46:54 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.