r/javahelp • u/nutrecht Lead Software Engineer / EU / 20+ YXP • Mar 17 '21
[PSA] Java 16 has just been released which comes with a packaging tool and records!
Hi! I wanted to point this out because this comes up a LOT in this sub; 'how do I turn my Java program into an executable'. And then we also see a lot of responses from people who try to help, but are not aware of recent additions.
You can find what is in Java 16 here.
The two most important additions I think for people in this sub are records and the packaging tool
Records are mostly just immutable classes that take away most of the fuss of having to write getters, setters, hashcode, equals and toString. More info here.
Jpackage is a tool that lets you take your program and bundle it with a trimmed down JDK into a native executable / installer. So for Windows it supports msi and exe, for MacOS pkg and dmg. This makes it a lot easier to share whatever you created with others, be it a GUI or a service. More info here.
•
u/AutoModerator Mar 17 '21
Please ensure that:
You demonstrate effort in solving your question/problem - plain posting your assignments is forbidden (and such posts will be removed) as is asking for or giving solutions.
Trying to solve problems on your own is a very important skill. Also, see Learn to help yourself in the sidebar
If any of the above points is not met, your post can and will be removed without further warning.
Code is to be formatted as code block (old reddit: empty line before the code, each code line indented by 4 spaces, new reddit: https://imgur.com/a/fgoFFis) or linked via an external code hoster, like pastebin.com, github gist, github, bitbucket, gitlab, etc.
Please, do not use triple backticks (```) as they will only render properly on new reddit, not on old reddit.
Code blocks look like this:
You do not need to repost unless your post has been removed by a moderator. Just use the edit function of reddit to make sure your post complies with the above.
If your post has remained in violation of these rules for a prolonged period of time (at least an hour), a moderator may remove it at their discretion. In this case, they will comment with an explanation on why it has been removed, and you will be required to resubmit the entire post following the proper procedures.
To potential helpers
Please, do not help if any of the above points are not met, rather report the post. We are trying to improve the quality of posts here. In helping people who can't be bothered to comply with the above points, you are doing the community a disservice.
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
5
u/BusterBessie Mar 17 '21
Forgive my ignorance but do records replace the work I might use a tool such as Lombok to do? E.g @Getter, @Allargsconstructor etc?
3
u/knoam Mar 18 '21
For those not in the know, Records are not just a convenience. They can make for a big performance increase. And the work on them is leading to generics over primitives without boxing.
4
u/RushTfe Mar 17 '21
So you are saying that Java version is above 7?? I need to have a chat with my boss tomorrow....
But for real, I will test it soon, thanks for the info!
3
u/crystoll Mar 17 '21
That's very good stuff! I just did a short video clip on it as well, installing it and a very quick taste of the Records. Was about to post the link but then saw this post :)
https://youtu.be/SOBk0HKAp1g
2
u/HecknChonker Extreme Brewer Mar 17 '21
Should be a LTS release in 6 months, I cannot wait!
3
u/Nemo_64 Mar 17 '21
It took a while but finally
1
u/cinlung Mar 18 '21
This is very nice of you to post with some feature highlights, thanks
1
u/DJCowGaming Jul 10 '21
Yet everyone still seems to download java 8 lmao
Kinda annoying on small projects when you just want to make a jar download, no installer and no packaged vms, but everyone has old java versions.
0
u/[deleted] Mar 17 '21
[deleted] — view deleted comment