How do I write Java code in Windows and compile and run in Linux

java

Solution

You should use Eclipse for Development IDE and add dependent jars as relative not full directory link. You can compile on Windows and run on Linux. It does not matter.

Problem

I'm a new Java developer and would like to find out if it's possible to write Java code in Windows using Eclipse, and the code is actually compiled and run on Linux. I need to write java program for Linux (Ubuntu) environment, but I'm used to Windows for development. I'm thinking of using Samba for file sharing, so I can use Windows to access the source code that resides in Ubuntu. But when I compile the code, it actually use Windows JVM, instead of Ubuntu JVM, will that matter? Also when I need to include external JAR libraries that resides in Ubuntu, the path is actually something like E:\home\java\project\abc.jar, where E: drive is a mapped network drive from Samba. so when I ran the program on Ubuntu, there won't be any D: drive anymore. So I'm a bit confused and wonder if this is possible at all. any help will be really appreciated

Original source

Related problems