Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using Java Source Code in my own project [closed]

I wrote a program in Java 6.0, but it turns out that some of our client only have 5.0.

The issues is that lot of features that 6.0 has was not in 5.0 yet. For example:

  • JTable Sorting, Filtering feature
  • SwingWorker class

My Question is :

  1. is it legal to just copy the java 6.0 source code to my own project so that my client with 5.0 jre can run it.
  2. from technical point of view, is it hard to copy the classes source code like TableRowSorter, regexFilter to my own project and let it work?

Thanks

like image 519
Leon Avatar asked Aug 01 '26 19:08

Leon


2 Answers

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.

like image 76
Thorbjørn Ravn Andersen Avatar answered Aug 03 '26 14:08

Thorbjørn Ravn Andersen


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.

like image 35
DJClayworth Avatar answered Aug 03 '26 14:08

DJClayworth



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!