Skip to content

Instantly share code, notes, and snippets.

@kingseungil
Created September 4, 2023 12:34
Show Gist options
  • Save kingseungil/d5e66a2b65bad4939444b7ea482f7323 to your computer and use it in GitHub Desktop.
Save kingseungil/d5e66a2b65bad4939444b7ea482f7323 to your computer and use it in GitHub Desktop.
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
public class PropertyToHTML {
public static void main(String[] args) throws IOException {
File file = new File("src/property.html");
BufferedWriter bw = new BufferedWriter(new FileWriter(file));
bw.write("<html>");
bw.write("<head>");
bw.write("<title>자바 환경정보</title>");
bw.write("<lang=\"ko\">");
bw.write("<meta charset=\"UTF-8\">");
bw.write("<style>");
bw.write("table, th, td { border: 1px solid black; border-collapse: collapse; }");
bw.write("th, td { padding: 8px; text-align: left; }");
bw.write("</style>");
bw.write("</head>");
bw.write("<body>");
bw.write("<h1>자바 환경정보</h1>");
bw.write("<table>");
for (Object k : System.getProperties().keySet()) {
String key = k.toString();
String value = System.getProperty(key);
bw.write("<tr>");
bw.write("<td>" + key + "</td>");
bw.write("<td>" + value + "</td>");
bw.write("</tr>");
}
bw.write("</table>");
bw.write("</body>");
bw.write("</html>");
bw.close();
System.out.println("파일 생성 완료");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment