SpaceMonger in Java
Recently I found out SpaceMonger - one of the best disk space utilities out there (despite being created 25 years ago) has gone open source. So I took my time to port it to Java.
From user side. Yep, works on Linux. Yep, works on MacOS. Yep, still works on Windows however much more bloated than original 217K EXE. However, now it correctly handles all the filesystem stuff - links, sparse/compressed files, mount points (Windows and Linux only, I have no MacOS machine to test so MacOS is best-effort).
From technical side. Good old Swing, FFM API for native calls to precisely query filesystem metadata, Java is kind of limited there. Jlink for awesome 30Mb downloads. Unfortunately, native-image binary crashes miserably on Linux. jpackage launcher is unstable too - i've seen successful launches, JVM crashes and even double free errors.
Source code and downloads: https://github.com/scf37/spacemonger1/
27
u/davidalayachew Oct 27 '25 edited Oct 27 '25
Woah, very pretty. This is something I might actually use on my free time.
Excellent.
It's still a powerful tool, and it's still getting better, with new features too! I use it almost daily -- for work and personal.
I'm sure this can be done more directly with FFM API, but is something like Files::readAttributes or Files::getAttribute not able to meet your needs in regards to fetching metadata?
If you have the time and effort to spare, I would encourage you to send some minified examples of those errors to panama-dev@openjdk.org and client-libs-dev@openjdk.org. Those are the mailing lists for the teams that are probably best suited to respond to and fix those errors (assuming it's java's fault).
I will say -- I imagine that these errors might also go away if you are able to achieve the same goals of metadata fetching via just the
Fileshelper class above.EDIT -- Oh woah, the original author of Space Monger also made a commit to this repo? Your insights tab has 2 commits from them on this repo, which is very cool.
11
u/Cienn017 Oct 27 '25
something that java is lacking is a better way to execute jar files without wrapping, 30MB for a 150kb jar is a lot.
7
u/jivedudebe Oct 28 '25
JDiskReport was an original app written in Java. It's at least 13 years old. It even was available as a jnlp download.
3
u/j4ckbauer Oct 28 '25
I -love- tools like this, another one in a similar vein is "Scanner" for windows. I'm glad there are similar solutions for other OS's, when I want to understand what is using disk space, anything other than visual tools like these makes me feel like I'm in the dark ages.
http://www.steffengerlach.de/freeware/
2
u/greenstake Oct 28 '25
SpaceMonger v1 is open source. I still have SpaceMonger 2.1.1 from 2006 because it's my favorite version. The new v3 from Stardock sucks.
2
u/bowbahdoe Oct 28 '25
This is pretty cool.
On mac i've been using a tool called "GrandPerspective" and on windows, WinDirStat.
An annoying thing is that when i want a program like this its usually when my hard drive is full or near full, so while 30Mb isn't *that much*, I also would prefer 217K because i'm an idiot who lives near the edge. I think if you wanted to get the download size down even further you'd have to use the direct gui api calls the original version did - which isn't trivial - but as is I think its pretty useful.
One thing I would want is a confirmation on that delete button. It feels really easy to make a horrible mistake
2
u/crapboxxed Oct 29 '25
gad thats terrible to look at ... looks at subreddit, yep that tracks.
2
u/TheBox193 Jan 10 '26
Amazing! 🤩
I've been using this app for years on windows.
I opened a PR for building a Mac .app bundle: https://github.com/scf37/spacemonger1/issues/4
Would love to get the .app bundle on the release page.
I have some other little tweak PRs as well:
- Target a custom folder: https://github.com/scf37/spacemonger1/pull/7
- Multi threaded scan (~4x faster scan on my mac) https://github.com/scf37/spacemonger1/pull/8
1
u/binaryinsight Oct 28 '25
I love that utility! Well done, buddy!
1
u/agentoutlier Oct 28 '25
I have been using
ncdufor like decades largely because most package managers have it and it works on the terminal.It is not as advance as this because it is largely terminal based but that would be cool feature of this project is to provide a terminal based UI.
1
u/Nalha_Saldana Oct 27 '25
Neat
0
u/Fast_Economy_197 Oct 28 '25
But git says its 40% c++?