<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>JShell on foojay.io - Friends Of OpenJDK</title><link>https://foojay.io/today/category/jshell/</link><description>Recent content in JShell on foojay.io - Friends Of OpenJDK</description><generator>Hugo</generator><language>en-us</language><lastBuildDate>Tue, 09 Jan 2024 12:58:25 +0000</lastBuildDate><atom:link href="https://foojay.io/today/category/jshell/index.xml" rel="self" type="application/rss+xml"/><item><title>Live (re)compile, (re)load, (re)execute Java code in 100 LoC</title><link>https://foojay.io/today/live-recompile-reload-reexecute-java-code-in-100-loc/</link><pubDate>Wed, 15 Nov 2023 16:22:05 +0000</pubDate><guid>https://foojay.io/today/live-recompile-reload-reexecute-java-code-in-100-loc/</guid><description>&lt;p&gt;Writing your first program in Java can have quite a learning curve.&lt;/p&gt;&#10;&lt;p&gt;Java has been trying in recent releases to make it easier to write the &lt;a href="https://openjdk.org/projects/amber/design-notes/on-ramp" target="_blank" rel="noopener noreferrer"&gt;first simple program&lt;/a&gt;.&lt;/p&gt;&#10;&lt;p&gt;Here are some changes that simplify your first Java program:&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;&lt;a href="https://openjdk.org/jeps/222" target="_blank" rel="noopener noreferrer"&gt;JEP 222&lt;/a&gt;: jshell: The Java Shell (Read-Eval-Print Loop) in JDK 9&lt;/li&gt;&#10;&lt;li&gt;&lt;a href="https://openjdk.org/jeps/330" target="_blank" rel="noopener noreferrer"&gt;JEP 330&lt;/a&gt;: Launch Single-File Source-Code Programs in JDK 11&lt;/li&gt;&#10;&lt;li&gt;&lt;a href="https://openjdk.org/jeps/445" target="_blank" rel="noopener noreferrer"&gt;JEP 445&lt;/a&gt;: Unnamed Classes and Instance Main Methods in preview in JDK 21&lt;/li&gt;&#10;&lt;li&gt;&lt;a href="https://openjdk.org/jeps/458" target="_blank" rel="noopener noreferrer"&gt;JEP 458&lt;/a&gt;: Launch Multi-File Source-Code Programs. Not released yet.&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;In this article, we&amp;rsquo;ll write a program (&lt;strong&gt;The Reloader&lt;/strong&gt;) to easily play with Java code without the need to know how to compile or run the code or print the result.&lt;/p&gt;</description></item><item><title>Schedule your 2038 holiday and experiment with dates in jshell!</title><link>https://foojay.io/today/still-time-to-schedule-your-holiday-for-2038/</link><pubDate>Thu, 16 Feb 2023 15:54:51 +0000</pubDate><guid>https://foojay.io/today/still-time-to-schedule-your-holiday-for-2038/</guid><description>&lt;p&gt;It&amp;rsquo;s still more or less the beginning of the year, where you may want to start scheduling your holidays until the end of it. And I decided to go a step further and I&amp;rsquo;ve already planned those for 2038!&lt;/p&gt;&#10;&lt;p&gt;Why? Well, some time ago I gave a presentation to students, when I realized they had no idea what I was talking about when mentioning the Y2K-problem. Most of them weren&amp;rsquo;t even born in the year 2000!&lt;/p&gt;</description></item><item><title>Hand Ground Coffee: Command Line Tools for Java</title><link>https://foojay.io/today/hand-ground-coffee-command-line-tools-for-java/</link><pubDate>Mon, 21 Feb 2022 16:04:15 +0000</pubDate><guid>https://foojay.io/today/hand-ground-coffee-command-line-tools-for-java/</guid><description>&lt;p&gt;&lt;img src="https://foojay.io/today/hand-ground-coffee-command-line-tools-for-java/kaffeemuehle-2f2e0d93.jpg" alt="kaffeemuehle" width="980" height="332" loading="lazy" decoding="async"&gt;&lt;/p&gt;&#10;&lt;p&gt;In the book &amp;ldquo;&lt;a href="https://medium.com/97-things" target="_blank" rel="noopener noreferrer"&gt;97 Things every Java Programmer should know&lt;/a&gt;&amp;rdquo; (I contributed 2 of the 97 tips) there is a chapter about some command line tools in the JDK.&lt;/p&gt;&#10;&lt;p&gt;Since I make heavy use of such helpers myself, I wanted to briefly introduce them in today&amp;rsquo;s article.&lt;/p&gt;&#10;&lt;p&gt;Personally I prefer the command line for my daily work, using the combination of &lt;code&gt;git&lt;/code&gt;, &lt;code&gt;sed&lt;/code&gt;, &lt;code&gt;grep&lt;/code&gt;, &lt;code&gt;bash&lt;/code&gt; commands etc. makes recurring tasks easier.&lt;/p&gt;</description></item><item><title>Learn JShell with JavaFX in Only 60 Seconds</title><link>https://foojay.io/today/learn-javafx-with-jshell-in-60-seconds/</link><pubDate>Mon, 12 Jul 2021 10:54:56 +0000</pubDate><guid>https://foojay.io/today/learn-javafx-with-jshell-in-60-seconds/</guid><description>&lt;blockquote&gt;&#10;&lt;p&gt;&lt;strong&gt;Spoon boy&lt;/strong&gt; : Do not try and bend the spoon. That&amp;rsquo;s impossible. Instead&amp;hellip; only try to realize the truth.&lt;br&gt;&#10;&lt;strong&gt;Neo&lt;/strong&gt; : What truth?&lt;br&gt;&#10;&lt;strong&gt;Spoon boy&lt;/strong&gt; : There is no spoon.&lt;br&gt;&#10;&lt;strong&gt;Neo&lt;/strong&gt; : There is no spoon?&lt;br&gt;&#10;&lt;strong&gt;Spoon boy&lt;/strong&gt; : Then you&amp;rsquo;ll see, that it is not the spoon that bends, it is only yourself.&lt;/p&gt;&#10;&lt;/blockquote&gt;&#10;&lt;p&gt;&amp;ndash; The Matrix, a conversation between Neo and Spoon boy.&lt;/p&gt;&#10;&lt;p&gt;&lt;img src="https://foojay.io/today/learn-javafx-with-jshell-in-60-seconds/matrix-rain-effect.webp" alt="Matrix Rain Code Effect" width="546" height="454" loading="lazy" decoding="async"&gt;&lt;/p&gt;&#10;&lt;p&gt;In the classic science fiction movie, The Matrix, there&amp;rsquo;s a cool special effect better known as the &lt;em&gt;falling&lt;/em&gt; or &lt;em&gt;raining green code&lt;/em&gt; effect. In &lt;a href="https://youtu.be/MvEXkd3O2ow?t=27" title="one scene" target="_blank" rel="noopener noreferrer"&gt;one scene&lt;/a&gt; the character named &lt;strong&gt;&amp;lsquo;Cypher&amp;rsquo;&lt;/strong&gt; played by &lt;a href="https://www.imdb.com/name/nm0001592/" title="Joe Pantoliano" target="_blank" rel="noopener noreferrer"&gt;Joe Pantoliano&lt;/a&gt; explains how they can monitor activity inside the &lt;strong&gt;matrix&lt;/strong&gt; by looking at the patterns as the code rains down. He claims it&amp;rsquo;s done this way to simplify seeing people in the matrix than other means due to the fact that there is just way too much data (movie scifi magic talk).&lt;/p&gt;</description></item></channel></rss>