What is the benefit of compiling java on a linux machine over windows?

I have a CS professor who insists compiling our java classes on a linux server before we submit our code for grading. He did this when I took him for a course in C which makes sense because I know sometimes C code will compile differently in linux over windows.

However, my understanding of the JVM is that it’s platform independent. Is this true or am I missing some benefits to compiling on linux?

Java is write-once-run-everywhere. That’s probably one of the main reasons it was created. Java is compiled down to Byte code which is interpreted and executed by the Java Virtual Machine. Furthermore, this is translated into native code using a Just-In-Time Compilation for performance reasons.

The only reason I could think of is maybe some OS specific things hard-coded in your application? Such as “C:/some/folder/lives/here/on/windows”, or in your case “/usr/local/somefile/here/i/want/to/access/on/linux”. Again not sure.