AWT Libraries Using Java 1.6 on Linux Server in a Data Center

I need to create and save thumbnails (of images from the internet) and store them on a server. Can I use awt libraries (as mentioned below) on a linux server running in a datacenter (no monitor)? I don't know if the server has a graphics card or needs these libraries to work ...

import java.awt.GraphicsConfiguration;
import java.awt.GraphicsDevice;
import java.awt.GraphicsEnvironment;
import java.awt.Graphics2D;
import java.awt.geom.AffineTransform;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.io.OutputStream;
import java.io.FileOutputStream;
import java.net.URL;

import javax.imageio.ImageIO;

import org.springframework.stereotype.Service;

import com.sun.image.codec.jpeg.ImageFormatException;
import com.sun.image.codec.jpeg.JPEGCodec;
import com.sun.image.codec.jpeg.JPEGImageEncoder;
import java.awt.Color;
+2


source to share


1 answer


You can, while you are running java in headless :



java -Djava.awt.headless=true your.MainClass

      

+2


source







All Articles