We help IT Professionals succeed at work.
Get Started

Could not initialize class sun.awt.X11GraphicsEnvironment on  linux

Shashidhar_Shenoy
on
8,428 Views
Last Modified: 2012-05-07
I am facing problem when i use  JOption in  JOptionPane.showConfirmDialog on linux
same code is running fine in windows.

java.lang.NoClassDefFoundError: Could not initialize class sun.awt.X11GraphicsEnvironment
      java.lang.Class.forName0(Native Method)
      java.lang.Class.forName(Class.java:169)
      java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(GraphicsEnvironment.java:68)
      sun.awt.X11.XToolkit.<clinit>(XToolkit.java:89)
      java.lang.Class.forName0(Native Method)
      java.lang.Class.forName(Class.java:169)
      java.awt.Toolkit$2.run(Toolkit.java:834)
      java.security.AccessController.doPrivileged(Native Method)
      java.awt.Toolkit.getDefaultToolkit(Toolkit.java:826)
      sun.swing.SwingUtilities2$AATextInfo.getAATextInfo(SwingUtilities2.java:126)
      javax.swing.plaf.metal.MetalLookAndFeel.initComponentDefaults(MetalLookAndFeel.java:1556)
      javax.swing.plaf.basic.BasicLookAndFeel.getDefaults(BasicLookAndFeel.java:130)
      javax.swing.plaf.metal.MetalLookAndFeel.getDefaults(MetalLookAndFeel.java:1591)
      javax.swing.UIManager.setLookAndFeel(UIManager.java:541)
      javax.swing.UIManager.setLookAndFeel(UIManager.java:581)
      javax.swing.UIManager.initializeDefaultLAF(UIManager.java:1343)
      javax.swing.UIManager.initialize(UIManager.java:1432)
      javax.swing.UIManager.maybeInitialize(UIManager.java:1420)
      javax.swing.UIManager.getDefaults(UIManager.java:660)
      javax.swing.UIManager.getString(UIManager.java:789)
      javax.swing.JOptionPane.showConfirmDialog(JOptionPane.java:673)
      org.apache.jsp.jsp.ConChange_005fAllocation_jsp._jspService(ConChange_005fAllocation_jsp.java:150)
      org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
      org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331)
      org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
      org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:729)

if(action_id==1)// for Update_Change_Allocation
{
 
	map.put("porposed_id",porposed_id);
	map.put("company",company);
	map.put("meet_date",meet_date);
	map.put("priority",priority);
	map.put("emp_id",emp_id);
	map.put("create_by",create_by);
	map.put("designation_id",designation_id);
 
	if(!company.equals("0") )
	 { 
		int check = 1;
		System.out.println("check taru ranjan"+check);
        int result1 = meet.execute(5,map,con);
		System.out.println("result1 taru ranjan"+result1);
        int result2 = meet.execute(6,map,con);
		//System.out.println("result2 taru ranjan"+result2);
		if(result1 > 0 )
		{
	      check =JOptionPane.showConfirmDialog(null, "Schedule date is already assigned to employee for other company. Do you want to continue ?");
		  System.out.println("check"+check);
			if( check == 1 || check == 2 )
			{
			  result=3;
			}
			else
			{
			result = meet.execute(1,map,con);
			}
	    }
		else
		{
		  result = meet.execute(1,map,con);
		}
     }
 
 
	//System.out.println("result="+result);
}

Open in new window

Comment
Watch Question
Commented:
This problem has been solved!
Unlock 1 Answer and 2 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE