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 |
|
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 |
Grant Gayed 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 |
|
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... This must be why I still buy lottery tickets.
|
|
|
Goto Forum:
Current Time: Thu Dec 26 13:44:28 GMT 2024
Powered by FUDForum. Page generated in 0.02755 seconds
|