{"id":611,"date":"2022-05-25T11:33:34","date_gmt":"2022-05-25T03:33:34","guid":{"rendered":"https:\/\/heoffice.com\/?p=611"},"modified":"2022-05-25T11:34:23","modified_gmt":"2022-05-25T03:34:23","slug":"idea-scala","status":"publish","type":"post","link":"https:\/\/heoffice.com\/?p=611","title":{"rendered":"IDEA scala"},"content":{"rendered":"\n<p>When I run a single class of scala with Spark in IDEA, an error happens: <\/p>\n\n\n\n<p>java.lang.NoClassDefFoundError: org\/apache\/spark\/SparkContext<br>at java.lang.Class.getDeclaredMethods0(Native Method)<br>at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)<br>at java.lang.Class.privateGetMethodRecursive(Class.java:3048)<br>at java.lang.Class.getMethod0(Class.java:3018)<br>at java.lang.Class.getMethod(Class.java:1784)<br>at sun.launcher.LauncherHelper.validateMainClass(LauncherHelper.java:544)<br>at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:526)<br>Caused by: java.lang.ClassNotFoundException: org.apache.spark.SparkContext<br>at java.net.URLClassLoader.findClass(URLClassLoader.java:382)<br>at java.lang.ClassLoader.loadClass(ClassLoader.java:424)<br>at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)<br>at java.lang.ClassLoader.loadClass(ClassLoader.java:357)<br>\u2026 7 more<br>Error: A JNI error has occurred, please check your installation and try again<br>Exception in thread &#8220;main&#8221;<br>Process finished with exit code 1<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p>Open the Run\/Debug Configuration of this class dialog, Click &#8220;Modify options&#8221; -&gt; Select &#8220;Include dependencies with &#8220;Provided&#8221; scope&#8221; , then click OK resolved this issue.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>When I run a single class of scala with Spark in IDEA, &#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[65,67],"tags":[],"class_list":["post-611","post","type-post","status-publish","format-standard","hentry","category-idetools","category-scala"],"acf":[],"_links":{"self":[{"href":"https:\/\/heoffice.com\/index.php?rest_route=\/wp\/v2\/posts\/611","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/heoffice.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/heoffice.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/heoffice.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/heoffice.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=611"}],"version-history":[{"count":2,"href":"https:\/\/heoffice.com\/index.php?rest_route=\/wp\/v2\/posts\/611\/revisions"}],"predecessor-version":[{"id":613,"href":"https:\/\/heoffice.com\/index.php?rest_route=\/wp\/v2\/posts\/611\/revisions\/613"}],"wp:attachment":[{"href":"https:\/\/heoffice.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=611"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/heoffice.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=611"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/heoffice.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=611"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}