Any command line format tool available for java file?

We are working on a legacy system (7 years old), with lots of java/jsp files that have never been formatted before, not reader at all. Because we have many old versions, we are afraid that we won't be able to effectively diff unformatted and formatted files anymore if we format them.

Are there any command line format tools available with which we can format the old version of the file before doing diff on the new?

Asked by: Julian586 | Posted: 23-01-2022

Answer 1

It's been a while, but we used to use Jalopy. I'm fairly certain you can run it from the command line.

Answered by: Melissa498 | Posted: 24-02-2022

Answer 2

Perhaps Artistic Style will work for you.

I have also Uncrustify in my bookmarks, never used it.

Answered by: Marcus289 | Posted: 24-02-2022

Answer 3

Both Eclipse and IntelliJ have ignore-whitespace options in their diff viewers.

Answered by: Owen332 | Posted: 24-02-2022

Answer 4

You can try using eclipse source code formatter from the command line as mentioned here.

Answered by: Melanie133 | Posted: 24-02-2022

Answer 5 has commanline tool.

Answered by: Chester676 | Posted: 24-02-2022

Similar questions

command line - Java println formatting so I can display a table?

How can I utilize System.out.print(ln/f) in a way that will allow me to format my output into a table? If I'm to use printf, what formatting should I specify to achieve the below results? Example table I'd like to print: n result1 result2 time1 time2 ----------------------------------------------------- 5 1000.00 20000.0 10...

java - formatting data from a cmd command

i need to run a CMD command to pull info from a device. i will get a stream of data after running the command. the structure of received data is as follows date(mm-dd) time(hh:mm:ss.SS) int int String String: String i want to write a java program to run the CMD command ( i`ve got this part covered) and preferably put each part of the received data in a variable and and in a hash map. then ...

StAX XML formatting in Java

Is it possible using StAX (specifically woodstox) to format the output xml with newlines and tabs, i.e. in the form: <element1> <element2> someData </element2> </element1> instead of: <element1><element2>someData</element2></element1> If this is not possible in woodstox, is there any other lightweight libs that can do this?

java - Jlabel HTML formatting

I have a JLabel which has an e-mail address in it. I used HTML formatting on the JLabel, so it appears as a link. However, you are not able to click the link. In fact, you cannot select any of the text in the label. Is there a property that I can set on the JLabel to allow the user to at least select the text of the e-mail, and preferably to click on the e-mail address the way they would on a webpage? My code for m...

Java date formatting?

I want to read a date in the format YYYY-MM-DD. But if I enter date say for example 2008-1-1, I want to read it as 2008-01-01. Can anybody help me? Thanks in advance

java - What's the best design pattern for formatting numbers?

I need to write the code that would format the value according to the specified options. Right now there is several formatting options that can be chosen: rounding/truncating the number with the specified precision, added prefix (e.g $) or postfix (e.g. %), grouping thousands (applying commas), adding numeric abbreviations (KMB). So e.g. number 1857 could be displayed as $2K or $1.86K or $ 1,867 At...

formatting - Java: Format number in millions

Is there a way to use DecimalFormat (or some other standard formatter) to format numbers like this: 1,000,000 => 1.00M 1,234,567 => 1.23M 1,234,567,890 => 1234.57M Basically dividing some number by 1 million, keeping 2 decimal places, and slapping an 'M' on the end. I've thought about creating a new subclass of NumberFormat but it looks trickier than ...

java - BIRT Formatting Legend of a bar chart

I have a small problem, a BIRT report I designed uses a bar chart. Now I want to increase the space between colored box and the text in the legend. Is that possible? (I'm using BIRT 2.1.3) EDIT: I forgot to mention I am using BIRT 2.1.3 with the RCP De...

java - Formatting orb tags in MVEL

How to remove the whitespace line generated by @code{}, @if{}, @foreach{}, @end{} etc or Tags in the result of MVEL 2.0 templating?

formatting - Java: Currency to Locale Mapping Possible?

I have a value stored in a DB correlating to a monetary amount, say 10.0. I also have access to the Currency/CurrencyCode. How can I use NumberFormat/DecimalFormat/(other?) to format when I don't know the Locale? According to the docs it will pick a default locale which won't work with a foreign Currency.

jsp - Formatting file sizes in Java/JSTL

This question already has answers here:

java printing on paper - formatting output for print

I have a java desktop application with information about several entities. There is a "print" button than WHEN pressed various information should be collected and printed. The question is: How can i select WHAT will be printed ON a specific location on the paper? A more general question would be: How can i format information to be printed on paper?

Still can't find your answer? Check out these amazing Java communities for help...

Java Reddit Community | Java Help Reddit Community | Java Community | Java Discord | Java Programmers (Facebook) | Java developers (Facebook)