Also set your JAVA_HOME to the Java 8 distribution when running maven
here as many modules in 2.x assume they're compiled via Java 8, not
via toolchains.

On Thu, Apr 21, 2022 at 12:59 PM Mohammed B <[email protected]> wrote:
>
> I still get the same error. This is my toolchains.xml now:
>
> <toolchains>
>   <!-- JDK toolchains -->
>   <toolchain>
>     <type>jdk</type>
>     <provides>
>       <version>14</version>
>       <vendor>sun</vendor>
>     </provides>
>     <configuration>
>       <jdkHome>C:\Program Files\Java\jdk-14.0.1</jdkHome>
>     </configuration>
>   </toolchain>
>   <toolchain>
>     <type>jdk</type>
>     <provides>
>       <version>9</version>
>       <vendor>sun</vendor>
>     </provides>
>     <configuration>
>       <jdkHome>C:\Program Files\Java\jdk-14.0.1</jdkHome>
>     </configuration>
>   </toolchain>
>   <toolchain>
>  <type>jdk</type>
> <provides>
>  <version>8</version>
>  <vendor>eclipse</vendor>
> </provides>
> <configuration>
>  <jdkHome>C:\Program Files\Eclipse Adoptium\jdk-8.0.322.6-hotspot</jdkHome>
> </configuration>
> </toolchain>
> <toolchain>
>  <type>jdk</type>
> <provides>
>  <version>1.8</version>
>  <vendor>eclipse</vendor>
> </provides>
> <configuration>
>  <jdkHome>C:\Program Files\Eclipse Adoptium\jdk-8.0.322.6-hotspot</jdkHome>
> </configuration>
> </toolchain>
>
>
>   <!-- other toolchains -->
> </toolchains>
>
> I also get these warning:
>
> [WARNING] Unable to autodetect 'javac' path, using 'javac' from the
> environment.
> [INFO] -------------------------------------------------------------
> [WARNING] COMPILATION WARNING :
> [INFO] -------------------------------------------------------------
> [WARNING] [options] bootstrap class path not set in conjunction with
> -source 8
>
>
> On Thu, Apr 21, 2022 at 8:34 PM Matt Sicker <[email protected]> wrote:
>
> > What I've done in my own toolchains file before is setting a version
> > of Java for both "1.8" and "8" along with an entry for version "9"
> > (but pointing to Java 11) and "11".
> >
> > In the master branch, this test was since updated to stop referring to
> > the removed class as that branch requires Java 11 as the base anyways.
> >
> > On Thu, Apr 21, 2022 at 12:29 PM Mohammed B <[email protected]>
> > wrote:
> > >
> > > I replaced the tool chain of 14 with 8 and the build fails on the "API
> > Java
> > > 9 support" project. If I added both toolchains, I get the same error as
> > > before.
> > >
> > > Here's how my toolchain.xml looks like now:
> > >
> > > <toolchains>
> > >   <!-- JDK toolchains -->
> > >   <toolchain>
> > >     <type>jdk</type>
> > >     <provides>
> > >       <version>14</version>
> > >       <vendor>sun</vendor>
> > >     </provides>
> > >     <configuration>
> > >       <jdkHome>C:\Program Files\Java\jdk-14.0.1</jdkHome>
> > >     </configuration>
> > >   </toolchain>
> > >   <toolchain>
> > >  <type>jdk</type>
> > > <provides>
> > >  <version>8</version>
> > >  <vendor>eclipse</vendor>
> > > </provides>
> > > <configuration>
> > >  <jdkHome>C:\Program Files\Eclipse
> > Adoptium\jdk-8.0.322.6-hotspot</jdkHome>
> > > </configuration>
> > > </toolchain>
> > >
> > >
> > >   <!-- other toolchains -->
> > > </toolchains>
> > >
> > > On Thu, Apr 21, 2022 at 8:20 PM Gary Gregory <[email protected]>
> > wrote:
> > >
> > > > Use Java 8 means just that so yes you have to download it ;-)
> > > >
> > > > Gary
> > > >
> > > > On Thu, Apr 21, 2022, 12:57 Mohammed Barayyan <[email protected]
> > >
> > > > wrote:
> > > >
> > > > > Does that mean I have to install JDK 8? or can I modify the
> > toolchains or
> > > > > the pom.xml to achieve that?
> > > > >
> > > > > On Thu, Apr 21, 2022 at 7:56 PM Gary Gregory <[email protected]
> > >
> > > > > wrote:
> > > > >
> > > > > > Use Java 8, not 14.
> > > > > >
> > > > > > Gary
> > > > > >
> > > > > > On Thu, Apr 21, 2022, 12:35 Mohammed Barayyan <
> > [email protected]
> > > > >
> > > > > > wrote:
> > > > > >
> > > > > > > Hello,
> > > > > > >
> > > > > > > Any advice on the issue please.
> > > > > > >
> > > > > > > I'm trying to test and build branch 2.x from source but I get an
> > > > error:
> > > > > > >
> > > > > > > error: cannot find symbol
> > > > > > > [ERROR]   symbol:   class Reflection
> > > > > > > [ERROR]   location: package sun.reflect
> > > > > > >
> > > > > > > More details about my question in:
> > > > > > > stackoverflow question <Hello, I'm trying to test and build
> > branch
> > > > 2.x
> > > > > > from
> > > > > > > source but I get an error: error: cannot find symbol [ERROR]
> > symbol:
> > > > > > class
> > > > > > > Reflection [ERROR] location: package sun.reflect More details
> > about
> > > > my
> > > > > > > question in:
> > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > https://stackoverflow.com/questions/71957458/building-and-testing-log4j2-from-source-fails-cannot-find-symbol-symbol-clas
> > > > > > > >
> > > > > > >
> > > > > > > Thank you.
> > > > > > >
> > > > > >
> > > > >
> > > >
> >

Reply via email to