\documentclass[a4paper, 10pt]{article}
\usepackage[T1]{fontenc}
\usepackage{url}

\usepackage{graphicx}
\usepackage[margin=0.9in]{geometry}
\usepackage{url}
\usepackage{hyperref}
\usepackage{listings}
\usepackage{xspace}
\setlength{\parindent}{0mm}
\setlength{\parskip}{1mm}
\newcommand{\commentout}[1]{}

\begin{document}

% \VignetteEngine{knitr::knitr}
% \VignetteIndexEntry{A package with useful libraries for Java GUIs}

\title{CommonJavaJars - A package with useful libraries for Java GUIs} 

\author{Kornelius Rohmeyer}

%\maketitle

<<echo=FALSE,results='hide'>>=

options(width=140)
options(prompt=" ", continue=" ")
options(digits=4)

@

\section*{CommonJavaJars - A package with useful libraries for Java GUIs}

To reduce the package size of other R packages with Java GUIs and to reduce jar
file conflicts, this package provides a few commonly used Java libraries.

You should be able to load them by calling the rJava \texttt{.jpackage} function
(a good place is most likely the \texttt{.onLoad} function of your package):

<<echo=TRUE,eval=F>>=

.jpackage("CommonJavaJars", jars=c("forms-1.2.0.jar", "iText-2.1.4.jar"))

@

But since the version numbers of the jar files in CommonJavaJars can change,
best practice is to use the function \texttt{loadJars} and to specify only an
unambiguous part of the name, if there are no reasons not to use the latest
version:

<<echo=TRUE,eval=F>>=

loadJars(c("forms", "iText"))

@

We provide the following Java libraries:
\begin{itemize}
 \item Apache Commons Logging under the Apache License, Version 2.0, January 2004, \url{http://commons.apache.org/logging/}, Copyright 2001-2007 The Apache Software Foundation 
 \item Apache jog4j under Apache License 2.0, \url{http://logging.apache.org/log4j/}, Copyright 2007 The Apache Software Foundation
 \item Apache Commons Lang under  Apache License 2.0, \url{http://commons.apache.org/lang/}, Copyright 2001-2011 The Apache Software Foundation
 \item Apache Commons Collections under the Apache License, Version 2.0, January 2004, \url{http://commons.apache.org/collections/}, Copyright 2001-2008 The Apache Software Foundation
 \item Apache Commons Validator under the Apache License, Version 2.0, January 2004, \url{http://commons.apache.org/validator/}, Copyright 2001-2010 The Apache Software Foundation
 \item Apache Commons IO under the Apache License, Version 2.2 (last compatible with JDK 1.5), 2004, \url{http://commons.apache.org/io/}, Copyright 2002-2012 The Apache Software Foundation
 \item JLaTeXMath under GPL >= 2.0, \url{http://forge.scilab.org/index.php/p/jlatexmath/}, Copyright 2004-2007, 2009 Calixte, Coolsaet, Cleemput, Vermeulen and Universiteit Gent
 \item iText 2.1.4 under LGPL, \url{http://itextpdf.com/}, Copyright by Bruno Lowagie 
 \item SwingWorker under LGPL, \url{https://java.net/projects/swingworker/}, Copyright (c) 2005 Sun Microsystems 
 \item JXLayer under BSD License, \url{https://java.net/projects/jxlayer/}, Copyright 2006-2009, Alexander Potochkin 
 \item JGoodies Forms and Commons under BSD License, \url{http://www.jgoodies.com/freeware/libraries/forms/}, Copyright JGoodies Karsten Lentzsch  
 \item JSON Processing dual licensed under CDDL 1.1 and GPL 2 with Classpath Exception, \url{https://jsonp.java.net/}, Copyright (c) 2011-2013 Oracle
 \item AFCommons under the LGPL >= 2.1, \url{https://github.com/kornl/afcommons/}, Copyright (c) 2007-2014 by Kornelius Rohmeyer, Bernd Bischl, Santhosh Kumar T (ComponentTitledBorder class), Jerry Huxtable (filter code), Sebastian Haufe (JListDnD class), Romain Guy (Star class), Oracle (CloseTabPanel)
 \item JHLIR under BSD License, \url{http://jhlir.r-forge.r-project.org/}, Copyright (c) 2008-2010 by Bernd Bischl and Kornelius Rohmeyer  
 \item JRIEngine and REngine under LGPL-2.1, \url{http://www.rforge.net/rJava/},
 Copyright 2010 by Simon Urbanek. Please use these two jar files only if
 package rJava does not provide them.
\end{itemize}

Please note that we only recommend to use JRIEngine and REngine from this
package if the rJava version is less than 0.8-3.
Otherwise the package rJava provides these jar files.

\scriptsize
<<echo=TRUE,eval=FALSE>>=
# The following few lines are based on the code of the rJava .jpackage function
if (!is.null(sessionInfo()$otherPkgs$rJava$Version) && sessionInfo()$otherPkgs$rJava$Version < "0.8-3") {
	classes <- system.file("R28", package = "CommonJavaJars", lib.loc = NULL)
	if (nchar(classes)) {
		.jaddClassPath(classes)
		jars <- grep(".*\\.jar", list.files(classes, full.names = TRUE), TRUE, value = TRUE)
		if (length(jars)) { 
			.jaddClassPath(jars)
		}		
	}
}
# Otherwise load from rJava. 
@
\normalsize
	
\end{document}
