将tools.jar与Java应用程序包一起分发是否安全? [英] Is it safe to distribute tools.jar along with a Java application bundle?

查看:138
本文介绍了将tools.jar与Java应用程序包一起分发是否安全?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

虽然 tools.jar 不是JRE中的组件,但它带有JDK的所有主要实现,例如Oracle JDK和OpenJDK。

Although tools.jar is not a component in JRE, but it comes with all major implementations of JDK such as Oracle JDK and OpenJDK.

不是JRE的标准组件意味着当我分发使用 tools.jar 的Java应用程序时,我必须将它与应用程序一起分发捆绑或包含在类路径中。

Not being standard component of JRE means that when I distribute a Java application which uses tools.jar, I have to distribute it along with the application bundle OR include it in classpath.

我的问题是:


  • 是否有工具.jar包含依赖于平台的组件,阻止它分布在不同的平台上(Windows / Linux / OSX)?

  • 我们已经知道Oracle JDK不允许分发 tools.jar ,但是OpenJDK怎么样,我们可以从OpenJDK分发tools.jar以避免许可问题吗?

  • 如果tools.jar不能分发有一个Java应用程序,是否有一种独立于平台的方法来确定它的位置,以便它可以放入类路径?

  • Does tools.jar contain platform-dependent components that prevent it from being distributed across different platforms (Windows/Linux/OSX)?
  • We already know that Oracle JDK does not allow distribution of tools.jar, but what about OpenJDK, can we distribute tools.jar from OpenJDK to avoid licensing issue?
  • If tools.jar cannot be distributed along with a Java application, is there a platform-independent way to determine its location, so that it can be put into classpath?

推荐答案

简答: 不能从Oracle JDK或从中重新分发 tools.jar OpenJDK没有重新分发整个捆绑包。

Short Answer: You cannot redistribute just tools.jar either from Oracle JDK or from OpenJDK without redistributing whole bundle.

详细答案如下:

阅读后几个互联网上的文章,以下是我对你的问题的调查结果:

After reading few articles over internet, below are my findings about your questions:


tools.jar是否包含阻止它的平台相关组件
从不同平台(Windows / Linux / OSX)分发?

Does tools.jar contain platform-dependent components that prevent it from being distributed across different platforms (Windows/Linux/OSX)?

没有为定义标准依赖项的tools.jar 。我编写了一个在Unix和Windows机器上运行完美的示例程序。我已将 tools.jar 从Windows机器复制到Unix机器。一切正常。

There is no standard dependency defined for tools.jar. I have written a sample program which runs perfectly on the Unix and Windows machines. I have copied tools.jar from a Windows machine to a Unix machine. Everything works fine.


我们已经知道Oracle JDK不允许分发
tools.jar,但是OpenJDK怎么样,我们可以分发工具吗? .jar来自
OpenJDK以避免许可问题?

We already know that Oracle JDK does not allow distribution of tools.jar, but what about OpenJDK, can we distribute tools.jar from OpenJDK to avoid licensing issue?




  • 为了分发 tools.jar ,你必须使用包含工具的javac字节码编译器重新分发整个 Oracle JDK或整个JRE的.jar ;允许再分发与您的应用程序捆绑。

  • 重新分发的JDK或JRE必须完整且未经修改(减去可以添加和/或减去的内容的几个部分) 。

  • 您永远不能重新发布测试版。

  • 您遵守 license

    • In order to distribute tools.jar, you must redistribute the entire Oracle JDK, OR the entire JRE with just "The javac bytecode compiler" which includes tools.jar; that redistribution is allowed to be "bundled" with your app.
    • Redistributed JDK or JRE must be "complete and unmodified" (minus a couple sections about things you can add and/or subtract).
    • You can never redistribute beta versions.
    • You comply with the other general terms covered in the redistribution section of the license.
    • 来源: 我们可以吗?重新分发Oracle tools.jar?
      Oracle JDK许可证: http://www.oracle.com/technetwork/java/javase/readme-142177.html#redistribution


      如果tools.jar不能与之一起发布一个Java应用程序,
      有一个独立于平台的方法来确定它的位置,所以它可以将
      放入类路径吗?

      If tools.jar cannot be distributed along with a Java application, is there a platform-independent way to determine its location, so that it can be put into classpath?

      OpenJDK 带有GNU通用公共许可证,版本2,与Classpath异常。 GPL v2许可软件的被许可人可以:

      OpenJDK carries GNU General Public License, version 2, with the Classpath Exception. A licensee of GPL v2-licensed software can:


      • 复制并分发程序的未修改源代码(第1节)

      • 修改程序的源代码并分发修改后的源代码(第2节)

      • 分发程序的编译版本,包括修改版本和未修改版本(第3节),条件是:


        • 所有分发的副本(修改或未修改)都带有版权声明并且不包括保修(第1节和第2节)

        • 全部修改后的副本根据GPL v2(第2节)分发

        • 该程序的所有编译版本都附有相关的源代码,或提供相关源代码的可行提议(Section 3)

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

          您可以在 GNU通用公共许可证v2 - 概述

          更新:定位&将 tools.jar 添加到类路径中。

          UPDATE: Locate & add tools.jar into classpath.

          如果最终用户使用JDK运行应用程序,您将获得需要 tools.jar 自动。如果没有,那么你需要建议用户安装 JDK

          If the end user is running the application using JDK, you will get the desired tools.jar automatically. If not, then you need to suggest the user to install JDK.

          要通过程序检查这一点,你可以使用Eclipse JDT JAR。下面的代码显示了如何在JVM中找到当前JDK / JRE的绝对路径,以及如何将JAR添加到 classpath

          To check this through the program, you can make use of Eclipse JDT JARs. Below code shows how to locate the absolute path of the current JDK/JRE in JVM, and also to add the JAR to 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);
          

          资料来源:以编程方式启动Java应用程序

          您可以在这里查看tools.jar是否为不存在然后显示消息,否则以编程方式将其添加到类路径。

          You can check if here if tools.jar is not present then show the message, else add it to the classpath programatically.

          Shishir

          这篇关于将tools.jar与Java应用程序包一起分发是否安全?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