質問

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