Java bytecode is the same, no matter what operating system you run the program on, so normally you do not need to change anything in your source code, and you do also not need to recompile your source code to run on Linux instead of Windows.
Ofcourse it is possible to write programs that will only work on Windows. If you put absolute paths to files in your program that only exist on Windows, then on Linux it would not work:
If you use \\ to separate files, or ; tp separate paths, or \n as line terminators, or ctrl-D/ctrl-Z as end-of-transmission characters. All those things can tie you to a particular platform. I think there is a chapter in the O'Reilly book Java™ in a Nutshell which lists many more platform differences.