{"id":358,"date":"2025-09-19T02:05:49","date_gmt":"2025-09-19T02:05:49","guid":{"rendered":"https:\/\/iotnoob.com\/wordpress\/?p=358"},"modified":"2025-09-19T02:05:50","modified_gmt":"2025-09-19T02:05:50","slug":"%e0%b8%81%e0%b8%b2%e0%b8%a3%e0%b8%ab%e0%b8%b2%e0%b8%95%e0%b8%b3%e0%b9%81%e0%b8%ab%e0%b8%99%e0%b9%88%e0%b8%87%e0%b8%9b%e0%b8%b1%e0%b8%88%e0%b8%88%e0%b8%b8%e0%b8%9a%e0%b8%b1%e0%b8%99%e0%b8%82%e0%b8%ad","status":"publish","type":"post","link":"https:\/\/iotnoob.com\/wordpress\/2025\/09\/19\/%e0%b8%81%e0%b8%b2%e0%b8%a3%e0%b8%ab%e0%b8%b2%e0%b8%95%e0%b8%b3%e0%b9%81%e0%b8%ab%e0%b8%99%e0%b9%88%e0%b8%87%e0%b8%9b%e0%b8%b1%e0%b8%88%e0%b8%88%e0%b8%b8%e0%b8%9a%e0%b8%b1%e0%b8%99%e0%b8%82%e0%b8%ad\/","title":{"rendered":"\u0e01\u0e32\u0e23\u0e2b\u0e32\u0e15\u0e33\u0e41\u0e2b\u0e19\u0e48\u0e07\u0e1b\u0e31\u0e08\u0e08\u0e38\u0e1a\u0e31\u0e19\u0e02\u0e2d\u0e07 Jar file"},"content":{"rendered":"\n<p>\u0e1a\u0e32\u0e07\u0e04\u0e23\u0e31\u0e49\u0e07\u0e40\u0e23\u0e32\u0e15\u0e49\u0e2d\u0e07\u0e01\u0e32\u0e23\u0e23\u0e39\u0e49\u0e15\u0e33\u0e41\u0e2b\u0e19\u0e48\u0e07\u0e02\u0e2d\u0e07\u0e44\u0e1f\u0e25\u0e4c \u0e40\u0e1e\u0e23\u0e32\u0e30\u0e15\u0e49\u0e2d\u0e07\u0e01\u0e32\u0e23\u0e2d\u0e48\u0e32\u0e19\u0e44\u0e1f\u0e25\u0e4c\u0e17\u0e35\u0e48\u0e2d\u0e22\u0e39\u0e48\u0e43\u0e19 folder \u0e40\u0e14\u0e35\u0e22\u0e27\u0e01\u0e31\u0e19 &#8211; \u0e40\u0e0a\u0e48\u0e19\u0e44\u0e1f\u0e25\u0e4c config \u0e2b\u0e23\u0e37\u0e2d license &#8211; \u0e0b\u0e36\u0e48\u0e07\u0e01\u0e32\u0e23\u0e08\u0e30\u0e43\u0e2a\u0e48\u0e44\u0e27\u0e49\u0e43\u0e19\u0e44\u0e1f\u0e25\u0e4c .jar \u0e40\u0e25\u0e22 \u0e21\u0e31\u0e19\u0e44\u0e21\u0e48\u0e2a\u0e30\u0e14\u0e27\u0e01 \u0e41\u0e01\u0e49\u0e44\u0e02\u0e22\u0e32\u0e01 \u0e2d\u0e32\u0e08\u0e17\u0e33\u0e43\u0e2b\u0e49\u0e44\u0e1f\u0e25\u0e4c\u0e40\u0e2a\u0e35\u0e22\u0e2b\u0e32\u0e22\u0e44\u0e14\u0e49 (\u0e43\u0e19\u0e1a\u0e32\u0e07\u0e04\u0e23\u0e31\u0e49\u0e07\u0e40\u0e23\u0e32\u0e01\u0e47\u0e43\u0e2a\u0e48\u0e44\u0e14\u0e49 \u0e16\u0e49\u0e32\u0e40\u0e23\u0e32\u0e44\u0e21\u0e48\u0e15\u0e49\u0e2d\u0e07\u0e01\u0e32\u0e23\u0e43\u0e2b\u0e49\u0e41\u0e01\u0e49\u0e44\u0e02\u0e07\u0e48\u0e32\u0e22 \u0e2b\u0e23\u0e37\u0e2d\u0e2d\u0e22\u0e32\u0e01\u0e08\u0e30\u0e0b\u0e48\u0e2d\u0e19\u0e40\u0e2d\u0e32\u0e44\u0e27\u0e49 &#8211; \u0e0b\u0e36\u0e48\u0e07\u0e01\u0e47\u0e21\u0e35\u0e27\u0e34\u0e18\u0e35\u0e40\u0e0a\u0e48\u0e19\u0e01\u0e31\u0e19)<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"java\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">import java.io.BufferedReader;\nimport java.io.File;\nimport java.io.FileReader;\nimport java.io.IOException;\nimport java.net.URISyntaxException;\nimport java.nio.file.Paths;\n\npublic class ReadFileFromJarLocation {\n\n    public static void main(String[] args) {\n        try {\n            \/\/ 1. \u0e2b\u0e32\u0e15\u0e33\u0e41\u0e2b\u0e19\u0e48\u0e07\u0e02\u0e2d\u0e07\u0e44\u0e1f\u0e25\u0e4c JAR\n            File jarFile = new File(ReadFileFromJarLocation.class.getProtectionDomain().getCodeSource().getLocation().toURI());\n            String jarDir = jarFile.getParent(); \/\/ \u0e44\u0e14\u0e49\u0e40\u0e1b\u0e47\u0e19 directory \u0e17\u0e35\u0e48\u0e40\u0e01\u0e47\u0e1a JAR\n\n            \/\/ 2. \u0e23\u0e30\u0e1a\u0e38\u0e15\u0e33\u0e41\u0e2b\u0e19\u0e48\u0e07\u0e41\u0e25\u0e30\u0e0a\u0e37\u0e48\u0e2d\u0e44\u0e1f\u0e25\u0e4c\u0e17\u0e35\u0e48\u0e15\u0e49\u0e2d\u0e07\u0e01\u0e32\u0e23\u0e2d\u0e48\u0e32\u0e19\n            File textFile = new File(jarDir, \"your-text-file.txt\"); \/\/ \u0e40\u0e1b\u0e25\u0e35\u0e48\u0e22\u0e19 \"your-text-file.txt\" \u0e40\u0e1b\u0e47\u0e19\u0e0a\u0e37\u0e48\u0e2d\u0e44\u0e1f\u0e25\u0e4c\u0e02\u0e2d\u0e07\u0e04\u0e38\u0e13\n\n            \/\/ 3. \u0e2d\u0e48\u0e32\u0e19\u0e44\u0e1f\u0e25\u0e4c\n            if (textFile.exists()) {\n                System.out.println(\"Reading file from: \" + textFile.getAbsolutePath());\n                try (BufferedReader reader = new BufferedReader(new FileReader(textFile))) {\n                    String line;\n                    while ((line = reader.readLine()) != null) {\n                        System.out.println(line);\n                    }\n                }\n            } else {\n                System.out.println(\"File not found: \" + textFile.getAbsolutePath());\n            }\n\n        } catch (URISyntaxException | IOException e) {\n            e.printStackTrace();\n        }\n    }\n}<\/pre>\n\n\n\n<p>\u0e40\u0e23\u0e32\u0e43\u0e0a\u0e49 <code>ReadFileFromJarLocation.class.getProtectionDomain().getCodeSource().getLocation().toURI()<\/code> \u0e40\u0e1e\u0e37\u0e48\u0e2d\u0e2b\u0e32\u0e15\u0e33\u0e41\u0e2b\u0e19\u0e48\u0e07 (path) \u0e02\u0e2d\u0e07\u0e42\u0e04\u0e49\u0e14\u0e17\u0e35\u0e48\u0e01\u0e33\u0e25\u0e31\u0e07\u0e17\u0e33\u0e07\u0e32\u0e19\u0e2d\u0e22\u0e39\u0e48 \u0e0b\u0e36\u0e48\u0e07\u0e40\u0e21\u0e37\u0e48\u0e2d\u0e23\u0e31\u0e19\u0e08\u0e32\u0e01 JAR \u0e01\u0e47\u0e04\u0e37\u0e2d\u0e15\u0e33\u0e41\u0e2b\u0e19\u0e48\u0e07\u0e02\u0e2d\u0e07 JAR \u0e44\u0e1f\u0e25\u0e4c\u0e19\u0e31\u0e48\u0e19\u0e40\u0e2d\u0e07<\/p>\n\n\n\n<p><code>jarFile.getParent()<\/code> \u0e08\u0e30\u0e43\u0e2b\u0e49\u0e1c\u0e25\u0e25\u0e31\u0e1e\u0e18\u0e4c\u0e40\u0e1b\u0e47\u0e19 path \u0e02\u0e2d\u0e07\u0e42\u0e1f\u0e25\u0e40\u0e14\u0e2d\u0e23\u0e4c\u0e17\u0e35\u0e48\u0e40\u0e01\u0e47\u0e1a\u0e44\u0e1f\u0e25\u0e4c JAR \u0e19\u0e31\u0e49\u0e19\u0e44\u0e27\u0e49<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u0e1a\u0e32\u0e07\u0e04\u0e23\u0e31\u0e49\u0e07\u0e40\u0e23\u0e32\u0e15\u0e49\u0e2d\u0e07\u0e01\u0e32\u0e23\u0e23\u0e39\u0e49\u0e15\u0e33\u0e41\u0e2b\u0e19\u0e48\u0e07\u0e02\u0e2d\u0e07\u0e44\u0e1f\u0e25\u0e4c \u0e40\u0e1e\u0e23\u0e32\u0e30\u0e15\u0e49\u0e2d\u0e07\u0e01\u0e32\u0e23\u0e2d\u0e48\u0e32\u0e19\u0e44\u0e1f\u0e25\u0e4c\u0e17\u0e35\u0e48\u0e2d\u0e22\u0e39\u0e48\u0e43\u0e19 folder \u0e40\u0e14\u0e35\u0e22\u0e27\u0e01\u0e31\u0e19 &#8211; \u0e40\u0e0a\u0e48\u0e19\u0e44\u0e1f\u0e25\u0e4c config \u0e2b\u0e23\u0e37\u0e2d license &#8211; \u0e0b\u0e36\u0e48\u0e07\u0e01\u0e32\u0e23\u0e08\u0e30\u0e43\u0e2a\u0e48\u0e44\u0e27\u0e49\u0e43\u0e19\u0e44\u0e1f\u0e25\u0e4c .jar \u0e40\u0e25\u0e22 \u0e21\u0e31\u0e19\u0e44\u0e21\u0e48\u0e2a\u0e30\u0e14\u0e27\u0e01 \u0e41\u0e01\u0e49\u0e44\u0e02\u0e22\u0e32\u0e01&hellip;<\/p>\n","protected":false},"author":1,"featured_media":346,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,2],"tags":[],"class_list":["post-358","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-java","category-programming"],"_links":{"self":[{"href":"https:\/\/iotnoob.com\/wordpress\/wp-json\/wp\/v2\/posts\/358","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/iotnoob.com\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/iotnoob.com\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/iotnoob.com\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/iotnoob.com\/wordpress\/wp-json\/wp\/v2\/comments?post=358"}],"version-history":[{"count":1,"href":"https:\/\/iotnoob.com\/wordpress\/wp-json\/wp\/v2\/posts\/358\/revisions"}],"predecessor-version":[{"id":359,"href":"https:\/\/iotnoob.com\/wordpress\/wp-json\/wp\/v2\/posts\/358\/revisions\/359"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/iotnoob.com\/wordpress\/wp-json\/wp\/v2\/media\/346"}],"wp:attachment":[{"href":"https:\/\/iotnoob.com\/wordpress\/wp-json\/wp\/v2\/media?parent=358"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/iotnoob.com\/wordpress\/wp-json\/wp\/v2\/categories?post=358"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/iotnoob.com\/wordpress\/wp-json\/wp\/v2\/tags?post=358"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}