JShell JShell에서 코드를 실행하고 즉시 출력을 표시하는 대화식 Java Shell 도구입니다. JShell은 REPL 입니다. (읽기-평가-인쇄-루프 ) 명령줄에서 실행할 수 있는 도구 프롬프트.
JShell에는 몇 가지 미리 정의된 특별한 옵션을 포함하는 시작 시 스크립트를 로드하는 옵션이 있습니다. "--startup을 사용하여 지정할 수 있습니다. " 파일 이름 또는 DEFAULT 중 하나를 전달하는 플래그 , JAVASE 및 인쇄 중 . "/list -start를 사용할 수 있습니다. " comamnd는 평가할 모든 시작 스니펫을 봅니다.
- 기본값: 기본 동작을 로드합니다. 이는 전혀 지정되지 않은 것과 동일하게 작동합니다.
- 자바: 기본적으로 모든 Java SE 패키지를 가져옵니다.
- 인쇄 중: 사용할 함수 print, println 및 printf를 정의합니다.
아래 코드 스니펫에서 "DEFAULT " 시작 스크립트로.
C:\Users\User>jshell --startup DEFAULT | Welcome to JShell -- Version 9.0.4 | For an introduction type: /help intro jshell> /list -start s1 : import java.io.*; s2 : import java.math.*; s3 : import java.net.*; s4 : import java.nio.file.*; s5 : import java.util.*; s6 : import java.util.concurrent.*; s7 : import java.util.function.*; s8 : import java.util.prefs.*; s9 : import java.util.regex.*; s10 : import java.util.stream.*;
아래 코드 스니펫에서 "JAVASE " 시작 스크립트로.
C:\Users\User>jshell --startup JAVASE | Welcome to JShell -- Version 9.0.4 | For an introduction type: /help intro jshell> /list -start s1 : import java.applet.*; s2 : import java.awt.*; s3 : import java.awt.color.*; s4 : import java.awt.datatransfer.*; s5 : import java.awt.desktop.*; s6 : import java.awt.dnd.*; s7 : import java.awt.event.*; s8 : import java.awt.font.*; s9 : import java.awt.geom.*; s10 : import java.awt.im.*; s11 : import java.awt.im.spi.*; s12 : import java.awt.image.*; s13 : import java.awt.image.renderable.*; s14 : import java.awt.print.*; s15 : import java.beans.*; s16 : import java.beans.beancontext.*; s17 : import java.io.*; s18 : import java.lang.*; s19 : import java.lang.annotation.*; s20 : import java.lang.instrument.*; s21 : import java.lang.invoke.*; s22 : import java.lang.management.*; s23 : import java.lang.module.*; s24 : import java.lang.ref.*; s25 : import java.lang.reflect.*; s26 : import java.math.*; s27 : import java.net.*; s28 : import java.net.spi.*; s29 : import java.nio.*; s30 : import java.nio.channels.*; s31 : import java.nio.channels.spi.*; s32 : import java.nio.charset.*; s33 : import java.nio.charset.spi.*; s34 : import java.nio.file.*; s35 : import java.nio.file.attribute.*; s36 : import java.nio.file.spi.*; s37 : import java.rmi.*; s38 : import java.rmi.activation.*; s39 : import java.rmi.dgc.*; s40 : import java.rmi.registry.*; s41 : import java.rmi.server.*; s42 : import java.security.*; s43 : import java.security.acl.*; s44 : import java.security.cert.*; s45 : import java.security.interfaces.*; s46 : import java.security.spec.*; s47 : import java.sql.*; s48 : import java.text.*; s49 : import java.text.spi.*; s50 : import java.time.*; s51 : import java.time.chrono.*; s52 : import java.time.format.*; s53 : import java.time.temporal.*; s54 : import java.time.zone.*; s55 : import java.util.*; s56 : import java.util.concurrent.*; s57 : import java.util.concurrent.atomic.*; s58 : import java.util.concurrent.locks.*; s59 : import java.util.function.*; s60 : import java.util.jar.*; s61 : import java.util.logging.*; s62 : import java.util.prefs.*; s63 : import java.util.regex.*; s64 : import java.util.spi.*; s65 : import java.util.stream.*; s66 : import java.util.zip.*; s67 : import javax.accessibility.*; s68 : import javax.annotation.processing.*; s69 : import javax.crypto.*; s70 : import javax.crypto.interfaces.*; s71 : import javax.crypto.spec.*; s72 : import javax.imageio.*; s73 : import javax.imageio.event.*; s74 : import javax.imageio.metadata.*; s75 : import javax.imageio.plugins.bmp.*; s76 : import javax.imageio.plugins.jpeg.*; s77 : import javax.imageio.plugins.tiff.*; s78 : import javax.imageio.spi.*; s79 : import javax.imageio.stream.*; s80 : import javax.lang.model.*; s81 : import javax.lang.model.element.*; s82 : import javax.lang.model.type.*; s83 : import javax.lang.model.util.*; s84 : import javax.management.*; s85 : import javax.management.loading.*; s86 : import javax.management.modelmbean.*; s87 : import javax.management.monitor.*; s88 : import javax.management.openmbean.*; s89 : import javax.management.relation.*; s90 : import javax.management.remote.*; s91 : import javax.management.remote.rmi.*; s92 : import javax.management.timer.*; s93 : import javax.naming.*; s94 : import javax.naming.directory.*; s95 : import javax.naming.event.*; s96 : import javax.naming.ldap.*; s97 : import javax.naming.spi.*; s98 : import javax.net.*; s99 : import javax.net.ssl.*; s100 : import javax.print.*; s101 : import javax.print.attribute.*; s102 : import javax.print.attribute.standard.* s103 : import javax.print.event.*; s104 : import javax.rmi.ssl.*; s105 : import javax.script.*; s106 : import javax.security.auth.*; s107 : import javax.security.auth.callback.*; s108 : import javax.security.auth.kerberos.*; s109 : import javax.security.auth.login.*; s110 : import javax.security.auth.spi.*; s111 : import javax.security.auth.x500.*; s112 : import javax.security.cert.*; s113 : import javax.security.sasl.*; s114 : import javax.sound.midi.*; s115 : import javax.sound.midi.spi.*; s116 : import javax.sound.sampled.*; s117 : import javax.sound.sampled.spi.*; s118 : import javax.sql.*; s119 : import javax.sql.rowset.*; s120 : import javax.sql.rowset.serial.*; s121 : import javax.sql.rowset.spi.*; s122 : import javax.swing.*; s123 : import javax.swing.border.*; s124 : import javax.swing.colorchooser.*; s125 : import javax.swing.event.*; s126 : import javax.swing.filechooser.*; s127 : import javax.swing.plaf.*; s128 : import javax.swing.plaf.basic.*; s129 : import javax.swing.plaf.metal.*; s130 : import javax.swing.plaf.multi.*; s131 : import javax.swing.plaf.nimbus.*; s132 : import javax.swing.plaf.synth.*; s133 : import javax.swing.table.*; s134 : import javax.swing.text.*; s135 : import javax.swing.text.html.*; s136 : import javax.swing.text.html.parser.*; s137 : import javax.swing.text.rtf.*; s138 : import javax.swing.tree.*; s139 : import javax.swing.undo.*; s140 : import javax.tools.*; s141 : import javax.transaction.xa.*; s142 : import javax.xml.*; s143 : import javax.xml.catalog.*; s144 : import javax.xml.crypto.*; s145 : import javax.xml.crypto.dom.*; s146 : import javax.xml.crypto.dsig.*; s147 : import javax.xml.crypto.dsig.dom.*; s148 : import javax.xml.crypto.dsig.keyinfo.*; s149 : import javax.xml.crypto.dsig.spec.*; s150 : import javax.xml.datatype.*; s151 : import javax.xml.namespace.*; s152 : import javax.xml.parsers.*; s153 : import javax.xml.stream.*; s154 : import javax.xml.stream.events.*; s155 : import javax.xml.stream.util.*; s156 : import javax.xml.transform.*; s157 : import javax.xml.transform.dom.*; s158 : import javax.xml.transform.sax.*; s159 : import javax.xml.transform.stax.*; s160 : import javax.xml.transform.stream.*; s161 : import javax.xml.validation.*; s162 : import javax.xml.xpath.*; s163 : import org.ietf.jgss.*; s164 : import org.w3c.dom.*; s165 : import org.w3c.dom.bootstrap.*; s166 : import org.w3c.dom.events.*; s167 : import org.w3c.dom.ls.*; s168 : import org.w3c.dom.ranges.*; s169 : import org.w3c.dom.traversal.*; s170 : import org.w3c.dom.views.*; s171 : import org.xml.sax.*; s172 : import org.xml.sax.ext.*; s173 : import org.xml.sax.helpers.*;
나 아래 코드 스니펫에서 "PRINTING " 시작 스크립트로.
C:\Users\User>jshell --startup PRINTING | Welcome to JShell -- Version 9.0.4 | For an introduction type: /help intro jshell> /list -start s1 : void print(boolean b) { System.out.print(b); } s2 : void print(char c) { System.out.print(c); } s3 : void print(int i) { System.out.print(i); } s4 : void print(long l) { System.out.print(l); } s5 : void print(float f) { System.out.print(f); } s6 : void print(double d) { System.out.print(d); } s7 : void print(char s[]) { System.out.print(s); } s8 : void print(String s) { System.out.print(s); } s9 : void print(Object obj) { System.out.print(obj); } s10 : void println() { System.out.println(); } s11 : void println(boolean b) { System.out.println(b); } s12 : void println(char c) { System.out.println(c); } s13 : void println(int i) { System.out.println(i); } s14 : void println(long l) { System.out.println(l); } s15 : void println(float f) { System.out.println(f); } s16 : void println(double d) { System.out.println(d); } s17 : void println(char s[]) { System.out.println(s); } s18 : void println(String s) { System.out.println(s); } s19 : void println(Object obj) { System.out.println(obj); } s20 : void printf(java.util.Locale l, String format, Object... args) { System.out.printf(l, format, args); } s21 : void printf(String format, Object... args) { System.out.printf(format, args); }