原文地址:

By Artem Ananiev and Alla Redko, June 2006    

Articles Index

This article explains how to use the headless mode capabilities of the Java Platform, Standard Edition (Java SE, formerly referred to as J2SE).

Headless mode is a system configuration in which the display device, keyboard, or mouse is lacking. Sounds unexpected, but actually you can perform different operations in this mode, even with graphic data.

Where it is applicable? Let's say that your application repeatedly generates a certain image, for example, a graphical authorization code that must be changed every time a user logs in to the system. When creating an image, your application needs neither the display nor the keyboard. Let's assume now that you have a mainframe or dedicated server on your project that has no display device, keyboard, or mouse. The ideal decision is to use this environment's substantial computing power for the visual as well as the nonvisual features. An image that was generated in the headless mode system then can be passed to the headful system for further rendering.

Many methods in the java.awt.Toolkit and java.awt.GraphicsEnvironment classes, with the exception of fonts, imaging, and printing, require the availability of a display device, keyboard, and mouse. But some classes, such as Canvas or Panel, can be executed in headless mode. Headless mode support has been available since the J2SE 1.4 platform.

Note: This article will point the reader to documentation for version 6 of the Java SE platform. Any API additions or other enhancements to the Java SE platform specification are subject to review and approval by the JSR 270 Expert Group.

Toolkit

The java.awt.Toolkit class is an abstract superclass of all actual implementations of the Abstract Window Toolkit (AWT). Subclasses of Toolkit are used to bind the various AWT components to particular native toolkit implementations.

Many components are affected if a display device, keyboard, or mouse is not supported. An appropriate class constructor throws a HeadlessException :

  • Button
  • Checkbox
  • Choice
  • Dialog
  • FileDialog
  • Frame
  • Label
  • List
  • Menu
  • MenuBar
  • MenuItem
  • PopupMenu
  • Scrollbar
  • ScrollPane
  • TextArea
  • TextField
  • Window

Such heavyweight components require a peer at the operating-system level, which cannot be guaranteed on headless machines.

Methods related to Canvas, Panel, and Image components do not need to throw aHeadlessException because these components can be given empty peers and treated as lightweight components.

The Headless toolkit also binds the Java technology components to the native resources, but it does so when resources don't include a display device or input devices.

Graphics Environment

The java.awt.GraphicsEnvironment class is an abstract class that describes the collection ofGraphicsDevice objects and Font objects available to a Java technology application on a particular platform. The resources in this GraphicsEnvironment might be local or on a remote machine. GraphicsDevice objects can be monitors, printers, or image buffers and are the destination of Graphics2D drawing methods. Each GraphicsDevice has manyGraphicsConfiguration objects associated with it. These objects specify the different configurations in which the GraphicsDevice can be used.

Table 1 shows the GraphicsEnvironment methods that check for headless mode support.

Table 1. The Headless Mode Methods
Method Description
public static boolean 
isHeadless()
Tests whether the environment is headless, and therefore does not support a display device, keyboard, or mouse. If this method returnstrue, a HeadlessException is thrown from areas of the Toolkit andGraphicsEnvironment classes that depend on a display device, keyboard, or mouse.
public boolean 
isHeadlessInstance()
Returns whether this GraphicsEnvironment can support a display device, keyboard, or mouse. If this method returns true, aHeadlessException is thrown from areas of theGraphicsEnvironment that depend on a display device, keyboard, or mouse.

Note: The isHeadless() method checks the specific system property, java.awt.headless, instead of the system's hardware configuration.

HeadlessException is thrown when code that depends on a display device, keyboard, or mouse is called in an environment that does not support any of these. The exception is derived from an UnsupportedOperationException, which is itself derived from a RuntimeException.

Setting Up Headless Mode

To use headless mode operations, you must first understand how to check and set up the system properties related to this mode. In addition, you must understand how to create a default toolkit to use the headless implementation of the Toolkit class.

System Properties Setup

To set up headless mode, set the appropriate system property by using the setProperty()method. This method enables you to set the desired value for the system property that is indicated by the specific key.

System.setProperty("java.awt.headless", "true");

In this code, java.awt.headless is a system property, and true is a value that is assigned to it.

