I am using MobaXterm, a friendly Unix terminal that runs on Windows. I want to compile a simple Java program using the javac
command. After looking at plenty of other forums, I know I need to use the path where Java is installed, but no matter what I try, I keep getting the error
javac command not found
on the terminal. Can someone please help me out with compiling basic Java programs from within their directory on a Unix terminal on Windows?
And yes, I have JDK for Windows installed on my computer, I just don't know how to use it when compiling through the terminal.
By default, MobaXterm does not preserve Windows PATH
environment variable: this is why you obtain
command not found
when running javac
.
In order to tell MobaXterm to preserve Windows PATH
, you just have to go to Settings --> Configuration --> Terminal tab and check Append Windows PATH environment variable option.