Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » My SWT application doesn't work on Mac(write once run everywhere)
icon5.gif  My SWT application doesn't work on Mac [message #540234] Tue, 15 June 2010 13:01 Go to next message
Alexandra Niculai is currently offline Alexandra NiculaiFriend
Messages: 84
Registered: July 2009
Member
Hi

I have an SWT application that I created on Windows and it runs fine. It runs also on Ubuntu, but when I try to run it on Mac, it doesn't work. Sometimes, I get to see the the application but it doesn't react at all.
I tried to run it in Eclipse and I always get the following exception:
java.lang.NullPointerException
	at org.eclipse.swt.widgets.Display.updateQuitMenu(Display.java:4082)
	at org.eclipse.swt.widgets.Shell.setWindowVisible(Shell.java:1632)
	at org.eclipse.swt.widgets.Shell.setVisible(Shell.java:1563)


When looking at the source code in Display line 4082, the code there is:

NSMenu mainmenu = application.mainMenu();
NSMenuItem appitem = mainmenu.itemAtIndex(0);


So mainMenu is null.

I tried to add a menubar to the application but the problem persists.
I'm using org.eclipse.swt.cocoa.macosx_3.5.2.v3557f.jar.
Could anyone please help me?

[Updated on: Tue, 15 June 2010 13:03]

Report message to a moderator

Re: My SWT application doesn't work [message #541521 is a reply to message #540234] Mon, 21 June 2010 13:01 Go to previous messageGo to next message
Daniel Krügler is currently offline Daniel KrüglerFriend
Messages: 853
Registered: July 2009
Senior Member
On 15.06.2010 15:01, Alexandra Niculai wrote:
> Hi
>
> I have an SWT application that I created on Windows and it runs fine. It
> runs also on Ubuntu, but when I try to run it on Mac, it doesn't work.
> Sometimes, I get to see the the application but it doesn't react at all.
> I tried to run it in Eclipse and I always get the following exception:
>
> java.lang.NullPointerException
> at org.eclipse.swt.widgets.Display.updateQuitMenu(Display.java: 4082)
> at org.eclipse.swt.widgets.Shell.setWindowVisible(Shell.java:16 32)
> at org.eclipse.swt.widgets.Shell.setVisible(Shell.java:1563)
>
>
> When looking at the source code in Display line 4082, the code there is:
>
>
> NSMenu mainmenu = application.mainMenu();
> NSMenuItem appitem = mainmenu.itemAtIndex(0);
>
>
> So mainMenu is null.
>
> I tried to add a menubar to the application but the problem persists.
> I'm using org.eclipse.swt.cocoa.macosx_3.5.2.v3557f.jar.
> Could anyone please help me?

Sorry, I have no MacOS, but I have heard from a colleague a similar
problem. I suggest that you search in the bugzilla entries for
such a problem and to vote for it, if existing. If not existing,
please open a new one.

Greetings from Bremen,

Daniel Krügler
Re: My SWT application doesn't work [message #543202 is a reply to message #540234] Mon, 28 June 2010 16:21 Go to previous messageGo to next message
Peter Kanzler is currently offline Peter KanzlerFriend
Messages: 9
Registered: July 2009
Junior Member
Hello,

Mac OS X handles the menubar slightly different than other OS. What do
you do in your application (concerning menubars)? A little more
information would be great.

Try the newest SWT library as well (swt.jar):
64-bit:
http://download.eclipse.org/eclipse/downloads/drops/R-3.6-20 1006080911/download.php?dropFile=swt-3.6-cocoa-macosx-x86_64 .zip

32-bit:
http://download.eclipse.org/eclipse/downloads/drops/R-3.6-20 1006080911/download.php?dropFile=swt-3.6-cocoa-macosx.zip

And if you really want to integrate your SWT application into the Mac
environment, also read and try the following links. It works really
great for my SWT application:
http://www.transparentech.com/opensource/cocoauienhancer
http://www.rkuntz.org/pmwiki.php?n=Code.AntJarBundler

cheers
Peter

On 15.06.10 15:01, Alexandra Niculai wrote:
> Hi
>
> I have an SWT application that I created on Windows and it runs fine. It
> runs also on Ubuntu, but when I try to run it on Mac, it doesn't work.
> Sometimes, I get to see the the application but it doesn't react at all.
> I tried to run it in Eclipse and I always get the following exception:
>
> java.lang.NullPointerException
> at org.eclipse.swt.widgets.Display.updateQuitMenu(Display.java: 4082)
> at org.eclipse.swt.widgets.Shell.setWindowVisible(Shell.java:16 32)
> at org.eclipse.swt.widgets.Shell.setVisible(Shell.java:1563)
>
>
> When looking at the source code in Display line 4082, the code there is:
>
>
> NSMenu mainmenu = application.mainMenu();
> NSMenuItem appitem = mainmenu.itemAtIndex(0);
>
>
> So mainMenu is null.
>
> I tried to add a menubar to the application but the problem persists.
> I'm using org.eclipse.swt.cocoa.macosx_3.5.2.v3557f.jar.
> Could anyone please help me?
Re: My SWT application doesn't work [message #545024 is a reply to message #543202] Tue, 06 July 2010 12:49 Go to previous messageGo to next message
Alexandra Niculai is currently offline Alexandra NiculaiFriend
Messages: 84
Registered: July 2009
Member
Thank you for your answers.
It's a bit complicated, there is no real menu bar, just a coolbar. Maybe that's the problem.
It still doesn't work, I'll come back and post when I find a solution.
Re: My SWT application doesn't work on Mac [message #545812 is a reply to message #540234] Fri, 09 July 2010 08:56 Go to previous message
Alexey Romanov is currently offline Alexey RomanovFriend
Messages: 263
Registered: May 2010
Senior Member
I've just run into the same problem. Try starting JVM with the option -XstartOnFirstThread.

EDIT: Sorry, didn't look at your exception Embarrassed That's not the symptoms I get when this option is missing, the application just hangs on startup. Still might be worth a try if you don't have this option.

[Updated on: Fri, 09 July 2010 09:00]

Report message to a moderator

Previous Topic:Deploying a cross-platform SWT stand-alone application
Next Topic:Resize elements in SWT Shell at runtime
Goto Forum:
  


Current Time: Tue Apr 23 15:10:16 GMT 2024

Powered by FUDForum. Page generated in 0.03365 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top