Solution:
Although if you search the internet or official documentation you will not find anything about this.
The solution is pretty simple, you need to download the Latest JDK and install it on your build server/Azure Build Agent server
then go to Collection Settings ->Agent Pools-> Select your agent and add User CAPABILITIES as shown in the picture below:
