Development/Java

LibreOffice contains various pieces of code written in Java. Some of these pieces are currently being replaced/rewritten, but it is likely that LibreOffice will contain Java code for quite some time.

What pieces of LibreOffice are written in Java?
Some basic GNU/Linux tools can be run over the source code to report on various aspects relating to Java usage. Each example command below has been run against an extracted copy of the v4.2.6.3 archived (tar/7z) source tree.

Which directories contain *.java files?
It is worth routing the output from the  command to a text file for later (as required) post-processing.

Output from the above sed/awk/sort commands gives only the first level directory:

Note though that very little of this Java code is actually part of the shipped product. Most of these lines of code are actually only testcode from the $MODULE/qa subdirectory. A more relevant analysis would exclude that subdirectories as they are never shipped with the product. Doing this on a ~recent checkout of master@64914e407ccac91fbbaa5022a6854be9a01027f8: shows (with some resorting) this:

For a comprehensive list of directories:

Output (first few lines) from the above sed/awk/sort commands:

For the complete list, please see Development/Java/Directories containing .java files

How many lines of java source code in each main directory?
It is worth routing the output from  to a text file for later (as required) post-processing.

Output from above grep/sed/sort commands:

Java use (as a percentage) in each LibreOffice end-of-train release, is also available in the Ask thread Is there any plan to ditch Java in the future and use only C/C++ code?. Note though that very little of this Java code is actually part of the shipped product. Most of these lines of code are actually only testcode from the $MODULE/qa subdirectory. A more relevant analysis would exclude that subdirectories as they are never shipped with the product.

Which directories contain *.jar files?
Output from above find/sort commands:

Building LibreOffice without Java
Compile LibreOffice with the flag
 * Detailed notes on disabling java and then building

Suggestion to Remove Java Components
Per Development/Crazy Ideas,

''Some think java is a slow memory hog, others think it is a legal swamp that invites lawsuits. Neither might be true, but some developers have nevertheless expressed their desire to remove Java usage in LO over time.''

Resources

 * See an overview of all code in LO on page Development/Code Overview.
 * Also see https://docs.libreoffice.org