[Java] Modules

Module defined what can be used inside the module package and what outside world can use inside our module.

module-info.java

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

module HelloWorld {
    
    requires java.desktop;
    exports helloworld;
    
}

 

Because it requires java.desktop, therefore we can use BufferedImage class:

Greeting.java

package helloworld;

import java.awt.image.BufferedImage;


/**
 *
 * @author bethan
 */

public class Greeting {
    
    BufferedImage image;

    public static void main(String[] args) {
        System.out.println("Hello world");                
    }
    
}

 

上一篇:java生成简单验证图片工具类


下一篇:Java后台生成条形码(linux)生成条形码BarcodePDF417