简体   繁体   English

如果Java“随处可见”,为什么Windows会有eclipse / netbeans版本

[英]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. 我是Java编程的初学者,研究过“一次编写,可以在任何地方运行”的东西,但是我注意到,当我下载Eclipse或Netbeans IDE(用Java编写)时,会有一个Windows版本和其他OS的版本。

If a java program "runs anywhere" there shouldn't be "versions" (at my first thought). 如果Java程序“可以在任何地方运行”,则不应有“版本”(按我的初衷)。 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. 我搜索后发现,这是因为(至少是Eclipse,对Netbeans不了解),该程序使用了一个无法跨平台工作的GUI库。

So my questions are: 所以我的问题是:

1) Why use a library that takes off one of the strongest features in java? 1)为什么要使用一个能够释放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? 2)除了使用该库之外,还有其他方法可以使Java程序无法跨平台工作吗?

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. 当我下载Eclipse或Netbeans IDE(用Java编写)时,有一个Windows版本和其他OS版本。

If a java program "runs anywhere" there shouldn't be "versions" (at my first thought). 如果Java程序“可以在任何地方运行”,则不应有“版本”(按我的初衷)。

Eclipse 日食

Eclipse uses SWT , which uses the native GUI libraries, therefore you need a Version for each OS / platform. Eclipse使用SWT ,后者使用本 GUI库,因此每个OS /平台都需要一个Version。

NetBeans NetBeans的

In contrast to Eclipse, NetBeans uses standard-java Swing for GUI, so no need for native GUI libraries. 与Eclipse相比,NetBeans使用标准Java Swing作为GUI,因此不需要本机GUI库。

Here you are not correct: You can download a OS-specific version (eg. Windows / Linux / Mac OS), but you don't have to ! 在这里您不正确:您可以下载特定于操作系统的版本(例如Windows / Linux / Mac OS),但不必这样做

For downloading just select "OS independed Zip" as Platform . 要下载,只需选择“ OS独立的Zip”作为Platform即可 You'll get a ZIP archive you can extract and run on every supported platform. 您将获得一个ZIP存档,可以将其提取并在每个受支持的平台上运行。 However, on Windows you have to run the exe, on Linux the shellscript to start the IDE (check bin directory). 但是,在Windows上,您必须运行exe,在Linux上,需要运行shellscript来启动IDE(检查bin目录)。

The main feature of the os specific versions are their installers, the resulting NetBeans is mostly common to all. 特定于操作系统的版本的主要功能是其安装程序,因此,最终的NetBeans对所有人都是通用的。

1) Why use a library that takes off one of the strongest features in java? 1)为什么要使用一个能够释放Java最强大功能之一的库? Is it faster/ prettier? 它更快或更漂亮吗?

Just search for SWT / Swing comparison (and discussion about pros / cons). 只需搜索SWT / Swing比较(以及有关优点/缺点的讨论)。

2) Are there other ways, except the use of that library, that makes a java program don't work cross-plataform? 2)除了使用该库之外,还有其他方法可以使Java程序无法跨平台工作吗?

Yes, everything that depends on something platform specific. 是的,一切都取决于特定于平台的东西。

Examples: 例子:

  • JNA / JNI (java native calls) JNA / JNI(Java本机调用)
  • Paths ( C:/whatever won't work on Linux, while /home/whatever wont work on Windows) 路径( C:/whatever在Linux上C:/whatever都不工作,而/home/whatever在Windows上C:/whatever也不工作)
  • Env. 信封。 variables etc. 变量等
  • calling other programs 调用其他程序

Just look for something like "how to keep java cross-platform" and do the opposite of very recommendation. 只需查找“如何保持Java跨平台”之类的内容,然后做与建议相反的操作即可。

In general, java does a good job here, but with enough bad intentions you can kill any "cross-platform" development ;-) 总的来说,java在这里做得很好,但是出于恶意,您可以杀死任何“跨平台”开发;-)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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