How do you develop SWT programs in IDEA? (On OSX)

Since SWT is just a library is should be possible to develop SWT programs in IDEA, but I've been unable to get anything to run from within IDEA. I have the SWT HelloWorld program running on the commandline, but it hangs while running it from IDEA.

package com.scrape;
public class SWTHelloWord
public static void main (String [] args) {
Display display = new Display ();
Shell shell = new Shell(display); ();

while (!shell.isDisposed ())
if (!display.readAndDispatch ())
display.sleep ();
display.dispose ();

This runs the program from the commandline:

java_swt -Djava.library.path=/Users/czei/Library/Java/swt-3 -classpath ./classes:/Users/czei/Library/Java/swt-3/swt.jar:/Users/czei/Library/Java/swt-3/swt-pi.jar com.scrape.SWTHelloWorld

Running it from IDEA results in nothing :( Note that the sample code uses a special "java_swt" program that is included with SWT.

Warm regards,

Michael Czeiszperger

Comment actions Permalink

SWT is not "just a library" (in the java sense). It has native components and needs some special setup. A couple of things that comes to my mind:

1. Disable IDEA launcher (add to you idea.lax/bat/sh file);
2. Remember to include -Djava.library.path in the VM options.

Comment actions Permalink

Thanks for the suggestion, but there is no ".lax" file :( On OSX there's just "IntelliJ", with no ".lax" file anywhere. The "lax" file is probably something from InstallAnywhere that is used to start IDEA on other platforms. I'll just find the OSX equivalent and see if that helps.

I take it you're successfully developing SWT programs with IDEA?

Comment actions Permalink

you're successfully developing SWT programs with IDEA?

Yes, I did. You just need to add the jars to the project libraries and
make the native libs (on Windows) DLLs available in the current working



Please sign in to leave a comment.