You can also use the following command line if you plan to run the same application in both a headless and a traditional environment:

java -Djava.awt.headless=true

Default Toolkit Creation

If a system property named java.awt.headless is set to true, then the headless implementation of Toolkit is used. Use the getDefaultToolkit() method of the Toolkit class to create an instance of headless toolkit:

Toolkit tk = Toolkit.getDefaultToolkit();

Headless Mode Check

To check the availability of headless mode, use the isHeadless() method of theGraphicsEnvironment class:

GraphicsEnvironment ge =
GraphicsEnvironment.getLocalGraphicsEnvironment();
boolean headless_check = ge.isHeadless();

This method checks the java.awt.headless system property. If this property has a true value, then a HeadlessException will be thrown from areas of the Toolkit andGraphicsEnvironment classes that are dependent on a display device, keyboard, or mouse.

Operating in Headless Mode

After setting up headless mode and creating an instance of the headless toolkit, your application can perform the following operations:

  • Create lightweight components such as Canvas, Panel, and Swing components, except the top levels
  • Obtain information about available fonts, font metrics, and font settings
  • Set color for rendering text and graphics
  • Create and obtain images and prepare images for rendering
  • Print using java.awt.PrintJobjava.awt.print.*, and javax.print.* classes
  • Emit an audio beep

Canvas

The following code represents a blank rectangular area of the screen onto which you can draw lines. To create a new Canvas component, use the Canvas class.

        final Canvas c = new Canvas(){public void paint(Graphics g){Rectangle r = getBounds();g.drawLine(0, 0, r.width - 1, r.height - 1);g.drawLine(0, r.height - 1, r.width - 1, 0);}};

Fonts

This code shows how to set the font with the Font class to draw a text string. The Graphics object is used to render this string.

      public void paint(Graphics g){g.setFont(new Font("Arial", Font.ITALIC, 12));g.drawString("Test", 32, 8);}

Colors

This code shows how to set the color with the specified red, green, and blue values in order to draw a line. The Graphics object is used to render this line.

  public void paint(Graphics g){g.setColor(new Color(255, 127, 0));g.drawLine(0, r.height - 1, r.width - 1, 0);}

Images

In the following code, the read method of the javax.imageio.ImageIO class decodes thegrapefruit.jpg image file shown in Figure 1 and returns a buffered image.

        Image i = null;try{File f = new File("grapefruit.jpg");i = ImageIO.read(f);}catch (Exception z){z.printStackTrace(System.err);}
 
Figure 1. The grapefruit.jpg Image File

Print

This code shows how to print a prepared canvas that enables you to define the printer as the default surface for the paint method.

