Java Frame (Awt) does not appear on program execution in centos
NickName:Dev Ask DateTime:2015-12-15T22:23:00

Java Frame (Awt) does not appear on program execution in centos

I made a simple AWT program and made it as a jar file using eclipse on windows machine. After making jar, i sent it to my Centos virtual machine and used ssh to login. When i tried to execute the program, it provides no reply.

I installed Xvfb in Centos and set the DISPLAY variable as well. X11 forwarding is also enabled on PUTTY

Java code:

public class TestAWT{

    TestAWT()
    {
         JFrame test = new JFrame();
         test.setVisible(true);
         test.setSize(100,100);
         test.setResizable(false);
         test.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    }

    public static void main(String args[])
    {
        new TestAWT();
    }
}

Execution command:

java -jar testawt.jar
java -jar -Djava.awt.headless=true testawt.jar  -> Throwed Headless Exception

Could some please advise how to solve this problem?

Copyright Notice:Content Author:「Dev」,Reproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/34291634/java-frame-awt-does-not-appear-on-program-execution-in-centos

More about “Java Frame (Awt) does not appear on program execution in centos” related questions

Java Frame (Awt) does not appear on program execution in centos

I made a simple AWT program and made it as a jar file using eclipse on windows machine. After making jar, i sent it to my Centos virtual machine and used ssh to login. When i tried to execute the p...

Show Detail

Java AWT Draw on Translucent Frame

I am having trouble drawing on a translucent frame. When the "alphaValue" is 255 everything works as expected. But I need a translucent frame. I created a small test class below that demonstrate...

Show Detail

Hosting ActiveX controls on a Java AWT Frame?

Is there a way to display a Flash or Adobe Reader ActiveX control in a Java AWT frame? I'm porting a large old J++ application to standard Java and it needs to host a certain ActiveX control on an...

Show Detail

Java AWT drawString() does not display on window

I am following the examples from Java : The complete reference 8th edition (JDK 7) on AWT and I cannot succeed to display a string on the window that appears. The size and title are set correctly a...

Show Detail

AWT Frame does not handle events

The frame opens and close normally but mouse click doesn't work. import java.awt.Frame; import java.awt.Graphics; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java....

Show Detail

Clojure (let [frame (java.awt.Frame.)]) within un-invoked function causes AWT to be started

Whilst going through the Joy of Clojure book, I've succeedding in defining a function that, when invoked, will create and draw on a java.awt.Frame. (defn draw-frame [f x y] (let [frame (java.awt.

Show Detail

Button does not appear in frame

In my source code, import java.awt.Color; import java.awt.Font; import java.awt.Graphics; import javax.swing.ImageIcon; import javax.swing.JButton; import javax.swing.JFrame; public class Object6

Show Detail

Java Swing GUI in a Centos 7 Docker container on a Windows Host

I am building a Docker image FROM centos:7 (I am flexible on the base Linux image) which will run a Java Swing application on a Windows 10 host. When attempting to run the Docker image, I get the

Show Detail

Java AWT Window not shown

I'm on Ubuntu 15.04 and I have written following program: import java.awt.Frame; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; public class TimeTable extends Frame {

Show Detail

Why AWT frame's text field is not appearing?

import java.awt.*; import java.awt.event.*; public class example3 extends Frame implements ActionListener { TextField t; Button b; example3() { t = new TextField(); t.setBo...

Show Detail