{"id":938,"date":"2016-06-02T00:29:57","date_gmt":"2016-06-01T22:29:57","guid":{"rendered":"http:\/\/hobbykeller.spdns.de\/?p=938"},"modified":"2023-09-16T19:28:34","modified_gmt":"2023-09-16T17:28:34","slug":"always-trouble-with-karel","status":"publish","type":"post","link":"https:\/\/hobbykeller.spdns.de\/?p=938","title":{"rendered":"Always trouble with Karel&#8230;"},"content":{"rendered":"\n<div class=\"wp-block-simple-alerts-for-gutenberg-alert-boxes sab-alert sab-alert-primary\" role=\"alert\">This post is deprecated and replaced by a <a href=\"https:\/\/hobbykeller.spdns.de\/?p=1832\" data-type=\"post\" data-id=\"1832\">newer version<\/a>.<button type=\"button\" class=\"close\" data-dismiss=\"alert\" aria-label=\"Close\"><span aria-hidden=\"true\">\u00d7<\/span><\/button><\/div>\n\n\n<div class=\"wp-block-image wp-image-939 size-full\">\n<figure class=\"alignleft\"><img loading=\"lazy\" decoding=\"async\" width=\"87\" height=\"97\" src=\"http:\/\/hobbykeller.spdns.de\/wp-content\/uploads\/2016\/06\/karel.png\" alt=\"Stanford's Karel\" class=\"wp-image-939\"\/><figcaption class=\"wp-element-caption\">Stanford&#8217;s Karel<\/figcaption><\/figure>\n<\/div>\n\n\n<p>If you want to learn about computer science in general and about Java programming in particular, maybe one of the best learning ressources to look at is the <a href=\"https:\/\/see.stanford.edu\/Course\/CS106A\/\" target=\"_blank\" rel=\"noopener\">CS106A online course by Stanford University<\/a>. To get people familiar with programming, the first lessons make use of a virtual robot (&#8220;Karel&#8221;) created by Stanford to run inside the popular Eclipse IDE. This post shows how to get the Stanford code running in your Ubuntu installation and maybe even under MacOS or Windows.<\/p>\n\n\n\n<!--more-->\n\n\n\n<h1 class=\"wp-block-heading\">It&#8217;s been a few years though&#8230;<\/h1>\n\n\n\n<p>Unfortunately, it&#8217;s been a while since Stanford updated their course homepage. As ressources date back to 2007, the karel.jar file included in the <a href=\"https:\/\/see.stanford.edu\/materials\/icspmcs106a\/Assignment1.zip\" target=\"_blank\" rel=\"noopener\"><code>Assignment1.zip<\/code> <\/a>archive was intended to be compatible with Java 1.6 and Eclipse.<\/p>\n\n\n\n<p>As we are now at Java 1.8, you will get an empty Java Application Screen instead of the Karel Board when you try to launch the Java code of your Assignment.<\/p>\n\n\n<div class=\"wp-block-image size-full wp-image-945\">\n<figure class=\"aligncenter\"><img loading=\"lazy\" decoding=\"async\" width=\"429\" height=\"268\" src=\"http:\/\/hobbykeller.spdns.de\/wp-content\/uploads\/2016\/06\/norkarel.png\" alt=\"Trying to run a code with an outdated karel.jar file\" class=\"wp-image-945\" srcset=\"https:\/\/hobbykeller.spdns.de\/wp-content\/uploads\/2016\/06\/norkarel.png 429w, https:\/\/hobbykeller.spdns.de\/wp-content\/uploads\/2016\/06\/norkarel-300x187.png 300w\" sizes=\"auto, (max-width: 429px) 100vw, 429px\" \/><figcaption class=\"wp-element-caption\">Trying to run a code with an outdated karel.jar file<\/figcaption><\/figure>\n<\/div>\n\n\n<p>It is often recommended to downgrade your Java to version 1.6. Imho, this is a bad idea: Instead of working with an outdated JRE just to run an outdated <code>jar<\/code> file, you should rather go to find a current version of a <code>jar<\/code> file.<\/p>\n\n\n\n<p>So the best way forward is to go for a recent version of <code>Assignment1.zip<\/code> with a recent version of <code>karel.jar<\/code> which runs just fine with Java&#8217;s JRE 1.8. Just download it from this page and use it with all Karel-related assignments.<\/p>\n\n\n\n<h1 class=\"wp-block-heading\">Standard Eclipse or Stanford&#8217;s Customized Eclipse?<\/h1>\n\n\n\n<p>For Linux users, the choice is easy: As Stanford only supports Windows and MacOS, my advice is to go by the standard Eclipse version. This allows you to have the most recent version of Eclipse and you don&#8217;t need the bells &amp; whistles of the customized Stanford version anyway. Just pick the Oomph installer and choose the standard <em>Eclipse Java IDE for Developers<\/em>. (Not Java EE)<\/p>\n\n\n\n<h1 class=\"wp-block-heading\">The Run Configuration<\/h1>\n\n\n\n<p>To run your code&#8230;<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Go to Run Configurations,<\/li>\n\n\n\n<li>Click on Java Application (not Applet!)<\/li>\n\n\n\n<li>In the Main tab, Search for the Main class and select <code>stanford.karel.Karel<\/code><\/li>\n\n\n\n<li>In the Arguments tab enter <code>code=CollectNewspaperKarel<\/code> (or whatever the name of the Java app is that you want to run)<\/li>\n\n\n\n<li>Click Run and you should see your Karel application<\/li>\n\n\n\n<li>You may have to load the corresponding Karel world when your application starts.<\/li>\n<\/ol>\n\n\n<div class=\"wp-block-image size-full wp-image-947\">\n<figure class=\"alignleft\"><img loading=\"lazy\" decoding=\"async\" width=\"500\" height=\"360\" src=\"http:\/\/hobbykeller.spdns.de\/wp-content\/uploads\/2016\/06\/karel_ok.png\" alt=\"Karel running in Ubuntu's Eclipse Mars\" class=\"wp-image-947\" srcset=\"https:\/\/hobbykeller.spdns.de\/wp-content\/uploads\/2016\/06\/karel_ok.png 500w, https:\/\/hobbykeller.spdns.de\/wp-content\/uploads\/2016\/06\/karel_ok-300x216.png 300w, https:\/\/hobbykeller.spdns.de\/wp-content\/uploads\/2016\/06\/karel_ok-417x300.png 417w\" sizes=\"auto, (max-width: 500px) 100vw, 500px\" \/><figcaption class=\"wp-element-caption\">Karel running in Ubuntu&#8217;s Eclipse Mars<\/figcaption><\/figure>\n<\/div>","protected":false},"excerpt":{"rendered":"<p>If you want to learn about computer science in general and about Java programming in particular, maybe one of the best learning ressources to look at is the CS106A online<span class=\"more-button\"><a href=\"https:\/\/hobbykeller.spdns.de\/?p=938\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\">Always trouble with Karel&#8230;<\/span><\/a><\/span><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[156,64],"tags":[197,193,137,192,195,194,196],"class_list":["post-938","post","type-post","status-publish","format-standard","hentry","category-deprecated","category-linux","tag-16-04","tag-cs106a","tag-eclipse","tag-java","tag-karel","tag-stanford","tag-ubuntu"],"_links":{"self":[{"href":"https:\/\/hobbykeller.spdns.de\/index.php?rest_route=\/wp\/v2\/posts\/938","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/hobbykeller.spdns.de\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/hobbykeller.spdns.de\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/hobbykeller.spdns.de\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/hobbykeller.spdns.de\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=938"}],"version-history":[{"count":8,"href":"https:\/\/hobbykeller.spdns.de\/index.php?rest_route=\/wp\/v2\/posts\/938\/revisions"}],"predecessor-version":[{"id":1865,"href":"https:\/\/hobbykeller.spdns.de\/index.php?rest_route=\/wp\/v2\/posts\/938\/revisions\/1865"}],"wp:attachment":[{"href":"https:\/\/hobbykeller.spdns.de\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=938"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/hobbykeller.spdns.de\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=938"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/hobbykeller.spdns.de\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=938"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}