Skip to content

Instantly share code, notes, and snippets.

@sunghyuck-cpf21b
Created March 17, 2025 10:52
Show Gist options
  • Select an option

  • Save sunghyuck-cpf21b/8f064a0340b34e994926114cff4090eb to your computer and use it in GitHub Desktop.

Select an option

Save sunghyuck-cpf21b/8f064a0340b34e994926114cff4090eb 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 Main {
public static void main(String[] args) {
try {
File file = new File("index.html");
BufferedWriter writer = new BufferedWriter((new FileWriter(file)));
String index = "<head>\n" +
" <title>index</title>\n" +
" <meta charset=\"UTF-8\" />\n" +
" <style>\n" +
" table { border-collapse: collapse; width: 100%; }\n" +
" th, td { border: solid 1px #000; }\n" +
" </style>\n" +
"</head>\n" +
"<body>\n" +
" <table>\n" +
" <tr>\n" +
" <th>키</th>\n" +
" <th>값</th>\n" +
" </tr>\n";
for (Object k : System.getProperties().keySet()) {
String key = k.toString();
String value = System.getProperty(key);
String result = " <tr>\n" +
" <td>" + key + "</td>\n" +
" <td>" + value + "</td>\n" +
" </tr>\n";
index += result;
}
index += " </table>\n</body>";
writer.write(index);
writer.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment