[R-pkg-devel] Making possible the use of external java codes by downloading it

Rainer M Krug R@|ner @end|ng |rom krug@@de
Fri Jul 3 11:15:31 CEST 2020


Pleas keep the list in CC so that they know tat you have a solution. Thanks.

There is the function “Sys.which()” which returns the full path to an executable. Although in many cases correct, it can be that Java is installed but not in the path. So I have a variable called “java.path” which is used when java is called - the default is set to `java.path <- Sys.which("java”)`

Plesase see https://github.com/rkrug/plantuml/blob/dev/R/aaa.R <https://github.com/rkrug/plantuml/blob/dev/R/aaa.R> and https://github.com/rkrug/plantuml/blob/dev/R/options.R <https://github.com/rkrug/plantuml/blob/dev/R/options.R> how I implemented it.



> On 3 Jul 2020, at 11:09, Paul SAVARY <paul.savary using univ-fcomte.fr> wrote:
> 
> I thank you Rainer.
> 
> Then, I think I will allow users to download the .jar file from an url into the user data directory.
> I get the path to this directory with "rappdirs::user_data_dir()".
> 
> Do you know how to check if java is installed on their machine?
> 
> I thought about using something like that:
> 
> jv <- system2("java", args = c("-version"))
> if(jv != 0){
>   stop("You have to install java on your machine.")
> }
> 
> Cheers
> Paul
> 
> De: "Rainer M Krug" <Rainer using krugs.de>
> À: "Paul SAVARY" <paul.savary using univ-fcomte.fr>
> Cc: "r-package-devel" <r-package-devel using r-project.org>
> Envoyé: Vendredi 3 Juillet 2020 10:33:15
> Objet: Re: [R-pkg-devel] Making possible the use of external java codes by downloading it
> 
> Please check out the recent thread "Proper CRAN way - How to handle dependency of java jar file?” About a week ago - I asked essentially the same questions.
> 
> Cheers,
> 
> Rainer
> 
> 
> 
> On 3 Jul 2020, at 10:15, Paul SAVARY <paul.savary using univ-fcomte.fr <mailto:paul.savary using univ-fcomte.fr>> wrote:
> 
> Hello everyone,
> 
> I would like to include external java codes (.jar files) to a package in order to speed up some computations.
> However, this would increase the package size above 5 Mb and this code would not be working for users without java installation. 
> 
> Instead, I could include a default parameter in the function calling another R package making the same computation but more slowly. It would be best for users without java on their computer.
> Besides, I could allow users to download the external java code from a stable url, and include in the R function all the arguments to launch this java code (wrapper for the java code). When downloaded, the jar file should be copied directly into the extdata directory in the user computer if possible.
> 
> Does it seem feasible to you? 
> 
> Many thanks 
> Regards
> Paul
> 
> ______________________________________________
> R-package-devel using r-project.org <mailto:R-package-devel using r-project.org> mailing list
> https://stat.ethz.ch/mailman/listinfo/r-package-devel <https://stat.ethz.ch/mailman/listinfo/r-package-devel>
> 
> --
> Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology, UCT), Dipl. Phys. (Germany)
> 
> Orcid ID: 0000-0002-7490-0066
> 
> Department of Evolutionary Biology and Environmental Studies
> University of Zürich
> Office Y34-J-74
> Winterthurerstrasse 190
> 8075 Zürich
> Switzerland
> 
> Office:	+41 (0)44 635 47 64
> Cell:       	+41 (0)78 630 66 57
> email:      Rainer.Krug using uzh.ch <mailto:Rainer.Krug using uzh.ch>
> 		Rainer using krugs.de <mailto:Rainer using krugs.de>
> Skype:     RMkrug
> 
> PGP: 0x0F52F982
> 
> 
> 
> 

--
Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology, UCT), Dipl. Phys. (Germany)

Orcid ID: 0000-0002-7490-0066

Department of Evolutionary Biology and Environmental Studies
University of Zürich
Office Y34-J-74
Winterthurerstrasse 190
8075 Zürich
Switzerland

Office:	+41 (0)44 635 47 64
Cell:       	+41 (0)78 630 66 57
email:      Rainer.Krug using uzh.ch
		Rainer using krugs.de
Skype:     RMkrug

PGP: 0x0F52F982




	[[alternative HTML version deleted]]



More information about the R-package-devel mailing list