jvm - Is it safe to distribute tools.jar along with a Java application bundle? -


although tools.jar not component in jre, comes major implementations of jdk such oracle jdk , openjdk.

not being standard component of jre means when distribute java application uses tools.jar, have distribute along application bundle or include in classpath.

my questions are:

  • does tools.jar contain platform-dependent components prevent being distributed across different platforms (windows/linux/osx)?
  • we know oracle jdk not allow distribution of tools.jar, openjdk, can distribute tools.jar openjdk avoid licensing issue?
  • if tools.jar cannot distributed along java application, there platform-independent way determine location, can put classpath?

short answer: cannot redistribute tools.jar either oracle jdk or openjdk without redistributing whole bundle.

detailed answer below:

after reading few articles on internet, below findings questions:

does tools.jar contain platform-dependent components prevent being distributed across different platforms (windows/linux/osx)?

there no standard dependency defined tools.jar. have written sample program runs on unix , windows machines. have copied tools.jar windows machine unix machine. works fine.

we know oracle jdk not allow distribution of tools.jar, openjdk, can distribute tools.jar openjdk avoid licensing issue?

  • in order distribute tools.jar, must redistribute entire oracle jdk, or entire jre "the javac bytecode compiler" includes tools.jar; redistribution allowed "bundled" app.
  • redistributed jdk or jre must "complete , unmodified" (minus couple sections things can add and/or subtract).
  • you can never redistribute beta versions.
  • you comply other general terms covered in redistribution section of license.

source: can redistribute oracle tools.jar? oracle jdk license: http://www.oracle.com/technetwork/java/javase/readme-142177.html#redistribution

if tools.jar cannot distributed along java application, there platform-independent way determine location, can put classpath?

openjdk carries gnu general public license, version 2, classpath exception. licensee of gpl v2-licensed software can:

  • copy , distribute program’s unmodified source code (section 1)
  • modify program’s source code , distribute modified source (section 2)
  • distribute compiled versions of program, both modified , unmodified (section 3) provided that:
    • all distributed copies (modified or not) carry copyright notice , exclusion of warranty (section 1 , 2)
    • all modified copies distributed under gpl v2 (section 2)
    • all compiled versions of program accompanied relevant source code, or viable offer make relevant source code available (section 3)

you can more details of gpl v2 @ the gnu general public license v2 - overview


update: locate & add tools.jar classpath.

if end user running application using jdk, desired tools.jar automatically. if not, need suggest user install jdk.

to check through program, can make use of eclipse jdt jars. below code shows how locate absolute path of current jdk/jre in jvm, , add jar classpath.

ivminstall jre = javaruntime.getdefaultvminstall();          file jdkhome = jre.getinstalllocation(); ipath toolspath = new path(jdkhome.getabsolutepath())        .append("lib")        .append("tools.jar"); iruntimeclasspathentry toolsentry =    javaruntime.newarchiveruntimeclasspathentry(toolspath); toolsentry.setclasspathproperty(iruntimeclasspathentry.user_classes); 

source: launching java applications programmatically

you can check if here if tools.jar not present show message, else add classpath programatically.

shishir


Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -