[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"navigation":3,"url-settings":86,"blog-\u002Fblog\u002Fbreaking-down-java-21-features-a-developers-guide":671,"blog-author-\u002Fblog\u002Fbreaking-down-java-21-features-a-developers-guide":1274,"i-material-symbols:arrow-back-rounded":1286},{"id":4,"extension":5,"footer":6,"header":73,"meta":83,"stem":84,"__hash__":85},"navigation\u002Fdata\u002Fshared\u002Fnavigation.yml","yml",{"brand":7,"columns":13,"legal":63},{"name":8,"tagline":9,"downloadCta":10},"Pieces","The memory layer for modern work.",{"label":11,"href":12},"All downloads","\u002Fdownloads",[14,26,39,51],{"title":15,"links":16},"Product",[17,20,23],{"label":18,"href":19},"Pieces Desktop","\u002F",{"label":21,"href":22},"Pieces Enterprise","\u002Fenterprise",{"label":24,"href":25},"Pieces MCP","\u002Fmcp",{"title":27,"links":28},"Resources",[29,33,36],{"label":30,"href":31,"external":32},"Documentation","url:docs.home",true,{"label":34,"href":35},"Blog","\u002Fblog",{"label":37,"href":38,"external":32},"GitHub","url:github.org",{"title":40,"links":41},"Community",[42,45,48],{"label":43,"href":44,"external":32},"Discord","url:social.discord",{"label":46,"href":47,"external":32},"X \u002F Twitter","url:social.x",{"label":49,"href":50,"external":32},"LinkedIn","url:social.linkedin",{"title":52,"links":53},"Company",[54,57,60],{"label":55,"href":56},"About","\u002Fabout",{"label":58,"href":59},"Updates","\u002Fupdates",{"label":61,"href":62},"Contact","\u002Fcontact",[64,67,70],{"label":65,"href":66},"Privacy Policy","\u002Flegal\u002Fprivacy",{"label":68,"href":69},"Refund Policy","\u002Flegal\u002Frefund",{"label":71,"href":72},"Terms of Service","\u002Flegal\u002Fterms",{"links":74,"signIn":75,"contact":78,"cta":80},[],{"label":76,"href":77},"Manage account","url:portal.home",{"label":79,"href":62},"Get in touch",{"label":81,"href":82},"Download","url:routes.downloads",{},"data\u002Fshared\u002Fnavigation","XlSALC7vYCXHcmcXnjJViwIZKsqnQWF4bn4o9RrcSBE",{"id":87,"extension":5,"links":88,"meta":668,"stem":669,"__hash__":670},"urlSettings\u002Fdata\u002Fshared\u002Furls.yml",[89,93,97,101,105,109,113,117,121,125,129,133,137,141,145,149,153,157,161,165,169,173,177,181,185,189,192,196,200,204,208,212,216,220,224,228,232,236,240,244,248,252,256,260,264,268,272,276,280,284,288,292,296,300,303,307,311,314,318,322,326,330,334,338,342,346,350,354,358,362,366,370,374,378,382,386,390,394,398,402,406,410,414,418,422,426,430,434,438,442,446,450,454,458,461,465,469,473,477,481,485,488,491,494,497,501,505,508,512,516,520,524,528,532,536,540,544,548,552,556,559,563,567,571,575,579,582,585,588,592,595,599,603,607,611,614,618,622,625,628,631,635,639,643,646,649,652,656,660,664],{"key":90,"label":91,"href":92},"downloads.desktop","Desktop download page","https:\u002F\u002Fdocs.pieces.app\u002Fproducts\u002Fdesktop\u002Fdownload",{"key":94,"label":95,"href":96},"downloads.macOS.dmgArm64","macOS DMG Apple Silicon","https:\u002F\u002Fbuilds.pieces.app\u002Fstages\u002Fproduction\u002Fpieces_for_x\u002Fdmg-arm64\u002Fdownload",{"key":98,"label":99,"href":100},"downloads.macOS.dmgIntel","macOS DMG Intel","https:\u002F\u002Fbuilds.pieces.app\u002Fstages\u002Fproduction\u002Fpieces_for_x\u002Fdmg\u002Fdownload",{"key":102,"label":103,"href":104},"downloads.macOS.pkg","macOS PKG","https:\u002F\u002Fbuilds.pieces.app\u002Fstages\u002Fproduction\u002Fmacos_packaging\u002Fpkg\u002Fdownload",{"key":106,"label":107,"href":108},"downloads.macOS.universal","Desktop macOS Universal","https:\u002F\u002Fbuilds.pieces.app\u002Fstages\u002Fproduction\u002Fpieces_for_x\u002Fmacos-universal\u002Fdownload",{"key":110,"label":111,"href":112},"downloads.macOS.pkgArm64","Desktop macOS PKG Apple Silicon","https:\u002F\u002Fbuilds.pieces.app\u002Fstages\u002Fproduction\u002Fmacos_packaging\u002Fpkg-pfd-arm64\u002Fdownload",{"key":114,"label":115,"href":116},"downloads.macOS.pkgIntel","Desktop macOS PKG Intel","https:\u002F\u002Fbuilds.pieces.app\u002Fstages\u002Fproduction\u002Fmacos_packaging\u002Fpkg-pfd\u002Fdownload",{"key":118,"label":119,"href":120},"downloads.windows.appinstaller","Windows App Installer","https:\u002F\u002Fbuilds.pieces.app\u002Fstages\u002Fproduction\u002Fappinstaller\u002Fpieces_for_x.appinstaller",{"key":122,"label":123,"href":124},"downloads.windows.exe","Windows EXE","https:\u002F\u002Fbuilds.pieces.app\u002Fstages\u002Fproduction\u002Fpieces_for_x\u002Fwindows-exe\u002Fdownload",{"key":126,"label":127,"href":128},"downloads.windows.msix","Windows MSIX","https:\u002F\u002Fbuilds.pieces.app\u002Fstages\u002Fproduction\u002Fpieces_for_x\u002Fwindows-msix\u002Fdownload",{"key":130,"label":131,"href":132},"downloads.windows.suiteManager","Windows Suite Manager","https:\u002F\u002Fbuilds.pieces.app\u002Fstages\u002Fproduction\u002Fpieces_suite_windows\u002Fappinstaller\u002Fdownload",{"key":134,"label":135,"href":136},"downloads.linux.flatpakRepo","Linux Flatpak repository","https:\u002F\u002Fbuilds.pieces.app\u002Fpieces-flatpak-repo\u002Fpieces-flatpak.flatpakrepo",{"key":138,"label":139,"href":140},"downloads.linux.snapDesktop","Linux Snap Desktop","https:\u002F\u002Fsnapcraft.io\u002Fpieces-for-developers",{"key":142,"label":143,"href":144},"downloads.linux.snapPiecesOS","Linux Snap PiecesOS","https:\u002F\u002Fsnapcraft.io\u002Fpieces-os",{"key":146,"label":147,"href":148},"downloads.linux.snap","Desktop Linux Snap package","https:\u002F\u002Fbuilds.pieces.app\u002Fstages\u002Fproduction\u002Fpieces_for_x\u002Fsnap\u002Fdownload",{"key":150,"label":151,"href":152},"downloads.piecesOS.macOS.dmgArm64","PiecesOS macOS DMG Apple Silicon","https:\u002F\u002Fbuilds.pieces.app\u002Fstages\u002Fproduction\u002Fos_server\u002Fdmg-arm64\u002Fdownload",{"key":154,"label":155,"href":156},"downloads.piecesOS.macOS.dmgIntel","PiecesOS macOS DMG Intel","https:\u002F\u002Fbuilds.pieces.app\u002Fstages\u002Fproduction\u002Fos_server\u002Fdmg\u002Fdownload",{"key":158,"label":159,"href":160},"downloads.piecesOS.macOS.universal","PiecesOS macOS Universal","https:\u002F\u002Fbuilds.pieces.app\u002Fstages\u002Fproduction\u002Fos_server\u002Fmacos-universal\u002Fdownload",{"key":162,"label":163,"href":164},"downloads.piecesOS.macOS.pkgArm64","PiecesOS macOS PKG Apple Silicon","https:\u002F\u002Fbuilds.pieces.app\u002Fstages\u002Fproduction\u002Fmacos_packaging\u002Fpkg-pos-launch-only-arm64\u002Fdownload",{"key":166,"label":167,"href":168},"downloads.piecesOS.macOS.pkgIntel","PiecesOS macOS PKG Intel","https:\u002F\u002Fbuilds.pieces.app\u002Fstages\u002Fproduction\u002Fmacos_packaging\u002Fpkg-pos-launch-only\u002Fdownload",{"key":170,"label":171,"href":172},"downloads.piecesOS.windows.appinstaller","PiecesOS Windows App Installer","https:\u002F\u002Fbuilds.pieces.app\u002Fstages\u002Fproduction\u002Fappinstaller\u002Fos_server.appinstaller",{"key":174,"label":175,"href":176},"downloads.piecesOS.windows.exe","PiecesOS Windows EXE","https:\u002F\u002Fbuilds.pieces.app\u002Fstages\u002Fproduction\u002Fos_server\u002Fwindows-exe\u002Fdownload",{"key":178,"label":179,"href":180},"downloads.piecesOS.windows.msix","PiecesOS Windows MSIX","https:\u002F\u002Fbuilds.pieces.app\u002Fstages\u002Fproduction\u002Fos_server\u002Fwindows-msix\u002Fdownload",{"key":182,"label":183,"href":184},"downloads.piecesOS.linux.snap","PiecesOS Linux Snap package","https:\u002F\u002Fbuilds.pieces.app\u002Fstages\u002Fproduction\u002Fos_server\u002Fsnap\u002Fdownload",{"key":186,"label":187,"href":188},"downloads.combined.macOS.appleSilicon","Combined macOS installer Apple Silicon","https:\u002F\u002Fbuilds.pieces.app\u002Fstages\u002Fproduction\u002Fmacos_packaging\u002Fpkg-arm64\u002Fdownload",{"key":190,"label":191,"href":104},"downloads.combined.macOS.intel","Combined macOS installer Intel",{"key":193,"label":194,"href":195},"downloads.guides.macOS","macOS installation guide","https:\u002F\u002Fdocs.pieces.app\u002Fproducts\u002Fmeet-pieces\u002Fmacos-installation-guide",{"key":197,"label":198,"href":199},"downloads.guides.windows","Windows installation guide","https:\u002F\u002Fdocs.pieces.app\u002Fproducts\u002Fmeet-pieces\u002Fwindows-installation-guide",{"key":201,"label":202,"href":203},"downloads.guides.linux","Linux installation guide","https:\u002F\u002Fdocs.pieces.app\u002Fproducts\u002Fmeet-pieces\u002Flinux-installation-guide",{"key":205,"label":206,"href":207},"downloads.guides.linuxFlatpak","Linux Flatpak installation guide","https:\u002F\u002Fdocs.pieces.app\u002Fproducts\u002Fmeet-pieces\u002Flinux-installation-guide\u002Fflatpak",{"key":209,"label":210,"href":211},"downloads.guides.linuxSnap","Linux Snap installation guide","https:\u002F\u002Fdocs.pieces.app\u002Fproducts\u002Fmeet-pieces\u002Flinux-installation-guide\u002Fsnap",{"key":213,"label":214,"href":215},"downloads.guides.piecesOS","PiecesOS manual installation","https:\u002F\u002Fdocs.pieces.app\u002Fproducts\u002Fcore-dependencies\u002Fpieces-os\u002Fmanual-installation",{"key":217,"label":218,"href":219},"extensions.chrome","Chrome extension","https:\u002F\u002Fchrome.google.com\u002Fwebstore\u002Fdetail\u002Fpieces-save-code-snippets\u002Figbgibhbfonhmjlechmeefimncpekepm",{"key":221,"label":222,"href":223},"extensions.firefox","Firefox add-on","https:\u002F\u002Faddons.mozilla.org\u002Fen-US\u002Ffirefox\u002Faddon\u002Fpieces-save-code-from-the-web\u002F",{"key":225,"label":226,"href":227},"extensions.edge","Edge add-on","https:\u002F\u002Fmicrosoftedge.microsoft.com\u002Faddons\u002Fdetail\u002Fpieces-save-code-snippet\u002Fhglfimcdgonaeeobjckfdabcldfidmim",{"key":229,"label":230,"href":231},"extensions.vscode","VS Code extension","https:\u002F\u002Fmarketplace.visualstudio.com\u002Fitems?itemName=MeshIntelligentTechnologiesInc.pieces-vscode",{"key":233,"label":234,"href":235},"extensions.visualStudio","Visual Studio extension","https:\u002F\u002Fmarketplace.visualstudio.com\u002Fitems?itemName=MeshIntelligentTechnologiesInc.PiecesVisualStudio",{"key":237,"label":238,"href":239},"extensions.jetbrains","JetBrains plugin","https:\u002F\u002Fplugins.jetbrains.com\u002Fplugin\u002F17328-pieces--save-search-share--reuse-code-snippets",{"key":241,"label":242,"href":243},"extensions.obsidian","Obsidian plugin","https:\u002F\u002Fobsidian.md\u002Fplugins?id=pieces-for-developers",{"key":245,"label":246,"href":247},"extensions.sublime","Sublime package","https:\u002F\u002Fpackagecontrol.io\u002Fpackages\u002FPieces",{"key":249,"label":250,"href":251},"extensions.neovim","Neovim plugin","https:\u002F\u002Fgithub.com\u002Fpieces-app\u002Fplugin_neo_vim",{"key":253,"label":254,"href":255},"extensions.jupyterlab","JupyterLab plugin","https:\u002F\u002Fgithub.com\u002Fpieces-app\u002Fjupyterlab-pieces",{"key":257,"label":258,"href":259},"extensions.cli","Pieces CLI","https:\u002F\u002Fpypi.org\u002Fproject\u002Fpieces-cli\u002F",{"key":261,"label":262,"href":263},"docs.home","Documentation home","https:\u002F\u002Fdocs.pieces.app",{"key":265,"label":266,"href":267},"docs.getStarted","Get started docs","https:\u002F\u002Fdocs.pieces.app\u002Fproducts\u002Fmeet-pieces",{"key":269,"label":270,"href":271},"docs.api","API docs","https:\u002F\u002Fdocs.pieces.app\u002Fapi",{"key":273,"label":274,"href":275},"docs.desktop.overview","Desktop overview","https:\u002F\u002Fdocs.pieces.app\u002Fproducts\u002Fdesktop",{"key":277,"label":278,"href":279},"docs.desktop.onboarding","Desktop onboarding","https:\u002F\u002Fdocs.pieces.app\u002Fproducts\u002Fdesktop\u002Fonboarding",{"key":281,"label":282,"href":283},"docs.desktop.timeline","Desktop timeline docs","https:\u002F\u002Fdocs.pieces.app\u002Fproducts\u002Fdesktop\u002Ftimeline",{"key":285,"label":286,"href":287},"docs.desktop.summaries","Desktop summaries docs","https:\u002F\u002Fdocs.pieces.app\u002Fproducts\u002Fdesktop\u002Fsingle-click-summaries",{"key":289,"label":290,"href":291},"docs.desktop.search","Desktop conversational search docs","https:\u002F\u002Fdocs.pieces.app\u002Fproducts\u002Fdesktop\u002Fconversational-search",{"key":293,"label":294,"href":295},"docs.desktop.drive","Desktop drive docs","https:\u002F\u002Fdocs.pieces.app\u002Fproducts\u002Fdesktop\u002Fdrive",{"key":297,"label":298,"href":299},"docs.desktop.account","Desktop account settings docs","https:\u002F\u002Fdocs.pieces.app\u002Fproducts\u002Fdesktop\u002Fconfiguration\u002Faccount",{"key":301,"label":302,"href":92},"docs.desktop.download","Desktop download docs",{"key":304,"label":305,"href":306},"docs.piecesOS.overview","PiecesOS overview docs","https:\u002F\u002Fdocs.pieces.app\u002Fproducts\u002Fcore-dependencies",{"key":308,"label":309,"href":310},"docs.piecesOS.details","PiecesOS details docs","https:\u002F\u002Fdocs.pieces.app\u002Fproducts\u002Fcore-dependencies\u002Fpieces-os",{"key":312,"label":313,"href":215},"docs.piecesOS.install","PiecesOS install docs",{"key":315,"label":316,"href":317},"docs.piecesOS.quickMenu","PiecesOS quick menu docs","https:\u002F\u002Fdocs.pieces.app\u002Fproducts\u002Fcore-dependencies\u002Fpieces-os\u002Fquick-menu",{"key":319,"label":320,"href":321},"docs.piecesOS.storage","On-device storage docs","https:\u002F\u002Fdocs.pieces.app\u002Fproducts\u002Fcore-dependencies\u002Fon-device-storage",{"key":323,"label":324,"href":325},"docs.piecesOS.troubleshooting","PiecesOS troubleshooting docs","https:\u002F\u002Fdocs.pieces.app\u002Fproducts\u002Fcore-dependencies\u002Fpieces-os\u002Ftroubleshooting",{"key":327,"label":328,"href":329},"docs.mcp.overview","MCP overview docs","https:\u002F\u002Fdocs.pieces.app\u002Fproducts\u002Fmcp",{"key":331,"label":332,"href":333},"docs.mcp.cursor","MCP Cursor docs","https:\u002F\u002Fdocs.pieces.app\u002Fproducts\u002Fmcp\u002Fcursor",{"key":335,"label":336,"href":337},"docs.mcp.vscode","MCP VS Code docs","https:\u002F\u002Fdocs.pieces.app\u002Fproducts\u002Fmcp\u002Fvs-code",{"key":339,"label":340,"href":341},"docs.mcp.claudeDesktop","MCP Claude Desktop docs","https:\u002F\u002Fdocs.pieces.app\u002Fproducts\u002Fmcp\u002Fclaude-desktop",{"key":343,"label":344,"href":345},"docs.mcp.claudeCode","MCP Claude Code docs","https:\u002F\u002Fdocs.pieces.app\u002Fproducts\u002Fmcp\u002Fclaude-code",{"key":347,"label":348,"href":349},"docs.mcp.claudeCowork","MCP Claude Cowork docs","https:\u002F\u002Fdocs.pieces.app\u002Fproducts\u002Fmcp\u002Fclaude-cowork",{"key":351,"label":352,"href":353},"docs.mcp.githubCopilot","MCP GitHub Copilot docs","https:\u002F\u002Fdocs.pieces.app\u002Fproducts\u002Fmcp\u002Fgithub-copilot",{"key":355,"label":356,"href":357},"docs.mcp.goose","MCP Goose docs","https:\u002F\u002Fdocs.pieces.app\u002Fproducts\u002Fmcp\u002Fgoose",{"key":359,"label":360,"href":361},"docs.mcp.windsurf","MCP Windsurf docs","https:\u002F\u002Fdocs.pieces.app\u002Fproducts\u002Fmcp\u002Fwindsurf",{"key":363,"label":364,"href":365},"docs.mcp.zed","MCP Zed docs","https:\u002F\u002Fdocs.pieces.app\u002Fproducts\u002Fmcp\u002Fzed",{"key":367,"label":368,"href":369},"docs.mcp.jetbrains","MCP JetBrains docs","https:\u002F\u002Fdocs.pieces.app\u002Fproducts\u002Fmcp\u002Fjetbrains-ides",{"key":371,"label":372,"href":373},"docs.mcp.continueDev","MCP Continue docs","https:\u002F\u002Fdocs.pieces.app\u002Fproducts\u002Fmcp\u002Fcontinue-dev",{"key":375,"label":376,"href":377},"docs.mcp.cline","MCP Cline docs","https:\u002F\u002Fdocs.pieces.app\u002Fproducts\u002Fmcp\u002Fcline",{"key":379,"label":380,"href":381},"docs.mcp.raycast","MCP Raycast docs","https:\u002F\u002Fdocs.pieces.app\u002Fproducts\u002Fmcp\u002Fraycast",{"key":383,"label":384,"href":385},"docs.mcp.rovoDevCli","MCP Rovo Dev CLI docs","https:\u002F\u002Fdocs.pieces.app\u002Fproducts\u002Fmcp\u002Frovo-dev-cli",{"key":387,"label":388,"href":389},"docs.mcp.openaiCodexCli","MCP OpenAI Codex CLI docs","https:\u002F\u002Fdocs.pieces.app\u002Fproducts\u002Fmcp\u002Fopenai-codex-cli",{"key":391,"label":392,"href":393},"docs.mcp.googleGeminiCli","MCP Google Gemini CLI docs","https:\u002F\u002Fdocs.pieces.app\u002Fproducts\u002Fmcp\u002Fgoogle-gemini-cli",{"key":395,"label":396,"href":397},"docs.mcp.amazonQ","MCP Amazon Q docs","https:\u002F\u002Fdocs.pieces.app\u002Fproducts\u002Fmcp\u002Famazon-q-developer",{"key":399,"label":400,"href":401},"docs.mcp.chatgptDev","MCP ChatGPT Developer Mode docs","https:\u002F\u002Fdocs.pieces.app\u002Fproducts\u002Fmcp\u002Fchatgpt-developer-mode",{"key":403,"label":404,"href":405},"docs.mcp.openclaw","MCP OpenClaw docs","https:\u002F\u002Fdocs.pieces.app\u002Fproducts\u002Fmcp\u002Fopenclaw",{"key":407,"label":408,"href":409},"docs.mcp.mcpRemote","MCP Remote docs","https:\u002F\u002Fdocs.pieces.app\u002Fproducts\u002Fmcp\u002Fmcp-remote",{"key":411,"label":412,"href":413},"docs.mcp.ngrok","MCP ngrok docs","https:\u002F\u002Fdocs.pieces.app\u002Fproducts\u002Fmcp\u002Fngrok-setup",{"key":415,"label":416,"href":417},"docs.troubleshooting.macOS","macOS troubleshooting docs","https:\u002F\u002Fdocs.pieces.app\u002Fproducts\u002Fmeet-pieces\u002Ftroubleshooting\u002Fmacos",{"key":419,"label":420,"href":421},"docs.troubleshooting.windows","Windows troubleshooting docs","https:\u002F\u002Fdocs.pieces.app\u002Fproducts\u002Fmeet-pieces\u002Ftroubleshooting\u002Fwindows",{"key":423,"label":424,"href":425},"docs.troubleshooting.linux","Linux troubleshooting docs","https:\u002F\u002Fdocs.pieces.app\u002Fproducts\u002Fmeet-pieces\u002Ftroubleshooting\u002Flinux",{"key":427,"label":428,"href":429},"docs.privacy","Privacy and security docs","https:\u002F\u002Fdocs.pieces.app\u002Fproducts\u002Fprivacy-security-your-data",{"key":431,"label":432,"href":433},"docs.support","Support docs","https:\u002F\u002Fdocs.pieces.app\u002Fproducts\u002Fsupport",{"key":435,"label":436,"href":437},"portal.home","Pieces portal","https:\u002F\u002Fportal.pieces.app",{"key":439,"label":440,"href":441},"site.home","Website home","https:\u002F\u002Fpieces.app",{"key":443,"label":444,"href":445},"site.about","About page","https:\u002F\u002Fpieces.app\u002Fabout",{"key":447,"label":448,"href":449},"site.features","Features page","https:\u002F\u002Fpieces.app\u002Ffeatures",{"key":451,"label":452,"href":453},"site.plugins","Plugins page","https:\u002F\u002Fpieces.app\u002Fplugins",{"key":455,"label":456,"href":457},"site.contact","Contact page","https:\u002F\u002Fpieces.app\u002Fcontact",{"key":459,"label":58,"href":460},"site.updates","https:\u002F\u002Fpieces.app\u002Fupdates",{"key":462,"label":463,"href":464},"site.news","News","https:\u002F\u002Fpieces.app\u002Fnews",{"key":466,"label":467,"href":468},"site.events","Community events","https:\u002F\u002Fpieces.app\u002Fcommunity\u002Fevents",{"key":470,"label":471,"href":472},"site.userStories","User stories","https:\u002F\u002Fpieces.app\u002Fuser-stories",{"key":474,"label":475,"href":476},"site.academy","Academy","https:\u002F\u002Fpieces.app\u002Flearn\u002Facademy",{"key":478,"label":479,"href":480},"site.support","Website support","https:\u002F\u002Fpieces.app\u002Fsupport",{"key":482,"label":483,"href":484},"site.standup","Standup","https:\u002F\u002Fpieces.app\u002Fstandup",{"key":486,"label":34,"href":487},"site.blog","https:\u002F\u002Fcode.pieces.app\u002Fblog",{"key":489,"label":43,"href":490},"social.discord","https:\u002F\u002Fdiscord.gg\u002Fgetpieces",{"key":492,"label":46,"href":493},"social.x","https:\u002F\u002Fx.com\u002Fgetpieces",{"key":495,"label":496,"href":493},"social.twitter","Twitter",{"key":498,"label":499,"href":500},"social.instagram","Instagram","https:\u002F\u002Fwww.instagram.com\u002Fgetpieces\u002F",{"key":502,"label":503,"href":504},"social.tiktok","TikTok","https:\u002F\u002Fwww.tiktok.com\u002F@getpieces",{"key":506,"label":49,"href":507},"social.linkedin","https:\u002F\u002Fwww.linkedin.com\u002Fcompany\u002Fgetpieces\u002F",{"key":509,"label":510,"href":511},"social.youtube","YouTube","https:\u002F\u002Fyoutube.com\u002F@getpieces",{"key":513,"label":514,"href":515},"github.org","GitHub organization","https:\u002F\u002Fgithub.com\u002Fpieces-app",{"key":517,"label":518,"href":519},"github.support","GitHub support","https:\u002F\u002Fgithub.com\u002Fpieces-app\u002Fsupport",{"key":521,"label":522,"href":523},"github.issues","GitHub issues","https:\u002F\u002Fgithub.com\u002Fpieces-app\u002Fsupport\u002Fissues",{"key":525,"label":526,"href":527},"github.discussions","GitHub discussions","https:\u002F\u002Fgithub.com\u002Fpieces-app\u002Fsupport\u002Fdiscussions",{"key":529,"label":530,"href":531},"github.documentation","GitHub documentation","https:\u002F\u002Fgithub.com\u002Fpieces-app\u002Fdocumentation",{"key":533,"label":534,"href":535},"github.opensource","GitHub open source","https:\u002F\u002Fgithub.com\u002Fpieces-app\u002Fopensource",{"key":537,"label":538,"href":539},"github.sdks.python","Python SDK","https:\u002F\u002Fgithub.com\u002Fpieces-app\u002Fpieces-os-client-sdk-for-python",{"key":541,"label":542,"href":543},"github.sdks.typescript","TypeScript SDK","https:\u002F\u002Fgithub.com\u002Fpieces-app\u002Fpieces-os-client-sdk-for-typescript",{"key":545,"label":546,"href":547},"github.sdks.dart","Dart SDK","https:\u002F\u002Fgithub.com\u002Fpieces-app\u002Fpieces-os-client-sdk-for-dart",{"key":549,"label":550,"href":551},"github.sdks.kotlin","Kotlin SDK","https:\u002F\u002Fgithub.com\u002Fpieces-app\u002Fpieces-os-client-sdk-for-kotlin",{"key":553,"label":554,"href":555},"github.plugins.obsidian","Obsidian plugin repository","https:\u002F\u002Fgithub.com\u002Fpieces-app\u002Fobsidian-pieces",{"key":557,"label":558,"href":255},"github.plugins.jupyterlab","JupyterLab plugin repository",{"key":560,"label":561,"href":562},"github.plugins.sublime","Sublime plugin repository","https:\u002F\u002Fgithub.com\u002Fpieces-app\u002Fplugin_sublime",{"key":564,"label":565,"href":566},"github.plugins.neovim","Neovim plugin repository","https:\u002F\u002Fgithub.com\u002Fpieces-app\u002Fplugin_neovim",{"key":568,"label":569,"href":570},"github.cliAgent","CLI agent repository","https:\u002F\u002Fgithub.com\u002Fpieces-app\u002Fcli-agent",{"key":572,"label":573,"href":574},"github.mcpDart","MCP Dart repository","https:\u002F\u002Fgithub.com\u002Fpieces-app\u002Fmcp_dart",{"key":576,"label":577,"href":578},"github.awesomePieces","Awesome Pieces repository","https:\u002F\u002Fgithub.com\u002Fpieces-app\u002Fawesome-pieces",{"key":580,"label":581,"href":66},"legal.privacyPolicy","Privacy policy",{"key":583,"label":584,"href":69},"legal.refundPolicy","Refund policy",{"key":586,"label":587,"href":72},"legal.terms","Terms",{"key":589,"label":590,"href":591},"legal.security","Legal security","https:\u002F\u002Fpieces.app\u002Flegal\u002Fsecurity",{"key":593,"label":594,"href":511},"videos.youtubeChannel","YouTube channel",{"key":596,"label":597,"href":598},"videos.gettingStartedDesktop","Getting started desktop video","https:\u002F\u002Fyoutu.be\u002FdUr1lRM_TYk",{"key":600,"label":601,"href":602},"videos.snippetDiscoveryxR","Snippet discovery video","https:\u002F\u002Fyoutu.be\u002FG6vb1USw-30",{"key":604,"label":605,"href":606},"sales.bookACall","Book a sales call","https:\u002F\u002Fcalendar.app.google\u002FWVUDtUfNy5Vst3sH7",{"key":608,"label":609,"href":610},"sales.enterprise","Enterprise form","https:\u002F\u002Fgetpieces.typeform.com\u002Fto\u002FaVQFTvpE",{"key":612,"label":613,"href":527},"sales.feedback","Feedback discussions",{"key":615,"label":616,"href":617},"sales.earlyAccess","Early access form","https:\u002F\u002Fgetpieces.typeform.com\u002Fearlyaccess",{"key":619,"label":620,"href":621},"sales.supportEmail","Support email","mailto:support@pieces.app",{"key":623,"label":624,"href":19},"routes.home","Home route",{"key":626,"label":627,"href":56},"routes.about","About route",{"key":629,"label":630,"href":12},"routes.downloads","Downloads route",{"key":632,"label":633,"href":634},"routes.thanks","Post-install thanks route","\u002Finstall\u002Fthanks",{"key":636,"label":637,"href":638},"routes.pricing","Pricing route","\u002Fpricing",{"key":640,"label":641,"href":642},"cta.freeTrial","Start free trial CTA (Pieces Pro) — used by \u002Fcampaigns\u002F* landing pages","https:\u002F\u002Fcampaigns.pieces.app\u002F",{"key":644,"label":645,"href":22},"routes.enterprise","Enterprise route",{"key":647,"label":648,"href":62},"routes.contact","Contact route",{"key":650,"label":651,"href":59},"routes.updates","Updates route",{"key":653,"label":654,"href":655},"routes.migrationError","Migration error route","\u002Fmigration\u002Ferror",{"key":657,"label":658,"href":659},"routes.authenticated","Post-login authenticated route","\u002Fauth\u002Fsigned-in",{"key":661,"label":662,"href":663},"routes.signed-out","Signed out route","\u002Fauth\u002Fsigned-out",{"key":665,"label":666,"href":667},"routes.authentication-error","Authentication error route","\u002Fauth\u002Ferror",{},"data\u002Fshared\u002Furls","2AvfSWI6bZACH5Kr1ZS3txMLjteRjCjbDR_ul1uRZ9Q",{"id":672,"title":673,"author":674,"authorPhoto":675,"authorPhotoAlt":676,"authorSlug":677,"body":678,"buttonText":676,"buttonUrl":676,"category":1263,"date":1264,"description":1265,"draft":1266,"editorsPick":1266,"extension":1267,"featured":1266,"image":1268,"imageAlt":676,"meta":1269,"navigation":32,"ogImage":676,"ogImageAlt":676,"path":1270,"seo":1271,"stem":1272,"tags":676,"__hash__":1273},"blog\u002Fblog\u002Fbreaking-down-java-21-features-a-developers-guide.md","Breaking Down Java 21 Features: A Developer's Guide","Tarun Kumar","https:\u002F\u002Fstorage.googleapis.com\u002Fpieces-marketing-website\u002Fimages\u002Fblog\u002Fbreaking-down-java-21-features-a-developers-guide\u002Fauthor.jpeg",null,"tarun-kumar",{"type":679,"value":680,"toc":1254},"minimark",[681,693,696,701,710,717,721,724,727,730,733,745,748,754,757,760,763,766,770,773,776,779,782,804,814,824,831,837,840,913,916,919,940,943,954,966,972,978,985,991,1025,1029,1032,1035,1038,1044,1047,1051,1054,1062,1068,1074,1080,1103,1114,1117,1147,1158,1164,1170,1179,1182,1189,1194,1201,1207,1210,1216,1223,1230,1234,1237,1240,1243,1251],[682,683,684,685,692],"p",{},"In the constantly evolving world of programming, Java remains a steadfast player, adapting to meet the dynamic needs of the software development landscape. Java is a popular and flexible ",[686,687,691],"a",{"href":688,"rel":689},"https:\u002F\u002Fcode.pieces.app\u002Fblog\u002Fthe-top-3-object-oriented-programming-languages",[690],"nofollow","object-oriented programming language"," used for creating software. Simplicity and reliability makes it an ideal choice for everything from web applications and mobile apps to large-scale enterprise systems.",[682,694,695],{},"With the release of Java 21, a new chapter unfolds in Java's journey. Java 21 introduces a host of exciting features and enhancements, promising to reshape the way developers approach their craft. In this blog, we will explore some of the key updates to keep an eye on and effective ways to incorporate them into your daily development practices.",[697,698,700],"h2",{"id":699},"an-overview-of-the-features","An Overview of the Features",[682,702,703,704,709],{},"Here are some of the features Java 21 has in store. We'll focus on the big ones, but if you're feeling adventurous and want to dig into the tiny details, check out the official release notes at ",[686,705,708],{"href":706,"rel":707},"https:\u002F\u002Fopenjdk.org\u002Fprojects\u002Fjdk\u002F21\u002F",[690],"OpenJDK",".",[682,711,712],{},[713,714],"img",{"alt":715,"src":716},"Java 21 Features.","https:\u002F\u002Fstorage.googleapis.com\u002Fpieces-marketing-website\u002Fimages\u002Fblog\u002Fbreaking-down-java-21-features-a-developers-guide\u002Fimg-001.png",[697,718,720],{"id":719},"virtual-threads","Virtual Threads",[682,722,723],{},"Before exploring Virtual threads, let's examine the factors that led to the concept of virtuality in threads.",[682,725,726],{},"Java has supported threads from Day 0, distinguishing it from other programming languages by integrating cross-platform concurrency and memory models. Threads enable us to perform multiple tasks simultaneously with sequential code, resulting in an understandable control flow. They provide excellent debugging and error handling serviceability, with comprehensible stack traces. Furthermore, they are the natural unit of scheduling for operating systems.",[682,728,729],{},"However, threads can be heavyweight and expensive to create. Given that their stacks are on the scale of megabytes, we can only create a few thousand of them, leading to scalability issues. One solution to this problem is to introduce reactive async frameworks. While these frameworks promise better scaling, they come at a significant cost. They are challenging to debug and yield incomprehensible stack traces, leading to a convoluted programming model.",[682,731,732],{},"The best way to handle the issue is by introducing virtual threads. They are lightweight and do not drag around large megabyte-scale data structures. Virtual threads store their stack as delimited continuations in the garbage-collected heap. The stacks are pay-as-you-go, starting with approximately 200-300 bytes and scaling to a million concurrent connections on a decent machine.",[682,734,735,736,740,741,744],{},"Virtual Threads are indeed real threads! They implement ",[737,738,739],"code",{},"java.lang.Thread"," and support ",[737,742,743],{},"ThreadLocal",". They also provide clean stack traces, thread dumps, single-step debugging, and profiling. This means all your threaded code functions as expected. The OpenJDK folks like to call this feature \"Threads without the baggage.”",[682,746,747],{},"The point of the virtual thread is not to make the applications run faster but rather will make them scale better. In most server applications, most requests spend their time waiting for I\u002FO operations, like I\u002FO on a socket, file or database. If we program using a comfortable thread per task model, as most of the tasks are waiting on I\u002FO eventually we run out of threads before we run out of CPU, this effectively raises the cost of the application as we would need more free memory.",[682,749,750],{},[713,751],{"alt":752,"src":753},"A graphical representation of load vs latency.","https:\u002F\u002Fstorage.googleapis.com\u002Fpieces-marketing-website\u002Fimages\u002Fblog\u002Fbreaking-down-java-21-features-a-developers-guide\u002Fimg-002.png",[682,755,756],{},"The above graph illustrates the advantages of using virtual threads in Java 21. Say we have some I\u002FO bound task in the thread pool, the blue line represents the thread pool with 200 threads. Initially, as the application's load increases, the latency remains manageable. However, when all the threads are engaged, the latency begins to fall apart. Attempting to address this by increasing the number of threads in the pool, as indicated by the greenish-blue line, eventually will end up in the same scenario as before, you hit the bottle-neck of how many threads you can have before you run out of the CPU, and latency falls again.",[682,758,759],{},"In contrast, virtual threads are depicted by the green line. They exhibit a distinctive behavior, running seamlessly along the x-axis without hitting the same bottleneck as traditional threads. Virtual threads continue to execute efficiently until they encounter CPU resource limitations, at which point latency starts to increase. This innovation in Java 21 offers a more robust and scalable solution for managing concurrency.",[682,761,762],{},"Virtual threads differ from conventional concurrency as they are designed to model a single task, not a mechanism for running tasks. So, trying to pool them isn't the right way to go. Instead, it's quite affordable to create a separate thread for each user request or an asynchronous task. This approach follows the \"one thread per request\" model and still scales well.",[682,764,765],{},"Virtual threads are a way to make the most of your resources and handle multiple tasks effectively in Java 21.",[697,767,769],{"id":768},"new-paradigm-structured-concurrency","New Paradigm: Structured Concurrency",[682,771,772],{},"Java 21 has simplified concurrent programming by introducing an API for structured concurrency.",[682,774,775],{},"Structured concurrency has been a well-explored concept in the Python and C++ communities for some time. In contrast, Java has recently acknowledged its significance, introducing it as a preview feature in Java 21. We'll look into the steps for utilizing these preview features in a later discussion.",[682,777,778],{},"Structured concurrency is a concept that simplifies concurrent programming by treating groups of related tasks running in different threads as a single unit of work. This approach streamlines error handling and cancellation processes, leading to improved reliability and enhanced observability. Promoting this style of concurrent programming, eliminates common risks arising from cancellation and shutdown, such as thread leaks and cancellation delays making Java 21 more automated than the previous versions.",[682,780,781],{},"The fundamental idea behind structured concurrency is straightforward: it ensures that when a control flow divides into multiple concurrent tasks, they must rejoin within the same lexical scope. In other words, the parent task needs to wait for its children to complete their work. The success of this concurrency model is largely attributed to the implementation of virtual threads, which makes managing threads more cost-effective.",[682,783,784,785,788,789,792,793,796,797,799,800,803],{},"Let’s have a look at how to effectively use the structured concurrency API with the help of an example, consider a method, ",[737,786,787],{},"handle()",", that represents a task in a server application. It handles an incoming request by executing two subtasks. One subtask executes the method ",[737,790,791],{},"findUser()"," and the other subtask executes the method ",[737,794,795],{},"fetchOrder()",". The ",[737,798,787],{}," method awaits the subtasks' results via blocking calls to their future ",[737,801,802],{},"get()"," methods, so the task is said to join its subtasks.",[682,805,806,807,810,811,709],{},"Let's first examine how to implement this method using unstructured concurrency with the ",[737,808,809],{},"ExecutorService"," API provided in ",[737,812,813],{},"java.util.concurrent.ExecutorService",[815,816,821],"pre",{"className":817,"code":819,"language":820},[818],"language-text","Response handle() throws ExecutionException, InterruptedException {      Future user = esvc.submit(() -> findUser());      Future order = esvc.submit(() -> fetchOrder());\n      String theUser = user.get(); \u002F\u002F Join findUser\n      int theOrder = order.get(); \u002F\u002F Join fetchOrder\nreturn new Response(theUser, theOrder);\n}\n","text",[737,822,819],{"__ignoreMap":823},"",[682,825,826],{},[686,827,830],{"href":828,"rel":829},"https:\u002F\u002Ftarun.pieces.cloud\u002F?p=b612498517",[690],"Save this snippet",[682,832,833,834,836],{},"Because the subtasks execute concurrently, each subtask can succeed or fail independently. Often, a task such as ",[737,835,787],{}," should fail if any of its subtasks fail.",[682,838,839],{},"The lifetimes of the threads is complicated whenever a failure occurs:",[841,842,843,868,883],"ul",{},[844,845,846,847,849,850,852,853,856,857,859,860,864,865,867],"li",{},"If ",[737,848,791],{}," throws an exception then ",[737,851,787],{}," will throw an exception when calling ",[737,854,855],{},"user.get()"," but ",[737,858,795],{}," will continue to run in its own thread. This is a ",[861,862,863],"strong",{},"thread leak"," that, at best, wastes resources; at worst, the ",[737,866,795],{}," thread will interfere with other tasks.",[844,869,870,871,873,874,876,877,879,880,882],{},"If the thread executing ",[737,872,787],{}," is interrupted, the interruption will not propagate to the subtasks. Both the ",[737,875,791],{}," and ",[737,878,795],{}," threads will leak, continuing to run even after ",[737,881,787],{}," has failed.",[844,884,846,885,887,888,890,891,893,894,896,897,899,900,902,903,905,906,909,910,912],{},[737,886,791],{}," takes a long time to execute, but ",[737,889,795],{}," fails in the meantime, then ",[737,892,787],{}," will wait unnecessarily for ",[737,895,791],{}," by blocking on ",[737,898,855],{}," rather than cancelling it. Only after ",[737,901,791],{}," completes and ",[737,904,855],{}," returns will ",[737,907,908],{},"order.get()"," throw an exception, causing ",[737,911,787],{}," to fail.",[682,914,915],{},"In each case, the problem is that our program is logically structured with task-subtask relationships, but these relationships exist only in the developer's mind.",[682,917,918],{},"This not only creates more room for error, but it makes diagnosing and troubleshooting such errors more difficult.",[682,920,921,922,924,925,927,928,930,931,933,934,936,937,939],{},"In the above ",[737,923,787],{}," method, the failure of ",[737,926,795],{}," cannot automatically cause the cancellation of ",[737,929,791],{},". The future for ",[737,932,795],{}," is unrelated to the future for ",[737,935,791],{},", and neither is related to the thread that will ultimately join it via its ",[737,938,802],{}," method. Rather than developers managing such cancellations manually, structured concurrency reliably automates it.",[682,941,942],{},"Now let’s look at how the same method can be implemented using structured concurrency.",[682,944,945,946,949,950,953],{},"The principal class of the structured concurrency API is ",[737,947,948],{},"StructuredTaskScope"," in the ",[737,951,952],{},"java.util.concurrent"," package.",[682,955,956,957,959,960,962,963],{},"Here is the ",[737,958,787],{}," example from earlier, written to use ",[737,961,948],{}," with one of its subclass ",[737,964,965],{},"ShutdownOnFailure",[815,967,970],{"className":968,"code":969,"language":820},[818],"Response handle() throws ExecutionException, InterruptedException { \n  try (var scope = new StructuredTaskScope.ShutdownOnFailure()) {   \n      Supplier user = scope.fork(() -> findUser());       Supplier order = scope.fork(() -> fetchOrder()); \n      scope.join()      \u002F\u002F Join both subtasks \n           .throwIfFailed(); \u002F\u002F ... and propagate errors \n      \u002F\u002F Here, both subtasks have succeeded, so compose their results \n      return new Response(user.get(), order.get()); \n   } \n}\n",[737,971,969],{"__ignoreMap":823},[682,973,974],{},[686,975,830],{"href":976,"rel":977},"https:\u002F\u002Ftarun.pieces.cloud\u002F?p=696642bf4a",[690],[682,979,980,981,984],{},"In contrast to the original example, understanding the lifetimes of the threads involved here is easy: Under all conditions their lifetimes are confined to a lexical scope, namely the body of the ",[737,982,983],{},"try-with-resources"," statement.",[682,986,987,988,990],{},"The use of ",[737,989,948],{}," ensures a number of valuable properties:",[841,992,993,1004,1014,1017],{},[844,994,995,996,998,999,1001,1002,709],{},"Error handling with short-circuiting - If either the ",[737,997,791],{}," or ",[737,1000,795],{}," subtasks fail, the other is canceled if it has not yet completed, which is managed by the shutdown policy through ",[737,1003,965],{},[844,1005,1006,1007,1009,1010,1013],{},"Cancellation propagation - If the thread running ",[737,1008,787],{}," is interrupted before or during the call to ",[737,1011,1012],{},"join()",", both subtasks are canceled automatically when the thread exits the scope.",[844,1015,1016],{},"Clarity - The above code has a clear structure: Set up the subtasks, wait for them to either complete or be canceled, and then decide whether to succeed (and process the results of the child tasks, which are already finished) or fail (and the subtasks are already finished, so there is nothing more to clean up).",[844,1018,1019,1020,876,1022,1024],{},"Observability - A thread dump, clearly displays the task hierarchy, with the threads running ",[737,1021,791],{},[737,1023,795],{}," shown as children of the scope.",[697,1026,1028],{"id":1027},"generational-zgc-z-garbage-collector","Generational ZGC (Z Garbage Collector)",[682,1030,1031],{},"Java 21 improves application performance by extending the Z Garbage Collector to maintain separate generations for young and old objects. This will allow ZGC to collect young objects — which tend to die young — more frequently.",[682,1033,1034],{},"The Z garbage collector is designed for low latency and high scalability and was introduced in JDK 15 by providing a Terabytes-scale sized heap with sub-millisecond pauses, where the pauses do not scale with heap size or live-set. It had almost all the features one could expect in a modern garbage collector such as Concurrent, Parallel, Auto-tuning, Compacting, Region-based, and Numa-Aware with an upshot being not to worry about the GC pauses. However, it's essential to note that these benefits come at a cost, resulting in approximately a 2% reduction in throughput and increased memory utilization.",[682,1036,1037],{},"ZGC was a single-generation garbage collector until Java 21 introduced the generational capability. The new Generational ZGC maintains the same level of throughput while requiring significantly less memory. In practical terms, when conducting an Apache Cassandra benchmark, Generational ZGC only needs a quarter of the heap size. Yet, it attains four times the throughput compared to the non-generational ZGC. Importantly, it manages to achieve this while maintaining pause times under one millisecond.",[682,1039,1040],{},[713,1041],{"alt":1042,"src":1043},"Improvements to various Java functions.","https:\u002F\u002Fstorage.googleapis.com\u002Fpieces-marketing-website\u002Fimages\u002Fblog\u002Fbreaking-down-java-21-features-a-developers-guide\u002Fimg-003.png",[682,1045,1046],{},"The improvements aren't limited to just the ZGC algorithm, there have also been noticeable enhancements in the Parallel and G1 collectors. These improvements are evident when comparing them with their performance in JDK 17 and 8.",[697,1048,1050],{"id":1049},"unnamed-classes-and-instance-main-methods","Unnamed Classes and Instance Main Methods",[682,1052,1053],{},"I remember the first time I attempted to write the \"Hello World\" program in Java. It took me nearly 5 minutes just to transcribe it from the book, as I initially struggled to grasp the concept. I'm confident that anyone, from those learning Java for the first time to seasoned experts, may have had a similar experience. However, with the introduction of Java 21, that learning curve is set to undergo a transformation. Beginners can now write streamlined declarations for single-class programs and then seamlessly expand their programs to use more advanced features as their skills grow.",[682,1055,1056,1057,1061],{},"This was the classic ",[1058,1059,1060],"em",{},"Hello World"," program that I wrote for the first time in Java",[815,1063,1066],{"className":1064,"code":1065,"language":820},[818],"public class HelloWorld {\n  public static void main(String[] args) {\n    System.out.println(\"Hello, World!\");\n  }\n}\n",[737,1067,1065],{"__ignoreMap":823},[682,1069,1070,1071,1073],{},"And this would be the ",[1058,1072,1060],{}," program that someone just starting to learn Java would be writing in Java 21",[815,1075,1078],{"className":1076,"code":1077,"language":820},[818],"void main() {\n   System.out.println(\"Hello, World!\");\n}\n",[737,1079,1077],{"__ignoreMap":823},[682,1081,1082,1083,1086,1087,1090,1091,1094,1095,1098,1099,1102],{},"Firstly, Java 21 comes with an enhanced protocol by which Java programs are launched to allow ",[1058,1084,1085],{},"instance main methods",". Such methods are ",[861,1088,1089],{},"not"," ",[737,1092,1093],{},"static",", need not be ",[737,1096,1097],{},"public",", and need not have a ",[737,1100,1101],{},"String[]"," parameter.",[682,1104,1105,1106,1109,1110,1113],{},"Secondly, it introduces ",[1058,1107,1108],{},"unnamed classes"," to make the ",[737,1111,1112],{},"class"," declaration implicit.",[682,1115,1116],{},"When launching a Java class, the launch protocol follows a specific order to determine which method to invoke:",[1118,1119,1120,1127,1134,1141],"ol",{},[844,1121,1122,1123,1126],{},"It first looks for a ",[737,1124,1125],{},"static void main(String[] args)"," method in the launched class with non-private access (public, protected, or package-private).",[844,1128,1129,1130,1133],{},"If the above method is not found, it checks for a ",[737,1131,1132],{},"static void main()"," method with non-private access in the launched class.",[844,1135,1136,1137,1140],{},"If neither of the static methods exists, it searches for a ",[737,1138,1139],{},"void main(String[] args)"," instance method with non-private access declared in the launched class or inherited from a superclass.",[844,1142,1143,1144,1140],{},"Finally, if none of the above methods is present, it looks for a ",[737,1145,1146],{},"void main()",[682,1148,1149,1150,1153,1154,1157],{},"Note that this is a change of behavior: If the launched class declares an instance main, that method will be invoked rather than an inherited \"traditional\" ",[737,1151,1152],{},"public static void main(String[] args)"," declared in a superclass. Therefore, if the launched class inherits a \"traditional\" main method but another method (i.e. an instance ",[737,1155,1156],{},"main",") is selected, the JVM will issue a warning to the standard error at runtime.",[682,1159,1160,1161,1163],{},"If the selected ",[737,1162,1156],{}," is an instance method and is a member of an inner class, the program will fail to launch.",[682,1165,1166,1167,1169],{},"An unnamed class is situated within the unnamed package, which, in turn, resides in the unnamed module. Although there is only one unnamed package (unless multiple class loaders are involved) and only one unnamed module, the unnamed module can contain multiple unnamed classes. Each unnamed class includes a ",[737,1168,1156],{}," method, essentially making it a program. Therefore, the presence of multiple such unnamed classes within the unnamed package equates to multiple distinct programs.",[682,1171,1172,1173,876,1176,1178],{},"In many ways, an unnamed class is quite similar to an explicitly declared class. It can have members with the same modifiers, like ",[737,1174,1175],{},"private",[737,1177,1093],{},", and these modifiers have the same default behaviors, such as package access and instance membership. However, a significant distinction lies in the fact that while an unnamed class automatically possesses a default zero-parameter constructor, it cannot have any other constructors.",[682,1180,1181],{},"Since this is a feature in preview mode, it is disabled by default. To enable preview features in JDK 21, let's consider the example with the same \"Hello World\" program we discussed earlier.",[682,1183,1184,1185,1188],{},"If you have a file named ",[737,1186,1187],{},"HelloWorld.java"," with the following code:",[815,1190,1192],{"className":1191,"code":1077,"language":820},[818],[737,1193,1077],{"__ignoreMap":823},[682,1195,1196,1197,1200],{},"When you try to compile it in the usual way using ",[737,1198,1199],{},"javac HelloWorld.java",", you'll encounter the following error:",[815,1202,1205],{"className":1203,"code":1204,"language":820},[818],"error: unnamed classes are a preview feature and are disabled by default\n",[737,1206,1204],{"__ignoreMap":823},[682,1208,1209],{},"To enable preview features, you need to compile the program with the following command:",[815,1211,1214],{"className":1212,"code":1213,"language":820},[818],"javac --release 21 --enable-preview HelloWorld.java\n",[737,1215,1213],{"__ignoreMap":823},[682,1217,1218],{},[686,1219,1222],{"href":1220,"rel":1221},"https:\u002F\u002Ftarun.pieces.cloud\u002F?p=466746b2b9",[690],"Save this command",[682,1224,1225,1226,1229],{},"And when running the program, you should use: ",[737,1227,1228],{},"java --enable-preview HelloWorld"," This enables the use of the preview feature in your Java program.",[697,1231,1233],{"id":1232},"conclusion","Conclusion",[682,1235,1236],{},"When we consider the updates that Java 21 has brought to the community, we can confidently say that migrating to Java 21 does not pose a significant risk of breaking things. Unlike the upgrade from Java 8 to Java 11, where issues arose immediately, these latest versions have undergone extensive testing and updates through a series of intermediate releases.",[682,1238,1239],{},"Having said that, the Java 21 environment is still in development, but it's expected to be ready in the near future.",[682,1241,1242],{},"These are just a few of the noteworthy features introduced in Java 21. With each new release, Java continues to evolve and provide developers with powerful tools to write cleaner, more efficient, and more expressive code. Whether it's pattern matching, virtual threads, sealed classes, structured concurrency, or the generational ZGC, these features significantly benefit developers and make Java an even more compelling choice for building robust and scalable applications.",[682,1244,1245,1246,709],{},"I would also suggest exploring more in-depth blogs authored by experts on each of these features at ",[686,1247,1250],{"href":1248,"rel":1249},"https:\u002F\u002Finside.java\u002Ftag\u002Fjdk%2021",[690],"Inside Java",[682,1252,1253],{},"So, what are you waiting for? Upgrade to Java 21 and start exploring these exciting features today!",{"title":823,"searchDepth":1255,"depth":1255,"links":1256},2,[1257,1258,1259,1260,1261,1262],{"id":699,"depth":1255,"text":700},{"id":719,"depth":1255,"text":720},{"id":768,"depth":1255,"text":769},{"id":1027,"depth":1255,"text":1028},{"id":1049,"depth":1255,"text":1050},{"id":1232,"depth":1255,"text":1233},"Software Development","2023-12-29T00:00:00.000Z","Java has been the programming language of choice for many developers. Join us as we dive into the world of Java 21 and uncover the fresh possibilities it has to offer.",false,"md","https:\u002F\u002Fstorage.googleapis.com\u002Fpieces-marketing-website\u002Fimages\u002Fblog\u002Fbreaking-down-java-21-features-a-developers-guide\u002Fhero.jpeg",{},"\u002Fblog\u002Fbreaking-down-java-21-features-a-developers-guide",{"title":673,"description":1265},"blog\u002Fbreaking-down-java-21-features-a-developers-guide","RiC1l0eQAlnky1M81AfTeLc3qHdsGp3q62ZgX0Jo1Sw",{"id":1275,"title":674,"body":1276,"description":823,"draft":1266,"extension":1267,"meta":1280,"navigation":32,"path":1281,"photo":1282,"photoAlt":676,"seo":1283,"stem":1284,"__hash__":1285},"authors\u002Fauthors\u002Ftarun-kumar.md",{"type":679,"value":1277,"toc":1278},[],{"title":823,"searchDepth":1255,"depth":1255,"links":1279},[],{},"\u002Fauthors\u002Ftarun-kumar","https:\u002F\u002Fstorage.googleapis.com\u002Fpieces-marketing-website\u002Fimages\u002Fauthors\u002Ftarun-kumar.jpg",{"title":674,"description":823},"authors\u002Ftarun-kumar","5YJ0F31dC2N6i-CXUcymzIS8Q3kzqsDAc3zNXzEtCmU",{"left":1287,"top":1287,"width":1288,"height":1288,"rotate":1287,"vFlip":1266,"hFlip":1266,"body":1289},0,24,"\u003Cpath fill=\"currentColor\" d=\"m7.825 13l4.9 4.9q.3.3.288.7t-.313.7q-.3.275-.7.288t-.7-.288l-6.6-6.6q-.15-.15-.213-.325T4.426 12t.063-.375t.212-.325l6.6-6.6q.275-.275.688-.275t.712.275q.3.3.3.713t-.3.712L7.825 11H19q.425 0 .713.288T20 12t-.288.713T19 13z\"\u002F>"]