Have a look at this page. I think the other way to get ANT to run specified JDK may be to specify in the build.xml
https://stackoverflow.com/questions/949678/ant-is-using-wrong-java-version Z. https://www.backbutton.co.uk/ ¯\_(ツ)_/¯ ♡۶♡۶ ♡۶ On Thu, 21 Jan 2021, 11:53 Zahid Rahman, <zahidr1...@gmail.com> wrote: > > Although, JDK8 appears before JDK15 in the System's PATH variable > > > I don't think you should have two JDKs > in the PATH environment variable. It is a but messy. > > *ANT picks JDK 15 and compilation fails*. > > It looks like ant build script is picking up from PATH. > > if you run java - version get jdk 15 then you are probably picking up > jdk 15 from PATH. > > Why the project is not picking up JDK > from project.properties. > Don't know I don't use ANT much. > > > If you are having more than one netbeans IDE on the same machine then > netbeans.conf is provided so that you can point to the preferred jdk for > that IDE. > > > > Z. > > https://www.backbutton.co.uk/ > ¯\_(ツ)_/¯ > ♡۶♡۶ ♡۶ > > On Thu, 21 Jan 2021, 11:13 Karan Agrawal, <karan....@gmail.com> wrote: > >> Yes Zahid. >> >> The point is - I would be using Netbeans for Java 11+ projects as well. >> Although, JDK8 appears before JDK15 in the System's PATH variable >> >> If I make a change in netbeans.conf, then I will have to start at least 2 >> instances of netbeans and also install nb-javac (probably) >> >> On Thu, Jan 21, 2021 at 4:24 PM Zahid Rahman <zahidr1...@gmail.com> >> wrote: >> >>> Just a guess. >>> >>> Do you have JDK 15 installed and included in the windows 10 environment >>> PATH variable ? >>> >>> >>> >>> >>> Z. >>> >>> https://www.backbutton.co.uk/ >>> ¯\_(ツ)_/¯ >>> ♡۶♡۶ ♡۶ >>> >>> On Thu, 21 Jan 2021, 10:45 Karan Agrawal, <karan....@gmail.com> wrote: >>> >>>> Hello Experts, >>>> >>>> I have migrated from Netbeans 8.0 to Apache Netbeans 12.2 >>>> >>>> My Java Projects uses JDK 8 with ANT. >>>> Therefore, after opening the projects in Netbeans 12.2, I have added >>>> JDK8 in the platform and updated *Project Properties* accordingly. >>>> >>>> With Netbeans 12.2, when "clean and build" is triggered, *ANT picks >>>> JDK 15 and compilation fails*. >>>> *Q.* How to make *ANT* pick the JDK mapped to the project in >>>> project.properties? >>>> >>>> *System Details* >>>> >>>> *Product Version:* Apache NetBeans IDE 12.2 >>>> >>>> *Updates:* NetBeans IDE is updated to version NetBeans 8.2 Patch 2 >>>> <http://wiki.netbeans.org/NetBeans8.2PatchesInfo> >>>> >>>> *Java:* 15.0.1; Java HotSpot(TM) 64-Bit Server VM 15.0.1+9-18 >>>> >>>> *Runtime:* Java(TM) SE Runtime Environment 15.0.1+9-18 >>>> >>>> *System:* Windows 10 version 10.0 running on amd64; Cp1252; en_US (nb) >>>> >>>> *User directory:* C:\Users\xxx\AppData\Roaming\NetBeans\12.2 >>>> >>>> *Cache directory:* C:\Users\xxx\AppData\Local\NetBeans\Cache\12.2 >>>> >>>> *ANT_HOME:* <PATH>\extide\ant >>>> >>>> *PS:* netbeans.conf is one option, but looking for a better >>>> alternative. >>>> >>>> Thanks, >>>> Karan >>>> >>>