Created
February 19, 2021 11:34
-
-
Save lramosduarte/87016b4aa5c42e2714f83760502424ca to your computer and use it in GitHub Desktop.
Using Jshell like a pro(or newbie if wanna)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Extract jar files | |
```bash | |
$: jar xf JAR_FILE.jar | |
``` | |
## Check files | |
File structure containing the application's dependencies. | |
# Running | |
```bash | |
$: CLASSPATH="PATH1:PATH2" jshell | |
``` | |
Example SpringAPP: | |
```bash | |
$: CLASSPATH="target/BOOT-INF/classes/:target/BOOT-INF/lib/*" jshell | |
``` | |
**The classpath is required** | |
## Start app contenxt | |
After start `jshell` with jar context, then start `main method` and you will have access to all beans | |
```bash | |
jshell> import path.to.main.class | |
jshell> var app = MainClass.main(new String() {}) | |
jshell> var repository = app.getBean(BeanRepository.class) | |
``` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment