I am trying to install JDK at office laptop but it says I need administrator privileges. I have only access to my own account at work.
How can I install the Java Dev
In order to easily install Java JDK on Windows without administrator privileges, you can use https://aws.amazon.com/corretto/. It contains a portable amazon-corretto- file, that you just need to download and unzip.
Download the portable zip file from amazon.com, e.g. https://d3pxv6yz143wms.cloudfront.net/8.232.09.1/amazon-corretto-8.232.09.1-windows-x64-jdk.zip
Unzip it in a folder, e.g. C:\Users\John\programs
Set the JAVA_HOME variable, e.g. set JAVA_HOME=C:\Users\John\programs\jdk1.8.0_232
Add the path to the "bin" folder to the PATH: e.g. set PATH = %PATH%; %JAVA_HOME%\bin
Test if the installation works with javac -version
Remark #1. I am proposing this alternative technique using Amazon Corretto because other proposed answers requires 7-zip for which you need administrative rights to install, and I did not find a simple portable .zip version of 7-zip.
Remark #2. You can set up your environment by having a my-cmd.cmd file which contains the needed variables:
rem # PROMPT is an optional question of taste ;-)
prompt [$P]$_$$$S
rem # VARIABLE(S)
set JAVA_HOME=C:\Users\UW31RY\programs\jdk1.8.0_232
rem # PATH
set PATH=C:\WINDOWS;C:\WINDOWS\system32;%JAVA_HOME%\bin
rem # Clear the screen!
cls
and creating a shortcut with %windir%\system32\cmd.exe /K "my-cmd.cmd" as Target: value, and the folder which contains the my-cmd.cmd file as Start in: value, e.g. C:\Users\John\work.