install java or just copy jdk file?

1.1k Views Asked by At

I am working on a windows 10 virtual machine which I want to run on it java application. when I tried to run it I get an error "Windows cannot find 'javaw'" since java is not installed. Now if I want to have java on the machine, should I install java ? or I can only copy paste the java jdk that I already have on my workstation? On my workstation I have java jdk 11 folder which has the below files/folders:

  • bin
  • conf
  • include
  • jmods
  • legal
  • lib

Note: I don't have access to internet from my windows 10 VM

1

There are 1 best solutions below

0
Lutz On

Both would work - download installer or just transfer a jdk folder. The advantage of using an installer is, that it most likely will setup the PATH variable for you, so that you can run it just with java ... or javaw ....

With a transferred jdk (or better a downloaded zip file of a jdk e.g. from https://jdk.java.net/java-se-ri/[version]) you need to either explicitly state where to find the jdk (e.g. c:\user\bla\Downloads\jdk\bin\javaw.exe ...) or add the bin-path to the search path environment variable (PATH) your self.

I personally like the "download a zip file" version, as that makes it really simple to have different versions of java. As some stuff might not work with old versions but some other might not work with the most recent versions (at least not with some extra trouble).