GCJ and Swing

Michael Koch konqueror@gmx.de
Tue Aug 24 07:18:00 GMT 2004


Am Dienstag, 24. August 2004 08:58 schrieb Ivan Ivanov:
> --- Michael Koch <konqueror@gmx.de> wrote:
> > Huh ? Either you forgot to to specify -lgcj or you
> > should use gcj to
> > link your app.
> >
> > Michael
>> Michael,
> I am obviuosly doing something wrong. I cut my long
> class to a short sample which I am trying to compile
> and run. The class is the following
>> import javax.swing.JDialog;
> import javax.swing.JLabel;
>> public class LabelDialog {
>> public static void main(String[] args) {
> 	JDialog dialog = new JDialog(new JFrame());
> 	dialog.setTitle("Dialog with a label");
> 	JLabel label = new JLabel("The label that will be put
> in the dialog");
> 	dialog.getContentPane().add(label);
> 	dialog.pack();
> 	dialog.setVisible(true);
> }
> }
>> I am trying to compile it with
> gcj LabelDialog.java
> the following error is outputed
>> /usr/lib/gcc-lib/i386-redhat-linux/3.3.3/../../../crt1.o(.text+0x18
>):
>> In function `_start':
> : undefined reference to `main'
>> collect2: ld returned 1 exit status

As the manual stats:
gcj --main=LabelDialog LabelDialog.java -o LabelDiablog
GCJ need to know which class to use for the main "main" method as each 
class may have one.
> When I try to make an executable file and run it I
> receive the following error
>> Exception in thread "main" java.lang.Error: not
> implemented
> at javax.swing.UIDefaults.put(java.lang.Object,
> java.lang.Object) (/usr/lib/libgcj.so.4.0.0)
> at
> javax.swing.plaf.basic.BasicDefaults.BasicDefaults()
> (/usr/lib/libgcj.so.4.0.0)
> at
> javax.swing.plaf.metal.MetalLookAndFeel.getDefaults()
> (/usr/lib/libgcj.so.4.0.0)
> at javax.swing.UIManager.getDefaults()
> (/usr/lib/libgcj.so.4.0.0)
> at
> javax.swing.UIManager.getUI(javax.swing.JComponent)
> (/usr/lib/libgcj.so.4.0.0)
> at javax.swing.JPanel.updateUI()
> (/usr/lib/libgcj.so.4.0.0)
> at
> javax.swing.JPanel.JPanel(java.awt.LayoutManager,
> boolean) (/usr/lib/libgcj.so.4.0.0)
> at javax.swing.JPanel.JPanel()
> (/usr/lib/libgcj.so.4.0.0)
> at javax.swing.JRootPane.createGlassPane()
> (/usr/lib/libgcj.so.4.0.0)
> at javax.swing.JRootPane.getGlassPane()
> (/usr/lib/libgcj.so.4.0.0)
> at javax.swing.JRootPane.JRootPane()
> (/usr/lib/libgcj.so.4.0.0)
> at javax.swing.JFrame.createRootPane()
> (/usr/lib/libgcj.so.4.0.0)
> at javax.swing.JFrame.getRootPane()
> (/usr/lib/libgcj.so.4.0.0)
> at javax.swing.JFrame.frameInit()
> (/usr/lib/libgcj.so.4.0.0)
> at javax.swing.JFrame.JFrame()
> (/usr/lib/libgcj.so.4.0.0)
> at LabelDialog.main(java.lang.String[]) (Unknown
> Source)
>> Could you help me with this problem?

The stacktrace shows that this is not implemented in gcj 3.3. In gcj 
3.4.1 and 3.5.0 your example works (partly).
Michael


More information about the Java mailing list

AltStyle によって変換されたページ (->オリジナル) /