{"id":4998,"date":"2026-08-30T02:10:35","date_gmt":"2026-08-29T17:10:35","guid":{"rendered":"https:\/\/donguri3.net\/server-tech\/resolving-kicad-freerouting-java-version-issues-2\/"},"modified":"2026-08-30T02:10:37","modified_gmt":"2026-08-29T17:10:37","slug":"resolving-kicad-freerouting-java-version-issues","status":"publish","type":"post","link":"https:\/\/donguri3.net\/en\/server-tech\/development-programming-git\/resolving-kicad-freerouting-java-version-issues\/","title":{"rendered":"KiCad Freerouting Plugin Java Version Detection Error and Countermeasures"},"content":{"rendered":"<p class=\"\">When I launched KiCad the other day for the first time in a while, I noticed that the KiCad version had been updated to <strong>v9.0.0<\/strong>. I updated to the latest version without thinking much about it, but I ran into an issue with the Freerouting plugin, so I&#8217;m sharing it here.<\/p>\n<h2>Installing the Freerouting Plugin<\/h2>\n<ol>\n<li>Select &#8220;Plugin and Content Manager&#8221; from the KiCad home page.<\/li>\n<li>Type &#8220;Freerouting&#8221; into the filter.<\/li>\n<li>Click the Install button for Freerouting, click &#8220;Apply Pending Changes&#8221; at the bottom right, and complete the installation. Verify that it is registered as installed.<a href=\"https:\/\/donguri3.net\/wp-content\/uploads\/2025\/04\/cd6f135269b8459f37e4e852f3d7d953.png\"><br \/>\n<\/a><a href=\"https:\/\/donguri3.net\/wp-content\/uploads\/2025\/04\/cd6f135269b8459f37e4e852f3d7d953.png\"><img decoding=\"async\" class=\"aligncenter wp-image-1001 size-full\" src=\"https:\/\/donguri3.net\/wp-content\/uploads\/2025\/04\/cd6f135269b8459f37e4e852f3d7d953.png\" alt=\"Freerouting plugin\" width=\"924\" height=\"507\" srcset=\"https:\/\/donguri3.net\/wp-content\/uploads\/2025\/04\/cd6f135269b8459f37e4e852f3d7d953.png 924w, https:\/\/donguri3.net\/wp-content\/uploads\/2025\/04\/cd6f135269b8459f37e4e852f3d7d953-300x165.png 300w, https:\/\/donguri3.net\/wp-content\/uploads\/2025\/04\/cd6f135269b8459f37e4e852f3d7d953-768x421.png 768w\" sizes=\"(max-width: 924px) 100vw, 924px\" \/><\/a><\/li>\n<\/ol>\n<h2 class=\"\">Issue After Version Upgrade<\/h2>\n<p class=\"\">Due to the version upgrade, the <strong>Freerouting plugin<\/strong> I had been using previously was no longer installed, so I reinstalled it. However, after installing the plugin and trying to use Freerouting, the following error message started appearing.<\/p>\n<p><a href=\"https:\/\/donguri3.net\/wp-content\/uploads\/2025\/04\/23e0be83d62369e54c0efe20b04bea61.png\"><img decoding=\"async\" class=\"aligncenter wp-image-977 size-full\" src=\"https:\/\/donguri3.net\/wp-content\/uploads\/2025\/04\/23e0be83d62369e54c0efe20b04bea61.png\" alt=\"Required version\" width=\"467\" height=\"146\" srcset=\"https:\/\/donguri3.net\/wp-content\/uploads\/2025\/04\/23e0be83d62369e54c0efe20b04bea61.png 467w, https:\/\/donguri3.net\/wp-content\/uploads\/2025\/04\/23e0be83d62369e54c0efe20b04bea61-300x94.png 300w\" sizes=\"(max-width: 467px) 100vw, 467px\" \/><\/a><\/p>\n<blockquote>\n<p class=\"\">&#8220;Java JRE version 21 or higher is required &#8230;&#8221;<\/p>\n<\/blockquote>\n<p class=\"\">This error occurs when the plugin checks the Java version internally. Even though <strong>Java 21<\/strong> was actually installed correctly on my environment, the plugin incorrectly determined that the version was insufficient.<br \/>\n<a href=\"https:\/\/donguri3.net\/wp-content\/uploads\/2025\/04\/7b4d306d6dc334ee21c1542a138cac0b-e1742654819311.png\"><img decoding=\"async\" class=\"aligncenter wp-image-979 size-large\" src=\"https:\/\/donguri3.net\/wp-content\/uploads\/2025\/04\/7b4d306d6dc334ee21c1542a138cac0b-1024x582.png\" alt=\"JRE\" width=\"1024\" height=\"582\" \/><\/a><\/p>\n<h2 class=\"\">Cause of Error and Investigation<\/h2>\n<p class=\"\">As I investigated further, I found that the cause of the problem lies in the version check process within the Python script. Specifically, the plugin retrieves the Java version using a function like the one below.<br \/>\nThe file is located at C:\\Users\\&lt;USER&gt;\\Documents\\KiCad\\9.0\\3rdparty\\plugins\\app_freerouting_kicad-plugin\\plugin.py<\/p>\n<div class=\"contain-inline-size rounded-md border-[0.5px] border-token-border-medium relative bg-token-sidebar-surface-primary\">\n<div class=\"flex items-center text-token-text-secondary px-4 py-2 text-xs font-sans justify-between h-9 bg-token-sidebar-surface-primary dark:bg-token-main-surface-secondary select-none rounded-t-[5px]\">\n<pre>def get_java_version(javaPath):\n    try:\n         javaInfo = subprocess.check_output(javaPath + ' -version', shell=True, stderr=subprocess.STDOUT)\n         javaVersions = [re.search(r'([0-9\\._]+)', v).group(1).replace('\"', '') for v in javaInfo.decode().splitlines()]\n         for v in javaVersions:\n             if v.split(\".\")[0].isdigit():\n                 return v\n    except:\n         pass\n    return \"0.0.0.0\"<\/pre>\n<\/div>\n<\/div>\n<p class=\"\">In the code above, the <code>java -version<\/code> command is executed using <code>subprocess.check_output()<\/code>. However, issues around subprocess.check_output prevented it from obtaining the correct version information.<\/p>\n<p class=\"\">The output of <code>java -version<\/code> looks like this, and the first line contains the accurate version information:<\/p>\n<div class=\"contain-inline-size rounded-md border-[0.5px] border-token-border-medium relative bg-token-sidebar-surface-primary\">\n<div class=\"flex items-center text-token-text-secondary px-4 py-2 text-xs font-sans justify-between h-9 bg-token-sidebar-surface-primary dark:bg-token-main-surface-secondary select-none rounded-t-[5px]\">\n<pre>openjdk version \"21.0.6\" 2025-01-21 LTS\nOpenJDK Runtime Environment Temurin-21.0.6+7 (build 21.0.6+7-LTS)\nOpenJDK 64-Bit Server VM Temurin-21.0.6+7 (build 21.0.6+7-LTS, mixed mode, sharing)<\/pre>\n<\/div>\n<\/div>\n<h2 class=\"\">Solution<\/h2>\n<p class=\"\">I tried trial and error to figure out how to modify it so that it could retrieve the correct Java version, but in conclusion, it didn&#8217;t go well. Giving up, I implemented a temporary workaround: forcing <code>get_java_version()<\/code> to return <code>\"21.0.6\"<\/code> so that it would work. However, for future compatibility and support for other versions, it is preferable to fix the implementation to correctly extract the version information.<\/p>\n<h3 class=\"\">Example of Modified Code<\/h3>\n<p>Below is an example of the modification reflecting the improvements mentioned above.<\/p>\n<pre>def get_java_version(javaPath):\n    try:\n         # May malfunction if the path contains spaces\n         javaInfo = subprocess.check_output(javaPath + ' -version', shell=True, stderr=subprocess.STDOUT)\n         javaVersions = [re.search(r'([0-9\\._]+)', v).group(1).replace('\"', '') for v in javaInfo.decode().splitlines()]\n         for v in javaVersions:\n             if v.split(\".\")[0].isdigit():\n                 return v\n    except:\n         pass\n    # Forcefully return 21.0.6\n    return \"21.0.6\"<\/pre>\n<p class=\"\">With this modification, <code>\"21.0.6\"<\/code> can be accurately extracted from the output of <code>java -version<\/code>, allowing the plugin to correctly recognize the actual version.<\/p>\n<h2 class=\"\">Conclusion<\/h2>\n<p class=\"\">Sometimes unexpected errors occur when upgrading KiCad or reinstalling plugins. In this case, the issue stemmed from the version retrieval process inside the Python code.<br \/>I used a temporary workaround to forcefully return the version, but a fundamental solution has not been achieved. If anyone knows the correct way to fix this, please let me know.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>When I launched KiCad the other day for the first time in a while, I noticed that the KiCad version had been u [&hellip;]<\/p>\n","protected":false},"author":4,"featured_media":987,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_locale":"en_US","_original_post":"https:\/\/donguri3.net\/?p=974","footnotes":""},"categories":[1172],"tags":[51,387,388,384,47,179,397],"class_list":["post-4998","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-development-programming-git","tag-git","tag-java","tag-java-21","tag-kicad","tag-python","tag-179","tag-397","en-US"],"_links":{"self":[{"href":"https:\/\/donguri3.net\/wp-json\/wp\/v2\/posts\/4998","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/donguri3.net\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/donguri3.net\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/donguri3.net\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/donguri3.net\/wp-json\/wp\/v2\/comments?post=4998"}],"version-history":[{"count":1,"href":"https:\/\/donguri3.net\/wp-json\/wp\/v2\/posts\/4998\/revisions"}],"predecessor-version":[{"id":5001,"href":"https:\/\/donguri3.net\/wp-json\/wp\/v2\/posts\/4998\/revisions\/5001"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/donguri3.net\/wp-json\/wp\/v2\/media\/987"}],"wp:attachment":[{"href":"https:\/\/donguri3.net\/wp-json\/wp\/v2\/media?parent=4998"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/donguri3.net\/wp-json\/wp\/v2\/categories?post=4998"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/donguri3.net\/wp-json\/wp\/v2\/tags?post=4998"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}