Post #898253
2026-03-31 07:17 UTC
Came up with this little “trick” to play around interactively with packages and APIs in jshell (Java's interactive shell) when developing a Maven-based project:
# Gather dependency classpath
mvn dependency:build-classpath -Dmdep.outputfile=deps.cp.txt
# run interactive shell
CLASSPATH=$(cat deps.cp.txt) jshell
Now classes can be imported inside the interactive shell from any libraries used in your project. So that you could experiment with things iteratively.
#java #Maven #jshell #coding
Replies (1)
-
@mlundblad@fosstodon.org 2026-03-31 07:22
I was a bit inspired by trying to come up with something similar to how I would sometimes run gjs interactively to play around with JS and GObject/GTK/etc. API when developing Maps, but for when in a Java/Maven project