所有平台上的java

ajs*_*sie 2 java linux windows macos

如果你想在java for windows,mac和linux中编写桌面应用程序代码,那么所有代码​​的代码是否相同?

你只需更改GUI,以便Windows应用程序更像Windows,等等?

如何在不深入细节的情况下运作?

Dan*_*yer 5

One of Java's selling points is that is is "Write Once, Run Anywhere" (pretty much).

The compiled bytecode is executed by the Java Virtual Machine (JVM). The JVM is specific to the platform that it runs on but the same bytecode can be executed by any platform that has a JVM. The code does not have to be recompiled.

Swing is Java's cross-platform GUI toolkit. You can configure it so that it has a GUI that looks the same across different platforms (it won't look native on any of them), or you can tell it to use the most appropriate look-and-feel for the platform that it is executing on. So if you run on Windows it will look like a Windows app, if you run on OS X it will look like a native Mac app.

  • 丹,"系统"的外观和感觉看起来和感觉都不是原生的.它看起来和感觉本机是啊:) (2认同)