Unable to run Java GUI programs with Ubuntu

前端 未结 9 754
天命终不由人
天命终不由人 2020-12-03 04:28

I am learning GUI in Java, and for that I have created a demo program:

import java.awt.*;

public class FrameDemo extends Frame {

    public FrameDemo(){
           


        
9条回答
  •  伪装坚强ぢ
    2020-12-03 05:09

    Ubuntu has the option to install a headless Java -- this means without graphics libraries. This wasn't always the case, but I encountered this while trying to run a Java text editor on 10.10 the other day. Run the following command to install a JDK that has these libraries:

    sudo apt-get install openjdk-6-jdk
    

    EDIT: Actually, looking at my config, you might need the JRE. If that's the case, run:

    sudo apt-get install openjdk-6-jre
    

提交回复
热议问题