Java runs on the JVM, so code is multi-platform, so the only thing that you need to care for is to write the file system paths using the correct \ or /, and I think there was a way to not even have to care about that.
Aside from it, my recommendation is the eternal
Java Tutorials (
Sun Microsystems Oracle) and after that, "
Modern Java in Action" (Manning).
The Java Tutorials is the Original Source of Truth and, while it doesn't cover language changes since Java 8, the differences are quite minimal. Modern Java in Action should cover any significant gaps from Java 8. I have its previous edition, Java 8 in Action (I am very old), and it's wonderful.
My next recommendation is "
Practical Unit Testing with JUnit and Mockito" for when you know the language and want to develop a serious project with a proper testing strategy.