Java gets the system path font, gets all the file names in a directory, and gets the current path
Copy the code code as follows:
package com.liuxing.test;
import java.awt.GraphicsEnvironment;
import java.io.File;
public class Test {
private static GraphicsEnvironment environment;
/**
* @param args
*/
public static void main(String[] args) {
environment = GraphicsEnvironment.getLocalGraphicsEnvironment();
String[] fonts = environment.getAvailableFontFamilyNames();//Get the system font name
for(int i = 0;i<fonts.length;i++){
System.out.println(fonts[i]);
}
File file=new File("E://QQImage");//Get all file names in a directory
String test[];
test=file.list();
for(int i=0;i<test.length;i++)
{
System.out.println(test[i]);
}
System.out.println("current directory=="+System.getProperty("user.dir"));//Get the current path
}
}