Last active
February 12, 2024 08:03
-
-
Save Starlight258/5c98221a6fb71a99526e5eefded5d366 to your computer and use it in GitHub Desktop.
1.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 김명지 | |
import java.io.FileOutputStream; | |
import java.io.IOException; | |
import java.io.OutputStreamWriter; | |
import java.io.Writer; | |
import java.util.Map; | |
import java.util.Properties; | |
public class Main { | |
public static void main(String[] args) { | |
Properties properties = System.getProperties(); | |
try (Writer writer = new OutputStreamWriter(new FileOutputStream("property.html"), "UTF-8")) { | |
writer.write("<!DOCTYPE html>\n"); | |
writer.write("<html>\n"); | |
writer.write("<head>\n"); | |
writer.write("<meta charset=\"UTF-8\">\n"); | |
writer.write("<title>System Properties</title>\n"); | |
writer.write("<style>table { border-collapse: collapse; width: 100%; }"); | |
writer.write("th, td { border:solid 1px #000; }"); | |
writer.write("</style>\n"); | |
writer.write("</head>\n"); | |
writer.write("<body>\n"); | |
writer.write("<h1>자바 환경정보</h1>\n"); | |
writer.write("<table>\n"); | |
writer.write("<tr>\n"); | |
writer.write("<th>Property Name</th>\n"); | |
writer.write("<th>Value</th>\n"); | |
writer.write("</tr>\n"); | |
for (Map.Entry<Object, Object> entry : properties.entrySet()) { | |
writer.write("<tr>\n"); | |
writer.write("<td>" + entry.getKey().toString() + "</td>\n"); | |
writer.write("<td>" + entry.getValue().toString() + "</td>\n"); | |
writer.write("</tr>\n"); | |
} | |
writer.write("</table>\n"); | |
writer.write("</body>\n"); | |
writer.write("</html>\n"); | |
} catch (IOException e) { | |
e.printStackTrace(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment