Search code examples
javaeclipseswtrcp

SWT - current platform in


I've got two questions:

  1. How I can to know the type of the current platform in code? Is it Mac or Linux or Windows.
  2. Is there something in SWT?

Solution

  • You can use:

    String platform = SWT.getPlatform();
    

    which returns "win32", "motif", "gtk", "photon", "carbon", "cocoa", "wpf" ...

    It is rare to actually need to use this.