Skip to main content



      Home
Home » Language IDEs » Java Development Tools (JDT) » Java Code Formatter from command line
Java Code Formatter from command line [message #244212] Mon, 04 June 2007 07:25 Go to next message
Eclipse UserFriend
Originally posted by: stefan.bley.dd.gmx.de

Hello,

Calling the Java Code Formatter from command line, e.g.

eclipse -application org.eclipse.jdt.core.JavaCodeFormatter -config
c:\temp\my.prefs c:\my_project\src

does work good if I do NOT have Java annotations in my source code. With
annotations, the Code Formatter does not format the code at all, whilst it
does it job when being called within the IDE, e.g. pressing
[Ctrl][Shift][F].

I use Eclipse 3.3RC2. Any ideas?

Stefan
Re: Java Code Formatter from command line [message #244221 is a reply to message #244212] Mon, 04 June 2007 09:04 Go to previous messageGo to next message
Eclipse UserFriend
Stefan Bley a écrit :
> does work good if I do NOT have Java annotations in my source code. With
> annotations, the Code Formatter does not format the code at all, whilst
> it does it job when being called within the IDE, e.g. pressing
> [Ctrl][Shift][F].
> I use Eclipse 3.3RC2. Any ideas?
Are you sure that the file c:\temp\my.prefs contains the options for the
compliance, source level and target level?
Make sure that you have the same values for these three options:
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
--
Olivier
Re: Java Code Formatter from command line [message #244226 is a reply to message #244221] Mon, 04 June 2007 11:00 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: stefan.bley.dd.gmx.de

Olivier Thomann wrote:

> Stefan Bley a écrit :
>> does work good if I do NOT have Java annotations in my source code. With
>> annotations, the Code Formatter does not format the code at all, whilst
>> it does it job when being called within the IDE, e.g. pressing
>> [Ctrl][Shift][F].
>> I use Eclipse 3.3RC2. Any ideas?
> Are you sure that the file c:tempmy.prefs contains the options for the
> compliance, source level and target level?
> Make sure that you have the same values for these three options:
> 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
> --
> Olivier

Hi Olivier,

you are right, I did not add these lines. Thank you!
It would be nice if one could omit the config file, so that the Code
Formatter uses the active profile (under Preferences -> ...)

Stefan
Re: Java Code Formatter from command line [message #244234 is a reply to message #244226] Mon, 04 June 2007 13:44 Go to previous message
Eclipse UserFriend
Stefan Bley a écrit :
> you are right, I did not add these lines. Thank you!
> It would be nice if one could omit the config file, so that the Code
> Formatter uses the active profile (under Preferences -> ...)
Getting the active profile would require some UI code. The code
formatter itself has no idea that formatter profiles exist. It is purely
based on Core code.
--
Olivier
Previous Topic:Eclipse Summit Europe 2007
Next Topic:Misleading compiler error on single line if statement
Goto Forum:
  


Current Time: Fri May 16 09:37:35 EDT 2025

Powered by FUDForum. Page generated in 0.03822 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top