This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug AWT/21978] New: GCC 4.0 Awt and Swing problem linux 9.0
- From: "abilalh at yahoo dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 9 Jun 2005 10:26:11 -0000
- Subject: [Bug AWT/21978] New: GCC 4.0 Awt and Swing problem linux 9.0
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
hi, i have redhat linux 9.0 installed(everything) in my pc, and i installed
gcc4.0, but when i complied the java program from deitel&deitel it throws
exceptions,
[root@dsn-bilal java test]# ./PopupTest
Exception in thread "main" java.awt.AWTError: Cannot load AWT toolkit:
at java.awt.Toolkit.getDefaultToolkit() (/opt/gcc4.0/lib/libgcj.so.6.0.0)
at java.awt.EventQueue.invokeLater(java.lang.Runnable)
(/opt/gcc4.0/lib/libgcj.so.6.0.0)
at javax.swing.SwingUtilities.invokeLater(java.lang.Runnable)
(/opt/gcc4.0/lib/libgcj.so.6.0.0)
at javax.swing.RepaintManager.addInvalidComponent(javax.swing.JComponent)
(/opt/gcc4.0/lib/libgcj.so.6.0.0)
at javax.swing.JComponent.revalidate() (/opt/gcc4.0/lib/libgcj.so.6.0.0)
at javax.swing.JComponent.setOpaque(boolean) (/opt/gcc4.0/lib/libgcj.so.6.0.0)
at javax.swing.JPanel.JPanel(java.awt.LayoutManager, boolean)
(/opt/gcc4.0/lib/libgcj.so.6.0.0)
at javax.swing.JPanel.JPanel() (/opt/gcc4.0/lib/libgcj.so.6.0.0)
at javax.swing.JRootPane.createGlassPane() (/opt/gcc4.0/lib/libgcj.so.6.0.0)
at javax.swing.JRootPane.getGlassPane() (/opt/gcc4.0/lib/libgcj.so.6.0.0)
at javax.swing.JRootPane.JRootPane() (/opt/gcc4.0/lib/libgcj.so.6.0.0)
at javax.swing.JFrame.createRootPane() (/opt/gcc4.0/lib/libgcj.so.6.0.0)
at javax.swing.JFrame.getRootPane() (/opt/gcc4.0/lib/libgcj.so.6.0.0)
at javax.swing.JFrame.frameInit() (/opt/gcc4.0/lib/libgcj.so.6.0.0)
at javax.swing.JFrame.JFrame(java.lang.String) (/opt/gcc4.0/lib/libgcj.so.6.0.0)
at PopupTest.PopupTest() (/root/java test/PopupTest.java:13)
at PopupTest.main(java.lang.String[]) (/root/java test/PopupTest.java:67)
at gnu.java.lang.MainThread.call_main() (/opt/gcc4.0/lib/libgcj.so.6.0.0)
at gnu.java.lang.MainThread.run() (/opt/gcc4.0/lib/libgcj.so.6.0.0)
Caused by: java.lang.ClassNotFoundException:
at java.lang.Class.forName(java.lang.String, boolean, java.lang.ClassLoader)
(/opt/gcc4.0/lib/libgcj.so.6.0.0)
at java.lang.Class.forName(java.lang.String) (/opt/gcc4.0/lib/libgcj.so.6.0.0)
at java.awt.Toolkit.getDefaultToolkit() (/opt/gcc4.0/lib/libgcj.so.6.0.0)
...18 more
[root@dsn-bilal java test]#
i have installed gcc4.0 in /opt/gcc4.0 directory and i have checked its paths
using $PATH and $LD_LIB_PATH variables, i have previously installed gcc3.2.2 i
dont know what to do, please tell me step by step to resolve it, i dont know
weather any body have executed any swing program on gcc4.0 or not,
Version-Release number of selected component (if applicable):
How reproducible:
here is the java file
// Fig. 13.8: PopupTest.java
// Demonstrating JPopupMenus
import javax.swing.*;
import java.awt.event.*;
import java.awt.*;
public class PopupTest extends JFrame {
private JRadioButtonMenuItem items[];
private Color colorValues[] =
{ Color.blue, Color.yellow, Color.red };
public PopupTest()
{
super( "Using JPopupMenus" );
final JPopupMenu popupMenu = new JPopupMenu();
ItemHandler handler = new ItemHandler();
String colors[] = { "Blue", "Yellow", "Red" };
ButtonGroup colorGroup = new ButtonGroup();
items = new JRadioButtonMenuItem[ 3 ];
// construct each menu item and add to popup menu; also
// enable event handling for each menu item
for ( int i = 0; i < items.length; i++ ) {
items[ i ] = new JRadioButtonMenuItem( colors[ i ] );
popupMenu.add( items[ i ] );
colorGroup.add( items[ i ] );
items[ i ].addActionListener( handler );
}
getContentPane().setBackground( Color.white );
// define a MouseListener for the window that displays
// a JPopupMenu when the popup trigger event occurs
addMouseListener(
new MouseAdapter() {
public void mousePressed( MouseEvent e )
{ checkForTriggerEvent( e ); }
public void mouseReleased( MouseEvent e )
{ checkForTriggerEvent( e ); }
private void checkForTriggerEvent( MouseEvent e )
{
if ( e.isPopupTrigger() )
popupMenu.show( e.getComponent(),
e.getX(), e.getY() );
}
}
);
setSize( 300, 200 );
show();
}
public static void main( String args[] )
{
PopupTest app = new PopupTest();
app.addWindowListener(
new WindowAdapter() {
public void windowClosing( WindowEvent e )
{
System.exit( 0 );
}
}
);
}
private class ItemHandler implements ActionListener {
public void actionPerformed( ActionEvent e )
{
// determine which menu item was selected
for ( int i = 0; i < items.length; i++ )
if ( e.getSource() == items[ i ] ) {
getContentPane().setBackground(
colorValues[ i ] );
repaint();
return;
}
}
}
}
--
Summary: GCC 4.0 Awt and Swing problem linux 9.0
Product: gcc
Version: 4.1.0
Status: UNCONFIRMED
Severity: critical
Priority: P2
Component: AWT
AssignedTo: fitzsim at redhat dot com
ReportedBy: abilalh at yahoo dot com
CC: gcc-bugs at gcc dot gnu dot org,java-prs at gcc dot gnu
dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21978