Probably no, the OpenJDK classes are under GPL meaning you will have to put your sources under GPL too. The Oracle Java classes are also under a "you cannot just do what you want to with our sources", so this is most likely a VERY bad idea.
You can use Retroweaver to make your source work with an earlier version of Java, but I would say that you should make your code work with Java 5, optionally using Java 6 facilities if available, and then say to your customers which things they will get from upgrading.
2021 edit: As of Java 17 the proper solution would be to include a tested JVM as part of your deployment. There is tooling for bringing just what you need.
One question you should ask is: why haven't your clients upgraded to Java 6.0? Since it's free and easy to do they must have a reason, and you should probably find out what it is before sending them code from it.
That depends on the source code you are copying from. From JavaSE? OpenJDK?
Wherever you want to copy from, check their license for the code.
The copying may be simple, copying just the classes and it’s dependencies. There may be a lot of specific dependencies though, which can make it consume a lot of time. And you’ll really have a problem when you have to copy a changed class that already existed in version 5, where you would need one version for some code, and the newer for the other. But if you’re only using Java6 code in that project it should be alright. Moving the classes into another package may also be an option, with potentially a lot of work as well though.
发布评论
评论(3)
可能不会,OpenJDK 类受 GPL 约束,这意味着您也必须将源代码置于 GPL 下。 Oracle Java 类也属于“您不能只用我们的源代码做您想做的事情”,因此这很可能是一个非常糟糕的主意。
您可以使用 Retroweaver 使您的源代码与早期版本的 Java 兼容,但我想说您应该使您的代码与 Java 5 兼容,可选地使用 Java 6 工具(如果可用),然后告诉您的客户他们将得到哪些东西从升级。
2021 年编辑:从 Java 17 开始,正确的解决方案是将经过测试的 JVM 作为部署的一部分。有一些工具可以满足您的需求。
Probably no, the OpenJDK classes are under GPL meaning you will have to put your sources under GPL too. The Oracle Java classes are also under a "you cannot just do what you want to with our sources", so this is most likely a VERY bad idea.
You can use Retroweaver to make your source work with an earlier version of Java, but I would say that you should make your code work with Java 5, optionally using Java 6 facilities if available, and then say to your customers which things they will get from upgrading.
2021 edit: As of Java 17 the proper solution would be to include a tested JVM as part of your deployment. There is tooling for bringing just what you need.
您应该问的一个问题是:为什么您的客户端还没有升级到 Java 6.0?因为它是免费且容易做到的,所以他们必须有一个理由,并且您应该在向他们发送代码之前找出它是什么。
One question you should ask is: why haven't your clients upgraded to Java 6.0? Since it's free and easy to do they must have a reason, and you should probably find out what it is before sending them code from it.
这取决于您要复制的源代码。来自JavaSE?开放JDK?
无论您想从哪里复制,请检查其代码许可证。
复制可能很简单,仅复制类及其依赖项。但可能存在很多特定的依赖关系,这可能会消耗大量时间。当您必须复制版本 5 中已存在的已更改的类时,您确实会遇到问题,其中某些代码需要一个版本,而另一个版本则需要较新的版本。但如果您只在该项目中使用 Java6 代码,那应该没问题。将类移动到另一个包中也可能是一种选择,但也可能需要做很多工作。
That depends on the source code you are copying from. From JavaSE? OpenJDK?
Wherever you want to copy from, check their license for the code.
The copying may be simple, copying just the classes and it’s dependencies. There may be a lot of specific dependencies though, which can make it consume a lot of time. And you’ll really have a problem when you have to copy a changed class that already existed in version 5, where you would need one version for some code, and the newer for the other. But if you’re only using Java6 code in that project it should be alright. Moving the classes into another package may also be an option, with potentially a lot of work as well though.