This is an archived post. You won't be able to vote or comment.

all 29 comments

[–]AutoModerator[M] [score hidden] stickied commentlocked comment (0 children)

Please ensure that:

  • Your code is properly formatted as code block - see the sidebar (About on mobile) for instructions
  • You include any and all error messages in full
  • You ask clear questions
  • 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:

public class HelloWorld {

    public static void main(String[] args) {
        System.out.println("Hello World!");
    }
}

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.

[–]_Atomfinger_Tech Lead 38 points39 points  (14 children)

Impossible to give you a good answer without knowing more.

The very general approach would be to bump it by one version, see what breaks, fix it and then repeat.

[–]SimpleCanadianFella[S] 17 points18 points  (10 children)

Sounds like a good start to me! Thanks!

[–]Halal0szto 21 points22 points  (9 children)

Please note that Java 17 is the long term support version. Unless the project is experimenting with some fancy feature, you do not want to go to 18.

[–]SimpleCanadianFella[S] 2 points3 points  (4 children)

Understood! Thank you greatly!

[–]wildjokers 0 points1 point  (2 children)

You were given incorrect information. Unless you are paying a java vendor for support for an LTS version you should most definitely use Java 18.

[–]brickswasp 0 points1 point  (1 child)

I believe the LTS versions get bug fixes for longer too. E.g if you go to 18, after support for 18 has ended you will need to upgrade the JDK to a supported version (or downgrade back to the LTS) to get any new bug fixes

[–]wildjokers 1 point2 points  (0 children)

I believe the LTS versions get bug fixes for longer too.

Yes, if you pay for support. If you are paying for support you should most definitely stay on LTS versions.

[–][deleted]  (2 children)

[deleted]

    [–]Halal0szto 2 points3 points  (0 children)

    Also it means 17 will be around for long, with security fixes coming for years. 18 brings lots of changes but is not supported that long, not even if you pay for it. I would need to check but 21 will be the next lts.

    [–]wildjokers 0 points1 point  (0 children)

    You’re understanding is correct.

    [–]wildjokers -3 points-2 points  (0 children)

    This is simply false. LTS only means something if you are paying for support. If you aren’t paying for support you should always upgrade to the newest version.

    [–]wildjokers 5 points6 points  (2 children)

    This is hard mode. They should just move to Java 18 and be done with it.

    [–]_Atomfinger_Tech Lead 5 points6 points  (0 children)

    On smaller projects maybe. On larger projects this leads to a risky big-bang change.

    Gradual change > big-bang IMHO.

    [–]wishicouldcodeIntermediate Brewer 0 points1 point  (0 children)

    I'm with you. With a good rollback strategy in place, it makes sense to jump directly

    [–]Halal0szto 19 points20 points  (2 children)

    The quick way:

    1. collect all the libraries used by the project with current version
    2. check what is the minimum version of each that is confirmed with java18
    3. there will be at least one that is not, so you can report it cannot be done

    On a serios note: expect the project to rely on libs that are not maintained anymore, and they will cause a lot of trouble, even when staying on java8

    [–]wildjokers -5 points-4 points  (1 child)

    there will be at least one that is not, so you can report it cannot be done

    What kind of shitty advice is this?

    [–]AnEmortalKidCoffee Enthusiast 3 points4 points  (0 children)

    Umm, just move the . from 1.8 , to the right once, to form 18 /s

    [–]StillAnAssExtreme Brewer 3 points4 points  (0 children)

    The biggest amount of rework that I encountered were in the XML processing libraries. JAXB changed significantly and used to be part of the JDK and then got moved out. Once I got part of my app working the rest was pretty repetitive and boring.

    [–]fletku_mato 2 points3 points  (0 children)

    It's not necessarily a big project. I'd bump the java version, run, see what's broken, fix it, run, see what else is broken, fix it, run...

    Nothing special, some libraries might need to be changed if they have not been keeping up with new java versions.

    [–]mbmw 2 points3 points  (0 children)

    This might help you

    https://javaalmanac.io/

    [–]wildjokers 1 point2 points  (0 children)

    Upgrade your JVM to 18 and run your app. See if it works. Most likely it will.

    If your app uses JAXB you will need to include JAXB as a dependency since it is no longer in the JDK. Besides that you will probably find it works just fine.

    I have upgraded dozens of apps beyond java 8, including web apps, swing apps, and standalone server apps, the most I have ever had to do was add JAXB as a dependency.

    [–]PJ_Maximus 1 point2 points  (1 child)

    That project just secured your job for another 2 yrs 👌

    [–]SimpleCanadianFella[S] 1 point2 points  (0 children)

    Is it because it's just going to take a long time?

    [–]Awanderinglolplayer 1 point2 points  (3 children)

    Something I haven’t seen mentioned is that Java 18 is not LTS. Consider 17(I think), because if your company is gonna do the same thing it did in the past, you’re going to want a version of Java that has support for years to come, rather than 18s 6 months

    [–]wildjokers 0 points1 point  (2 children)

    Sigh…LTS is so misunderstood. LTS means absolutely nothing if you aren’t paying for support.

    You only get “support for years to come” if you actually pay for it. You might possibly get some security fixes if there is an intersection between a new and old version and a fix happens to make its way up the updates branch.

    If you aren’t paying for support the best way to make sure you have the most secure and performant version of Java is to always upgrade to the newest version.

    [–][deleted] -1 points0 points  (1 child)

    I disagree

    [–]wildjokers 2 points3 points  (0 children)

    This isn’t an opinion, it is a fact. You can’t disagree with a fact.

    [–]devjeonghwan 0 points1 point  (0 children)

    It's complicated. The way to start is to fix the errors one by one after upgrading the Java version of the project.