Running issue with Mac OS X [Was: Mac OS 10.5 Compilation issue]

Sylvestre Ledru sylvestre.ledru at scilab.org
Fri Jan 9 19:20:31 CET 2009


Hello,

Le lundi 05 janvier 2009 à 22:51 -0500, Eric E a écrit :
>  Running scilab normally (i.e., without the -nw flag)
> brings up the standard Scilab command screen, which appears to work
> but won't accept any input from the keyboard.  
I have been able to identify the reason of this bug. It is caused by the
Apple implementation of the Java Virtual Machine when the JVM is started
from a Native Code.

I reported a bug on Apple's bug tracker. It is filled as #6484319 -
https://bugreport.apple.com/cgi-bin/WebObjects/RadarWeb.woa/77/wo/oOaYNwDxPwitXjOIvr5AFg/16.34
You need an account to be able to see it.

To reproduce the issue:
1) 
Download
http://developer.apple.com/samplecode/simpleJavaLauncher/simpleJavaLauncher.zip

2) unpack it

3) in the directory, create a file JTextAreaDemo.java with the following
code:

----
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

public class JTextAreaDemo extends JFrame implements ActionListener {

    JTextField jtfInput;

    public JTextAreaDemo() {
        createGui();
    }

    public void createGui() {
        jtfInput = new JTextField(20);
        jtfInput.addActionListener(this);
        GridBagLayout gridBag = new GridBagLayout();
        Container contentPane = getContentPane();
        contentPane.setLayout(gridBag);
        GridBagConstraints gridCons1 = new GridBagConstraints();
        gridCons1.gridwidth = GridBagConstraints.REMAINDER;
        gridCons1.fill = GridBagConstraints.HORIZONTAL;
        contentPane.add(jtfInput, gridCons1);
    }
    public void actionPerformed(ActionEvent evt) {
        String text = jtfInput.getText();
        jtfInput.selectAll();
    }
    public static void main(String[] args) {
        JTextAreaDemo jtfTfDemo = new JTextAreaDemo();
        jtfTfDemo.pack();
        jtfTfDemo.addWindowListener(new WindowAdapter() {

                public void windowClosing(WindowEvent e) {
                    System.exit(0);
                }
            });
        jtfTfDemo.setVisible(true);
    }
}
----

4) Compile it 
javac JTextAreaDemo.java

5) As test, run it
java JTextAreaDemo
You will notice that you can input some text in the JTextArea.

6) Compile the simpleJavaLauncher application

gcc -o simpleJavaLauncher simple.c utils.c
-L/System/Library/Frameworks/JavaVM.framework/Home/../Libraries
-L/System/Library/Frameworks/JavaVM.framework/Home/jre/lib/i386/server
-ljvm -L/sw/lib -framework CoreFoundation -framework IOKit -lclient
-lserver  -framework JavaVM

7) Run the same class but this time with the loader itself; ie:
./simpleJavaLauncher JTextAreaDemo

8) Please note that it is possible to input anything in the JTextArea.
Note that the equivalent (ie without Cocoa) is working under both
GNU/Linux and Microsoft Windows.

Cheers,
Sylvestre





More information about the dev mailing list