PrinterJob pj = PrinterJob.getPrinterJob();pj.setPrintable(new Printable(){public int print(Graphics g, PageFormat pf, int pageIndex){if (pageIndex > 0){return Printable.NO_SUCH_PAGE;}((Graphics2D)g).translate(pf.getImageableX(),pf.getImageableY());// Paint canvas.c.paint(g);return Printable.PAGE_EXISTS;}});

Beep

The following code shows how to produce a simple beep sound by using the Toolkit class's beepmethod.

Toolkit tk = Toolkit.getDefaultToolkit();tk.beep();
Using Headless Mode: An Example

The following HeadlessBasics example uses all the capabilities described in this article.

To run this example, compile the following code by using the javac compiler. Copy the image filegrapefruit.jpg to the directory that contains the HeadlessBasics class.

import java.awt.*;
import java.io.*;
import java.awt.print.*;import javax.imageio.*;public class HeadlessBasics
{public static void main(String[] args){// Set system property.// Call this BEFORE the toolkit has been initialized, that is,// before Toolkit.getDefaultToolkit() has been called.System.setProperty("java.awt.headless", "true");// This triggers creation of the toolkit.// Because java.awt.headless property is set to true, this // will be an instance of headless toolkit.Toolkit tk = Toolkit.getDefaultToolkit();// Standard beep is available.tk.beep();// Check whether the application is// running in headless mode.GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();System.out.println("Headless mode: " + ge.isHeadless());// No top levels are allowed.boolean created = false;try{Frame f = new Frame("Frame");created = true;}catch (Exception z){z.printStackTrace(System.err);created = false;}System.err.println("Frame is created: " + created);// No other components except Canvas and Panel are allowed.created = false;try{Button b = new Button("Button");created = true;}catch (Exception z){z.printStackTrace(System.err);created = false;}System.err.println("Button is created: " + created);// Canvases can be created.final Canvas c = new Canvas(){public void paint(Graphics g){Rectangle r = getBounds();g.drawLine(0, 0, r.width - 1, r.height - 1);// Colors work too.g.setColor(new Color(255, 127, 0));g.drawLine(0, r.height - 1, r.width - 1, 0);// And fontsg.setFont(new Font("Arial", Font.ITALIC, 12));g.drawString("Test", 32, 8);}};// And all the operations work correctly.c.setBounds(32, 32, 128, 128);// Images are available.Image i = null;try{File f = new File("grapefruit.jpg");i = ImageIO.read(f);}catch (Exception z){z.printStackTrace(System.err);}final Image im = i;// Print system is available.PrinterJob pj = PrinterJob.getPrinterJob();pj.setPrintable(new Printable(){public int print(Graphics g, PageFormat pf, int pageIndex){if (pageIndex > 0){return Printable.NO_SUCH_PAGE;}((Graphics2D)g).translate(pf.getImageableX(),pf.getImageableY());// Paint the canvas.c.paint(g);// Paint the image.if (im != null){g.drawImage(im, 32, 32, 64, 64, null);}return Printable.PAGE_EXISTS;}});try{pj.print();}catch (Exception z){z.printStackTrace(System.err);}}
}

Figure 2 shows the printed output from this example.

 
Figure 2. The HeadlessBasics Printed Output

Also, you can expect to see the following messages:

Headless mode: true
java.awt.HeadlessException
at java.awt.GraphicsEnvironment.checkHeadless(Unknown Source)
at java.awt.Window.<init>(Unknown Source)
at java.awt.Frame.<init>(Unknown Source)
at HeadlessBasics.main(HeadlessBasics.java:24)
Frame is created: false
java.awt.HeadlessException
at java.awt.GraphicsEnvironment.checkHeadless(Unknown Source)
at java.awt.Button.<init>(Unknown Source)
at HeadlessBasics.main(HeadlessBasics.java:39)
Button is created: false

Note: For demonstration purposes, the original sample code causes the application to throw twojava.awt.HeadlessExceptions.

As an alternative, you can forward the standard output messages to a file and print out the file. In this case, use the following command line to run this example:

java HeadlessBasics 2> standard_output.txt
Converting an Existing Application to Headless Mode

How can you convert your existing application to execute it in headless mode? The most effective way to perform this conversion is to analyze your source code in order to determine any functionality that is dependent on headless mode. In other words, to implement the same functionality, you have to find those methods and classes that can throw a HeadlessExceptionand replace them with the methods and classes that are independent of headless mode.

You can use the Java SE 6 API specification to determine whether a specific method or class is supported in headless mode or not. If a specific component is not supported in headless mode, the only exception your application needs to catch is a HeadlessException. It will be thrown first among the other possible exceptions. That is why the code sample in the section "Example: Using Headless Mode" contains no special requirement to catch the other exceptions.

You will certainly find other useful ways to apply the advantages of headless mode. We hope that this article can help you to accomplish this task and open new horizons in the Java SE platform.

For More Information

AWT Enhancements in J2SE 1.4: Headless Support 
J2SE 1.4 platform documentation: HeadlessException 
The New Modality API in Java SE 6 
The java.awt.Toolkit Class 
The java.awt.GraphicsEnvironment Class

About the Authors

Artem Ananiev is a Sun Microsystems software engineer in Saint Petersburg, Russia. He has been working in the Abstract Window Toolkit (AWT) project for several years, with his primary functional areas in modality, robot, and multiscreen systems.

Alla Redko is a Sun Microsystems technical writer in Saint Petersburg, Russia. She supports documentation for the AWT project and updates the Java Tutorial. Prior to her assignment for Sun, she worked as a technical writer for eight years.

By Artem Ananiev and Alla Redko, June 2006    

Articles Index

This article explains how to use the headless mode capabilities of the Java Platform, Standard Edition (Java SE, formerly referred to as J2SE).

Headless mode is a system configuration in which the display device, keyboard, or mouse is lacking. Sounds unexpected, but actually you can perform different operations in this mode, even with graphic data.

Where it is applicable? Let's say that your application repeatedly generates a certain image, for example, a graphical authorization code that must be changed every time a user logs in to the system. When creating an image, your application needs neither the display nor the keyboard. Let's assume now that you have a mainframe or dedicated server on your project that has no display device, keyboard, or mouse. The ideal decision is to use this environment's substantial computing power for the visual as well as the nonvisual features. An image that was generated in the headless mode system then can be passed to the headful system for further rendering.

Many methods in the java.awt.Toolkit and java.awt.GraphicsEnvironment classes, with the exception of fonts, imaging, and printing, require the availability of a display device, keyboard, and mouse. But some classes, such as Canvas or Panel, can be executed in headless mode. Headless mode support has been available since the J2SE 1.4 platform.

Note: This article will point the reader to documentation for version 6 of the Java SE platform. Any API additions or other enhancements to the Java SE platform specification are subject to review and approval by the JSR 270 Expert Group.

Toolkit

The java.awt.Toolkit class is an abstract superclass of all actual implementations of the Abstract Window Toolkit (AWT). Subclasses of Toolkit are used to bind the various AWT components to particular native toolkit implementations.

Many components are affected if a display device, keyboard, or mouse is not supported. An appropriate class constructor throws a HeadlessException :

  • Button
  • Checkbox
  • Choice
  • Dialog
  • FileDialog
  • Frame
  • Label
  • List
  • Menu
  • MenuBar
  • MenuItem
  • PopupMenu
  • Scrollbar
  • ScrollPane
  • TextArea
  • TextField
  • Window

Such heavyweight components require a peer at the operating-system level, which cannot be guaranteed on headless machines.

Methods related to Canvas, Panel, and Image components do not need to throw aHeadlessException because these components can be given empty peers and treated as lightweight components.

The Headless toolkit also binds the Java technology components to the native resources, but it does so when resources don't include a display device or input devices.

Graphics Environment

The java.awt.GraphicsEnvironment class is an abstract class that describes the collection ofGraphicsDevice objects and Font objects available to a Java technology application on a particular platform. The resources in this GraphicsEnvironment might be local or on a remote machine. GraphicsDevice objects can be monitors, printers, or image buffers and are the destination of Graphics2D drawing methods. Each GraphicsDevice has manyGraphicsConfiguration objects associated with it. These objects specify the different configurations in which the GraphicsDevice can be used.

Table 1 shows the GraphicsEnvironment methods that check for headless mode support.

Table 1. The Headless Mode Methods
Method Description
public static boolean 
isHeadless()
Tests whether the environment is headless, and therefore does not support a display device, keyboard, or mouse. If this method returnstrue, a HeadlessException is thrown from areas of the Toolkit andGraphicsEnvironment classes that depend on a display device, keyboard, or mouse.
public boolean 
isHeadlessInstance()
Returns whether this GraphicsEnvironment can support a display device, keyboard, or mouse. If this method returns true, aHeadlessException is thrown from areas of theGraphicsEnvironment that depend on a display device, keyboard, or mouse.

Note: The isHeadless() method checks the specific system property, java.awt.headless, instead of the system's hardware configuration.

HeadlessException is thrown when code that depends on a display device, keyboard, or mouse is called in an environment that does not support any of these. The exception is derived from an UnsupportedOperationException, which is itself derived from a RuntimeException.

Setting Up Headless Mode

To use headless mode operations, you must first understand how to check and set up the system properties related to this mode. In addition, you must understand how to create a default toolkit to use the headless implementation of the Toolkit class.

System Properties Setup

To set up headless mode, set the appropriate system property by using the setProperty()method. This method enables you to set the desired value for the system property that is indicated by the specific key.

System.setProperty("java.awt.headless", "true");

In this code, java.awt.headless is a system property, and true is a value that is assigned to it.

You can also use the following command line if you plan to run the same application in both a headless and a traditional environment:

java -Djava.awt.headless=true

Default Toolkit Creation

If a system property named java.awt.headless is set to true, then the headless implementation of Toolkit is used. Use the getDefaultToolkit() method of the Toolkit class to create an instance of headless toolkit:

Toolkit tk = Toolkit.getDefaultToolkit();

Headless Mode Check

To check the availability of headless mode, use the isHeadless() method of theGraphicsEnvironment class:

GraphicsEnvironment ge =
GraphicsEnvironment.getLocalGraphicsEnvironment();
boolean headless_check = ge.isHeadless();

This method checks the java.awt.headless system property. If this property has a true value, then a HeadlessException will be thrown from areas of the Toolkit andGraphicsEnvironment classes that are dependent on a display device, keyboard, or mouse.

Operating in Headless Mode

After setting up headless mode and creating an instance of the headless toolkit, your application can perform the following operations:

  • Create lightweight components such as Canvas, Panel, and Swing components, except the top levels
  • Obtain information about available fonts, font metrics, and font settings
  • Set color for rendering text and graphics
  • Create and obtain images and prepare images for rendering
  • Print using java.awt.PrintJobjava.awt.print.*, and javax.print.* classes
  • Emit an audio beep

Canvas

The following code represents a blank rectangular area of the screen onto which you can draw lines. To create a new Canvas component, use the Canvas class.

        final Canvas c = new Canvas(){public void paint(Graphics g){Rectangle r = getBounds();g.drawLine(0, 0, r.width - 1, r.height - 1);g.drawLine(0, r.height - 1, r.width - 1, 0);}};

Fonts

This code shows how to set the font with the Font class to draw a text string. The Graphics object is used to render this string.

      public void paint(Graphics g){g.setFont(new Font("Arial", Font.ITALIC, 12));g.drawString("Test", 32, 8);}

Colors

This code shows how to set the color with the specified red, green, and blue values in order to draw a line. The Graphics object is used to render this line.

  public void paint(Graphics g){g.setColor(new Color(255, 127, 0));g.drawLine(0, r.height - 1, r.width - 1, 0);}

Images

In the following code, the read method of the javax.imageio.ImageIO class decodes thegrapefruit.jpg image file shown in Figure 1 and returns a buffered image.

        Image i = null;try{File f = new File("grapefruit.jpg");i = ImageIO.read(f);}catch (Exception z){z.printStackTrace(System.err);}
 
Figure 1. The grapefruit.jpg Image File

Print

This code shows how to print a prepared canvas that enables you to define the printer as the default surface for the paint method.

PrinterJob pj = PrinterJob.getPrinterJob();pj.setPrintable(new Printable(){public int print(Graphics g, PageFormat pf, int pageIndex){if (pageIndex > 0){return Printable.NO_SUCH_PAGE;}((Graphics2D)g).translate(pf.getImageableX(),pf.getImageableY());// Paint canvas.c.paint(g);return Printable.PAGE_EXISTS;}});

Beep

The following code shows how to produce a simple beep sound by using the Toolkit class's beepmethod.

Toolkit tk = Toolkit.getDefaultToolkit();tk.beep();
Using Headless Mode: An Example

The following HeadlessBasics example uses all the capabilities described in this article.

To run this example, compile the following code by using the javac compiler. Copy the image filegrapefruit.jpg to the directory that contains the HeadlessBasics class.

import java.awt.*;
import java.io.*;
import java.awt.print.*;import javax.imageio.*;public class HeadlessBasics
{public static void main(String[] args){// Set system property.// Call this BEFORE the toolkit has been initialized, that is,// before Toolkit.getDefaultToolkit() has been called.System.setProperty("java.awt.headless", "true");// This triggers creation of the toolkit.// Because java.awt.headless property is set to true, this // will be an instance of headless toolkit.Toolkit tk = Toolkit.getDefaultToolkit();// Standard beep is available.tk.beep();// Check whether the application is// running in headless mode.GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();System.out.println("Headless mode: " + ge.isHeadless());// No top levels are allowed.boolean created = false;try{Frame f = new Frame("Frame");created = true;}catch (Exception z){z.printStackTrace(System.err);created = false;}System.err.println("Frame is created: " + created);// No other components except Canvas and Panel are allowed.created = false;try{Button b = new Button("Button");created = true;}catch (Exception z){z.printStackTrace(System.err);created = false;}System.err.println("Button is created: " + created);// Canvases can be created.final Canvas c = new Canvas(){public void paint(Graphics g){Rectangle r = getBounds();g.drawLine(0, 0, r.width - 1, r.height - 1);// Colors work too.g.setColor(new Color(255, 127, 0));g.drawLine(0, r.height - 1, r.width - 1, 0);// And fontsg.setFont(new Font("Arial", Font.ITALIC, 12));g.drawString("Test", 32, 8);}};// And all the operations work correctly.c.setBounds(32, 32, 128, 128);// Images are available.Image i = null;try{File f = new File("grapefruit.jpg");i = ImageIO.read(f);}catch (Exception z){z.printStackTrace(System.err);}final Image im = i;// Print system is available.PrinterJob pj = PrinterJob.getPrinterJob();pj.setPrintable(new Printable(){public int print(Graphics g, PageFormat pf, int pageIndex){if (pageIndex > 0){return Printable.NO_SUCH_PAGE;}((Graphics2D)g).translate(pf.getImageableX(),pf.getImageableY());// Paint the canvas.c.paint(g);// Paint the image.if (im != null){g.drawImage(im, 32, 32, 64, 64, null);}return Printable.PAGE_EXISTS;}});try{pj.print();}catch (Exception z){z.printStackTrace(System.err);}}
}

Figure 2 shows the printed output from this example.

 
Figure 2. The HeadlessBasics Printed Output

Also, you can expect to see the following messages:

Headless mode: true
java.awt.HeadlessException
at java.awt.GraphicsEnvironment.checkHeadless(Unknown Source)
at java.awt.Window.<init>(Unknown Source)
at java.awt.Frame.<init>(Unknown Source)
at HeadlessBasics.main(HeadlessBasics.java:24)
Frame is created: false
java.awt.HeadlessException
at java.awt.GraphicsEnvironment.checkHeadless(Unknown Source)
at java.awt.Button.<init>(Unknown Source)
at HeadlessBasics.main(HeadlessBasics.java:39)
Button is created: false

Note: For demonstration purposes, the original sample code causes the application to throw twojava.awt.HeadlessExceptions.

As an alternative, you can forward the standard output messages to a file and print out the file. In this case, use the following command line to run this example:

java HeadlessBasics 2> standard_output.txt
Converting an Existing Application to Headless Mode

How can you convert your existing application to execute it in headless mode? The most effective way to perform this conversion is to analyze your source code in order to determine any functionality that is dependent on headless mode. In other words, to implement the same functionality, you have to find those methods and classes that can throw a HeadlessExceptionand replace them with the methods and classes that are independent of headless mode.

You can use the Java SE 6 API specification to determine whether a specific method or class is supported in headless mode or not. If a specific component is not supported in headless mode, the only exception your application needs to catch is a HeadlessException. It will be thrown first among the other possible exceptions. That is why the code sample in the section "Example: Using Headless Mode" contains no special requirement to catch the other exceptions.

You will certainly find other useful ways to apply the advantages of headless mode. We hope that this article can help you to accomplish this task and open new horizons in the Java SE platform.

For More Information

AWT Enhancements in J2SE 1.4: Headless Support 
J2SE 1.4 platform documentation: HeadlessException 
The New Modality API in Java SE 6 
The java.awt.Toolkit Class 
The java.awt.GraphicsEnvironment Class

About the Authors

Artem Ananiev is a Sun Microsystems software engineer in Saint Petersburg, Russia. He has been working in the Abstract Window Toolkit (AWT) project for several years, with his primary functional areas in modality, robot, and multiscreen systems.

Alla Redko is a Sun Microsystems technical writer in Saint Petersburg, Russia. She supports documentation for the AWT project and updates the Java Tutorial. Prior to her assignment for Sun, she worked as a technical writer for eight years.

转载于:https://www.cnblogs.com/davidwang456/p/5863768.html

Using Headless Mode in the Java SE Platform--转相关推荐

  1. 最新的Java SE平台和JDK版本发布计划

    最近发布的Java 9带来了诸多重大变更,包括一个全新的版本发布计划.该发布计划基于JEP 223,主要用于Java平台未来的版本发布. \\ 不过在新版本计划发布之后,Java首席架构师Mark R ...

  2. Java SE 基础知识

    Java SE 基础知识 1 2 @(Notes)[J2SE, Notes] VICTORY LOVES PREPARATION. 特别说明: 该文档在马克飞象查阅最佳: 本部分知识还在迭代中,欢迎补 ...

  3. Java虚拟机规范 Java SE 8版 - class文件格式(一)

    Java虚拟机规范 Java SE 8版 - class文件格式(一) 4.1 ClassFile 结构 4.2 各种名称的内部表示形式 4.2.1 类和接口的二进制名称 4.2.2 非限定名 4.3 ...

  4. Could not target platform: ‘Java SE 11‘ using tool chain

    Execution failed for task ':compileJava'. > Could not target platform: 'Java SE 11' using tool ch ...

  5. Could not target platform: ‘Java SE 11‘ using tool chain: ‘JDK 8 (1.8)‘

    本地 JDK 默认环境: JDK 1.8 新项目需要环境:JDK 11.Gradle 报错信息: Execution failed for task ':democloud:registry:comp ...

  6. java headless_在Java SE上使用Headless模式的超级指南

    这篇文章介绍怎样在标准Java(Java SE,也称作J2SE)平台上用Headless模式. Headless模式是在缺少显示屏.键盘或者鼠标时的系统配置.听起来不可思议,但事实上你可以在这中模式下 ...

  7. Gradle项目报错:Could not target platform: ‘Java SE 17‘ using tool chain: ‘JDK 8 (1.8)‘.

    一.报错信息 > Task :compileJava FAILED FAILURE: Build failed with an exception. * What went wrong: Exe ...

  8. JAVA打开方式不对怎么搞_.jar文件打开方式没有Java(TM) Platform SE binary怎么办?

    5.7mysql安装教程,https://blog.csdn.net/weixin_44051608/article/details/85163823 .jar文件打开方式没有Java(TM) Pla ...

  9. 浅谈Java SE、Java EE、Java ME三者的区别

    1. Java SE(Java Platform,Standard Edition).Java SE 以前称为 J2SE.它允许开发和部署在桌面.服务器.嵌入式环境和实时环境中使用的 Java 应用程 ...

最新文章

  1. SpringBoot BasicService
  2. 智能车竞赛技术报告 | 基础四轮组 - 哈尔滨工程大学 - 济海追风5队
  3. 2204 Problem A(水)
  4. 表贴电阻尺寸与什么有关_PCB板上为什么要“贴黄金”?
  5. 如何设置JTable行颜色
  6. 使用DBI(perl)实现文本文件的导入导出mysql
  7. 长远锂科:拟发行可转债募资不超32.5亿元
  8. Learning a Discriminative Feature Network for Semantic Segmentation(语义分割DFN,区别特征网络)...
  9. VS 2013安装教程
  10. 数据、数据库、数据库管理系统,数据库系统的概念
  11. php msn,利用php给MSN发送消息
  12. windows mobile 开发常见问题
  13. RocketMQ调优总结(system busy或broker busy报错解决)
  14. 微信消息推送神器【一封传话】介绍,让消息推送更简单
  15. 阿里云云效平台提交代码
  16. SpringBoot使用druid的密码加密
  17. 谈谈HashMap为什么是线程不安全的?
  18. 离散数学班委竞选代码实现
  19. 十进制转化成二进制(C++)
  20. C++继承继承知识点

热门文章

  1. java十进制输出_JAVA输入一个十进制数N,输出r进制的数
  2. php5.5.9 新特性,php,_PHP 5.5.9版本中COOKIE的奇怪现象,php - phpStudy
  3. java的标量和聚合量_第5节:Java基础 - 必知必会(下)
  4. fseek linux 大文件_一文搞懂Linux系统开发
  5. jdbc封装工具类代码_JDBC的使用-JDBC(3)
  6. java程序员闯关题网站_Java程序员每周必逛的十大学习网站
  7. Flyme6系统适配教程(Patchrom)
  8. 中plot 函数中字体大小_Excel中的VLOOKUP函数
  9. CUDA编程之快速入门
  10. 知识图谱 (知识计算推理)