This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
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.