{"id":2583,"date":"2017-06-19T16:15:19","date_gmt":"2017-06-19T16:15:19","guid":{"rendered":"https:\/\/www.testingdocs.com\/questions\/?p=2583"},"modified":"2021-03-20T09:18:57","modified_gmt":"2021-03-20T09:18:57","slug":"how-to-resolve-java-lang-error-unresolved-compilation-problem","status":"publish","type":"post","link":"https:\/\/www.testingdocs.com\/questions\/how-to-resolve-java-lang-error-unresolved-compilation-problem\/","title":{"rendered":"How to resolve java.lang.Error: Unresolved compilation problem"},"content":{"rendered":"<h3>Introduction<\/h3>\n<p>Unresolved compilation problems in the code are due to compilation errors in the code.<br \/>\nMany problems can be detected if we use an IDE like IntelliJ, Eclipse IDE, etc. This is a very generic error and there could be multiple reasons to get this error.<\/p>\n<h3>Error<\/h3>\n<p>Let&#8217;s see a sample error that has a typo in the method name.<\/p>\n<p>Exception in thread &#8220;main&#8221; java.lang.Error: Unresolved compilation problem:<br \/>\nThe method printl(String) is undefined for the type PrintStream<\/p>\n<p>at JavaOutputDemo.main(JavaOutputDemo.java:5)<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-2584\" src=\"https:\/\/www.testingdocs.com\/questions\/wp-content\/uploads\/Unresolved-compilation-problem-Java.png\" alt=\"Unresolved compilation problem\" width=\"1738\" height=\"1004\" title=\"\" srcset=\"https:\/\/www.testingdocs.com\/questions\/wp-content\/uploads\/Unresolved-compilation-problem-Java.png 1738w, https:\/\/www.testingdocs.com\/questions\/wp-content\/uploads\/Unresolved-compilation-problem-Java-300x173.png 300w, https:\/\/www.testingdocs.com\/questions\/wp-content\/uploads\/Unresolved-compilation-problem-Java-1024x592.png 1024w, https:\/\/www.testingdocs.com\/questions\/wp-content\/uploads\/Unresolved-compilation-problem-Java-768x444.png 768w, https:\/\/www.testingdocs.com\/questions\/wp-content\/uploads\/Unresolved-compilation-problem-Java-1536x887.png 1536w\" sizes=\"auto, (max-width: 1738px) 100vw, 1738px\" \/><\/p>\n<h3>Fix<\/h3>\n<p>As we can see in the Error stack trace, printl(String) is undefined for the type PrintStream.<\/p>\n<p>There is a typo in the method name: printl<\/p>\n<p>The correct method name is println()<\/p>\n<p>i.e System.out.println();<\/p>\n<h3>IDE<\/h3>\n<p>Using IDE would detect this kind of error and prompt the developer with fixes. In this case, if we hover the mouse would show the correct method names for the class.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-2585\" src=\"https:\/\/www.testingdocs.com\/questions\/wp-content\/uploads\/Fix-Compilation-Error-IDE.png\" alt=\"\" width=\"1744\" height=\"1009\" title=\"\" srcset=\"https:\/\/www.testingdocs.com\/questions\/wp-content\/uploads\/Fix-Compilation-Error-IDE.png 1744w, https:\/\/www.testingdocs.com\/questions\/wp-content\/uploads\/Fix-Compilation-Error-IDE-300x174.png 300w, https:\/\/www.testingdocs.com\/questions\/wp-content\/uploads\/Fix-Compilation-Error-IDE-1024x592.png 1024w, https:\/\/www.testingdocs.com\/questions\/wp-content\/uploads\/Fix-Compilation-Error-IDE-768x444.png 768w, https:\/\/www.testingdocs.com\/questions\/wp-content\/uploads\/Fix-Compilation-Error-IDE-1536x889.png 1536w\" sizes=\"auto, (max-width: 1744px) 100vw, 1744px\" \/><\/p>\n<p>&nbsp;<\/p>\n<h3>Another Example<\/h3>\n<p>Exception in thread &#8220;main&#8221; java.lang.Error: Unresolved compilation problem:<\/p>\n<p>at Sample\/com.testingdocs.tutorial.Test.main(Test.java:50)<\/p>\n<p>&nbsp;<\/p>\n<p>Fix: The project is configured with modules. An there is a missing entry for the required module\u00a0 module-info.java. Add the required module in the file and save the file.<\/p>\n<p>For example:<\/p>\n<p><strong>module Sample {<\/strong><br \/>\n<strong>requires java.desktop;<\/strong><br \/>\n<strong>}<\/strong><\/p>\n<!--themify_builder_content-->\n<div id=\"themify_builder_content-2583\" data-postid=\"2583\" class=\"themify_builder_content themify_builder_content-2583 themify_builder tf_clear\">\n    <\/div>\n<!--\/themify_builder_content-->\n","protected":false},"excerpt":{"rendered":"<p>Introduction Unresolved compilation problems in the code are due to compilation errors in the code. Many problems can be detected if we use an IDE like IntelliJ, Eclipse IDE, etc. This is a very generic error and there could be multiple reasons to get this error. Error Let&#8217;s see a sample error that has a [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[40],"tags":[],"class_list":["post-2583","post","type-post","status-publish","format-standard","hentry","category-java","has-post-title","has-post-date","has-post-category","has-post-tag","has-post-comment","has-post-author",""],"_links":{"self":[{"href":"https:\/\/www.testingdocs.com\/questions\/wp-json\/wp\/v2\/posts\/2583","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.testingdocs.com\/questions\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.testingdocs.com\/questions\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.testingdocs.com\/questions\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.testingdocs.com\/questions\/wp-json\/wp\/v2\/comments?post=2583"}],"version-history":[{"count":4,"href":"https:\/\/www.testingdocs.com\/questions\/wp-json\/wp\/v2\/posts\/2583\/revisions"}],"predecessor-version":[{"id":19549,"href":"https:\/\/www.testingdocs.com\/questions\/wp-json\/wp\/v2\/posts\/2583\/revisions\/19549"}],"wp:attachment":[{"href":"https:\/\/www.testingdocs.com\/questions\/wp-json\/wp\/v2\/media?parent=2583"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.testingdocs.com\/questions\/wp-json\/wp\/v2\/categories?post=2583"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.testingdocs.com\/questions\/wp-json\/wp\/v2\/tags?post=2583"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}