Author Topic: Need to restart SE to change JDK  (Read 1075 times)

rjpontefract

  • Senior Community Member
  • Posts: 250
  • Hero Points: 10
Need to restart SE to change JDK
« on: May 20, 2021, 02:22:32 AM »
I have a java project and have several JDKs defined, including OpenJDK 8 and OpenJDK 11.
I can change the compiler under the project settings|compile/link|compiler drop down to which JDK I want to use to build the project, however I have to restart SE to make it change.  If I leave it running and change it to another JDK, SE continues to build with the previous selection.
I don't believe this is how it's supposed to work, but please let me know if I'm wrong.

patrick

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 1818
  • Hero Points: 151
Re: Need to restart SE to change JDK
« Reply #1 on: May 20, 2021, 02:15:18 PM »
That doesn't sound right.  I'll take a closer look at it this afternoon.  This should be hot-fixable.

Marcel

  • Senior Community Member
  • Posts: 261
  • Hero Points: 26
Re: Need to restart SE to change JDK
« Reply #2 on: May 20, 2021, 03:41:53 PM »
That is my experience as well.  It doesn't bug me all that much since I only switch JDK's about every three months.  While you're fixing the restart thing, could you also make Build->Java Options->JDK path inherit from the JDK selection.

patrick

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 1818
  • Hero Points: 151
Re: Need to restart SE to change JDK
« Reply #3 on: May 24, 2021, 06:16:30 PM »
What type of Java project do you have open?  If it's Gradle, what version of Gradle are you using?

I half suspect Gradle only because the logic for communicating the Java version is different from other project types and other Gradle plugins.  It looks like we're setting the environment right when I change the compiler version, but I think with some older versions of Gradle, it could sometimes pick a daemon that was configured with the previous version.   It could be we need to clear out existing daemons on a hook when the compiler is changed for a project.


rjpontefract

  • Senior Community Member
  • Posts: 250
  • Hero Points: 10
Re: Need to restart SE to change JDK
« Reply #4 on: May 24, 2021, 08:38:40 PM »
Hi Patrick

It's not a gradle project, just a bunch of Java files added to a normal SE java project.   

patrick

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 1818
  • Hero Points: 151
Re: Need to restart SE to change JDK
« Reply #5 on: May 24, 2021, 09:12:36 PM »
Ahh.  I looked at that project type initially and didn't see a problem.  But I missed a detail.  If I pick the JDK 1.8.0 or JDK 1.11 entries, it builds a path to the correct jdk location.  But when I pick the "Default Compiler" entry, it incorrectly uses the Java in PATH.  On my system, that happened to be the same as the default.   It's not consistent, sometimes repeating builds will get it to switch to the correct path, sometime restarting, sometimes not.

So I've got an area to look at.   Thanks for the clarification.

patrick

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 1818
  • Hero Points: 151
Re: Need to restart SE to change JDK
« Reply #6 on: May 25, 2021, 03:38:31 PM »
I've put in a fix for the unreliable per-project JDK version setting.  It will be in the first v25.0.2 hotfix. 

rjpontefract

  • Senior Community Member
  • Posts: 250
  • Hero Points: 10
Re: Need to restart SE to change JDK
« Reply #7 on: May 26, 2021, 12:10:18 AM »
Thanks Patrick, good to hear there's a fix.