简体   繁体   中英

Why there's a eclipse/netbeans version for Windows if java “run everywhere”

I'm a beginner at java programming and studied about the "write once, run anywhere" thing, but I noticed that when I download Eclipse or Netbeans IDEs (written in Java) there's a version for Windows and other versions for others OS's.

If a java program "runs anywhere" there shouldn't be "versions" (at my first thought). I searched and found that it's because (at least Eclipse, don't know about Netbeans) the program uses a different GUI library that does not work cross plataform.

So my questions are:

1) Why use a library that takes off one of the strongest features in java? Is it faster/ prettier?
2) Are there other ways, except the use of that library, that makes a java program don't work cross-plataform?

Thanks in advance.

when I download Eclipse or Netbeans IDEs (written in Java) there's a version for Windows and other versions for others OS's.

If a java program "runs anywhere" there shouldn't be "versions" (at my first thought).

Eclipse

Eclipse uses SWT , which uses the native GUI libraries, therefore you need a Version for each OS / platform.

NetBeans

In contrast to Eclipse, NetBeans uses standard-java Swing for GUI, so no need for native GUI libraries.

Here you are not correct: You can download a OS-specific version (eg. Windows / Linux / Mac OS), but you don't have to !

For downloading just select "OS independed Zip" as Platform . You'll get a ZIP archive you can extract and run on every supported platform. However, on Windows you have to run the exe, on Linux the shellscript to start the IDE (check bin directory).

The main feature of the os specific versions are their installers, the resulting NetBeans is mostly common to all.

1) Why use a library that takes off one of the strongest features in java? Is it faster/ prettier?

Just search for SWT / Swing comparison (and discussion about pros / cons).

2) Are there other ways, except the use of that library, that makes a java program don't work cross-plataform?

Yes, everything that depends on something platform specific.

Examples:

  • JNA / JNI (java native calls)
  • Paths ( C:/whatever won't work on Linux, while /home/whatever wont work on Windows)
  • Env. variables etc.
  • calling other programs

Just look for something like "how to keep java cross-platform" and do the opposite of very recommendation.

In general, java does a good job here, but with enough bad intentions you can kill any "cross-platform" development ;-)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM