문제

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.

다른 팁

You can try cygwin first of all. Is another terminal that runs on windows. With this command 'sudo apt-get install openjdk-7-jdk' at linux installs the jdk And after this you can compile your program. sudo is for administration privilages.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top