Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Developing on Windows, Running on OS X, Help!(NullPointer at Display.updateQuitMenu)
Developing on Windows, Running on OS X, Help! [message #508911] Wed, 20 January 2010 17:13 Go to next message
Ian Harac is currently offline Ian HaracFriend
Messages: 10
Registered: November 2009
Location: Southern Indiana
Junior Member

I'm editing this due to getting beyond Crisis 1 and onto Crisis 2. I'm leaving the original problem intact in case it's relevant to Crisis 2.

Crisis 2: I got past the segfault by using -XstartOnFirstThread. This got me a bit further, then I ended up getting a Null Pointer Exception at org.eclipse.swt.widgets.Display.updateQuitMenu .

Is there something I need to do/set/configure/futz with on the Windows side to let this (apparently Mac-only, due to NSApplication references in the source) code run properly?

Crisis 1 (Solved?)
OK. I have developed a Java app which uses SWT rather heavily. I've spent about two days trying to get it to run on a Mac (OS X 10.5.8, Java 1.6). I have overcome several obstacles, including figuring out how to reset JAVA_HOME, writing some bash scripts to set environment variables as needed, and many other things, but I finally hit a wall.

This morning, I got to the point where I got the "Java Link Error" issue, as my code was linked to the win32 jars for SWT. I DL'ed (on my Windows machine) the Mac OSX files, and set SWT_LIB to point to org.eclipse.swt.cocoa.macosx.x86_64_3.5.0.v3550b.jar and swapped the swt.jar I'd been using with the Mac one (keeping both in separate folders, of course). This got me past that hump (when I moved the runnable Jar to the mac), but then I got a segfault, which was, according to the Mac, "possibly due to libswt-pi-cocoa-3559.jnilib plig-in"

I'm sort of reaching a crisis point here, as I need this whole thing working by Friday, and I know there's going to be actual Java code to debug, and I can't even get the front end to come up. (And if my oh-so-clever "Hey, I'll just swap the jars!" solution was, ahem, not so clever, well, I'll take my lumps. What I'd like to avoid, if in ANY WAY POSSIBLE, is installing/configuring Eclipse on two machines, because that magnifies the possibilities of niggling little error ("Oh, this machine uses version 1.3.5.7.8.*9* of ObscureLibYouNeverHeardOf.jar") to suicide-inducing levels.)

Any help is appreciated. If you feel the need to mock my obvious stupidity and cluelessness ("Duh, you just check 'Compile For Mac', moron!"), I don't mind, as long as I get a working answer out of it. Thank you.

[Updated on: Wed, 20 January 2010 20:03]

Report message to a moderator

Re: Developing on Windows, Running on OS X, Help! [message #509520 is a reply to message #508911] Fri, 22 January 2010 16:38 Go to previous messageGo to next message
Grant Gayed is currently offline Grant GayedFriend
Messages: 2150
Registered: July 2009
Senior Member
Hi Ian,

To point your app at an swt jar, like
org.eclipse.swt.cocoa.macosx.x86_64_3.5.0.v3550b.jar, you should put the jar
on the classpath when running it (eg.- at the command line, java -classpath
../org.eclipse.swt.cocoa.macosx.x86_64_3.5.0.v3550b.jar <yourClass>.class).
When the swt jar is loaded it auto-extracts its libraries to a temporary
location and references them there, no additional effort required on your
end. Specifying SWT_LIB overrides this mechanism, which is probably causing
you problems.

Also, have you seen http://www.eclipse.org/swt/macosx/ ? Even if you don't
want to distribute your app as an application bundle, take note of the
flags -d32/-d64 and -XstartOnFirstThread

If these do not solve your problems then feel free to follow up here.

Grant


"Ian Harac" <mrlizard@gmail.com> wrote in message
news:hj7djn$n0m$1@build.eclipse.org...
> OK. I have developed a Java app which uses SWT rather heavily. I've spent
about two days trying to get it to run on a Mac (OS X 10.5.8, Java 1.6). I
have overcome several obstacles, including figuring out how to reset
JAVA_HOME, writing some bash scripts to set environment variables as needed,
and many other things, but I finally hit a wall.
>
> This morning, I got to the point where I got the "Java Link Error" issue,
as my code was linked to the win32 jars for SWT. I DL'ed (on my Windows
machine) the Mac OSX files, and set SWT_LIB to point to
org.eclipse.swt.cocoa.macosx.x86_64_3.5.0.v3550b.jar and swapped the swt.jar
I'd been using with the Mac one (keeping both in separate folders, of
course). This got me past that hump (when I moved the runnable Jar to the
mac), but then I got a segfault, which was, according to the Mac, "possibly
due to libswt-pi-cocoa-3559.jnilib plig-in"
>
> I'm sort of reaching a crisis point here, as I need this whole thing
working by Friday, and I know there's going to be actual Java code to debug,
and I can't even get the front end to come up. (And if my oh-so-clever "Hey,
I'll just swap the jars!" solution was, ahem, not so clever, well, I'll take
my lumps. What I'd like to avoid, if in ANY WAY POSSIBLE, is
installing/configuring Eclipse on two machines, because that magnifies the
possibilities of niggling little error ("Oh, this machine uses version
1.3.5.7.8.*9* of ObscureLibYouNeverHeardOf.jar") to suicide-inducing
levels.)
>
> Any help is appreciated. If you feel the need to mock my obvious stupidity
and cluelessness ("Duh, you just check 'Compile For Mac', moron!"), I don't
mind, as long as I get a working answer out of it. Thank you.
>
Re: Developing on Windows, Running on OS X, Help! [message #509533 is a reply to message #509520] Fri, 22 January 2010 17:31 Go to previous message
Ian Harac is currently offline Ian HaracFriend
Messages: 10
Registered: November 2009
Location: Southern Indiana
Junior Member

Thanks for the reply!

XstartOnFirstThread got me past the initial crash, as did swapping the builds, but I'll switch to the classpath method to avoid having to continually set/reset SWT_PATH. The current crisis duJour is the Null Pointer Error in UpdateQuitMenu. (A function which doesn't seem to exist in widgets.Display in the Windows environment.)

I'm using a 64 bit OS on both my dev environment and the Mac. Explicitly using -d64 did nothing, while using -d32 gave me an error about trying to run a 64 bit JRE in 32 bit mode.

"Write once, run anywhere." You'd think, after over two decades as a professional programmer, I'd know better than to believe that... Smile This must be why I still buy lottery tickets.
Previous Topic:Problems with Eclipse 3.5.x on Ubuntu? Read this.
Next Topic:Best way to embed Links in Text
Goto Forum:
  


Current Time: Wed Apr 24 15:56:10 GMT 2024

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

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

Back to the top