In the Java world, we often talk about the JVM, and when Java was new it had the supposedly killer feature of "Write Once, Run Anywhere."

From the way people talk and write, this seems different from the way that Python, for example, works. Yet I've not been aware of any way that Python code that I've written would work differently on another machine. (Though I haven't written that much Python.)

So what am I missing? How is the JVM different from a Python interpreter? Is there a way that Python lacks Java's platform independence? Or is this just a cultural difference?

  • 1
    The primary difference is the strictness of the JVM specification. It is simply very well defined how it must (not should) behave.
    – user1249
    Oct 25, 2011 at 9:30

5 Answers 5


Java does a very good job on isolating you from the underlying OS and gives you the same exact tools on most platforms it works on to talk to things in the underlying OS.

Python on the other hand does not do as good of a job in isolating you from the underlying OS, It does not have a standard way of handling between process communications (look at the differences in the sys module and os module between a windows and *nix implementation of Python for example.)

I have written code in python that would only work on a *NIX box or Windows box using just Python available API calls, where in Java it would be very difficult to write code that was just Java API that would not work the same on both a Windows box or *NIX box

  • 1
    It's not at all difficult to write Java code that works only on Windows; just hard-code a Windows file path like "C:\MyApp\data" Jan 2, 2014 at 7:06
  • @kevincline Hardcoded paths are a bad practice on any operating system. But Java doesn't require you to do this, because it offers OS-independent methods to retrieve common directories like the user directory or the install path of the current program.
    – Philipp
    Sep 6, 2014 at 21:51

Topically and just from a language runtime, there is little difference. The JVM in particular is designed not just as an interpreter but also a runtime compiler, code inference, an instrumental virtualization layer that can have dynamic hooks applied, various GC semantics and the ability to describe virtualization ergonomics, to name a few. Python can run in a JVM? Can Java run in a Python interpreter?

Most interpreters are runtime language/token interpreters, JVMs (and others) as you know interpret/compile/run intermediate code. IBM for instance has been doing this for decades outside of Java, it is nothing new. Even VB ran in intermediate code for some time I believe?

The WORA is mostly passé now as many interpreted languages run just about anywhere unchanged.


When Java was new, WORA was something to boast about - specifically, that you could compile on one platform and run that (compiled bytecode) on other platforms.

Of course, interpreted languages run pretty much similarly regardless on what platform the interpreter runs on (as long as the interpreter is available for that platform). However, file systems, permission issues, encodings, line endings and countless other small but irritating issues can cause headaches. Some platform-dependent things aren't easy to abstract away.

  • WORA in itself is not enough. The really important bit is that it is very well defined how it runs everywhere, making it unimportant exactly where it was run. Mar 18, 2020 at 22:00

Does Python have a platform independent GUI?

Anyway, the WORA feature was - again - to lure C programmers over, as C tended to model the underlying platform closely, and as platforms were different (size of word? endianess?) creating fully portable C programs required great care and attention.

The Java promise was that all this tediousness did not have to be done, as the platform is very well defined and you KNOW that a char is 16 bit etc. Also the GUI is written in Java and also 100% portable, which means that your program can run on a computer you've never heard of and even run correctly.

  • 6
    Python has several platform independent GUI alternatives: docs.python.org/faq/… Oct 30, 2010 at 5:44
  • Java GUIs are notorious for not displaying properly on various platforms, so I wouldn't exactly boast about that aspect. However, I would agree with the rest of your statement.
    – oxr463
    Jul 12, 2019 at 2:51

Except that Java is emphatically not WORA. I've seen Java software that broke after Java has been upgraded to a higher version on the minor version number. IMHO, WORA is just a marketing gimmick.

  • 1
    This isn't really an answer to the question. Oct 29, 2010 at 21:02
  • -1 because Java is WORA for all practical purposes. It will work if you avoid system-specific hacks and obviously native stuff like JNI. I've had 50,000+ line applications run perfectly across Windows, Mac and Linux, no changes, first time, with the same compiled .jar file. If you stick to pure Java it all just works.
    – mikera
    Jun 10, 2011 at 0:20
  • 1
    It appears you have misunderstood what WORA mean.
    – user1249
    Oct 25, 2011 at 9:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.