JRuby

JRuby crashes with -XstartOnFirstThread on carbon

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: JRuby 1.1.1
  • Fix Version/s: JRuby 1.1.2
  • Component/s: Java Integration
  • Labels:
    None
  • Environment:
    carbon
  • Number of attachments :
    0

Description

To reproduce this bug, start jruby as: jruby -J-XstartOnFirstThread
Wait a while as jruby crashes with no warnings or errors printed on the console.

From http://www.eclipse.org/swt/faq.php#carbonapp:
If you run a Java application that uses Carbon via JNI, the application is not registered with the OS as a 'normal' UI application. As a consequence, it has no entry in the dock and it cannot be activated. AWT (or Swing) based applications don't have this problem because they seem to use undocumented SPI to register themselves.
To work around this problem you'll have to pass the -XstartOnFirstThread option to the java executable as follow:

java -XstartOnFirstThread -cp swt.jar:. ControlExample

Activity

Hide
Charles Oliver Nutter added a comment -

I tested this with Java 5 and the following command line and it ran fine:

jruby -J-XstartOnFirstThread -e "puts 1"

What version of OS X, Java, etc were you running?

Show
Charles Oliver Nutter added a comment - I tested this with Java 5 and the following command line and it ran fine:
jruby -J-XstartOnFirstThread -e "puts 1"
What version of OS X, Java, etc were you running?
Hide
Ketan Padegaonkar added a comment -

I'm using java 5.0 on osx 10.5.2:

 
[ketan@storm: /opt/workspaces/swtbot]$ java -version
java version "1.5.0_13"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_13-b05-237)
Java HotSpot(TM) Client VM (build 1.5.0_13-119, mixed mode, sharing)

And this is what I happen to get when I do jruby -J-XstartOnFirstThread -e 'puts "hello world"'; echo $?

 
[ketan@storm: /opt/workspaces/swtbot]$ jruby -J-XstartOnFirstThread -e 'puts "hello world"'; echo $?
1

Normally jruby exits with exit code 0.

Jruby without the -J works fine:

 
[ketan@storm: /opt/workspaces/swtbot]$ jruby -e 'puts "hello world"'; echo $?
hello world
0
Show
Ketan Padegaonkar added a comment - I'm using java 5.0 on osx 10.5.2:
 
[ketan@storm: /opt/workspaces/swtbot]$ java -version
java version "1.5.0_13"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_13-b05-237)
Java HotSpot(TM) Client VM (build 1.5.0_13-119, mixed mode, sharing)
And this is what I happen to get when I do jruby -J-XstartOnFirstThread -e 'puts "hello world"'; echo $?
 
[ketan@storm: /opt/workspaces/swtbot]$ jruby -J-XstartOnFirstThread -e 'puts "hello world"'; echo $?
1
Normally jruby exits with exit code 0. Jruby without the -J works fine:
 
[ketan@storm: /opt/workspaces/swtbot]$ jruby -e 'puts "hello world"'; echo $?
hello world
0
Hide
Ketan Padegaonkar added a comment -

seems to have been fixed in trunk! SWT works fine. Jruby with -XstartOnFirstThread exits with exit code 0

Show
Ketan Padegaonkar added a comment - seems to have been fixed in trunk! SWT works fine. Jruby with -XstartOnFirstThread exits with exit code 0
Hide
Thomas E Enebo added a comment -

Since this works in trunk it will be fixed for 1.1.2

Show
Thomas E Enebo added a comment - Since this works in trunk it will be fixed for 1.1.2

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: