Java – Why is Eclipse Platform Dependent?

cross platformeclipsejava

When Eclipse is written in Java and Java is platform independent, why does Eclipse offer different versions according to platforms?

I assume it should be write once, use anywhere code.

enter image description here

Best Answer

Although Eclipse IDE is written in Java, the graphical control elements use Standard Widget Toolkit (SWT), whereas most Java applications use the Java standard Abstract Window Toolkit (AWT) or Swing.

To display GUI elements, the SWT implementation accesses the native GUI libraries of the operating system using JNI (Java Native Interface) in a manner that is similar to those programs written using operating system-specific APIs. Programs that call SWT are portable, but the implementation of the toolkit, despite part of it being written in Java, is unique for each platform.

SWT must be ported to every new GUI library that needs supporting. Unlike Swing and AWT, SWT is not available on every Java-supported platform since SWT is not part of the Java release.

Therefore the Eclipse distribution must include different SWT implementation for each supported platform.