Konloch/bytecode-viewer · error · LoaderException
'${file.getAbsolutePath()}' not found.
Error message
'${file.getAbsolutePath()}' not found. What it means
DirectoryLoader.load() wraps any IOException from opening/reading the requested .class file on disk into a LoaderException whose message is the resolved absolute path plus 'not found.' It is thrown whenever FileInputStream construction or stream reading fails for the codebase+internalPath combination, whether the file truly does not exist or is unreadable (permission, directory, I/O error). The library conflates all IOExceptions into a single 'not found' message.
Source
Thrown at src/main/java/the/bytecode/club/bytecodeviewer/decompilers/jdgui/DirectoryLoader.java:60
if (!(file.exists() && file.isDirectory()))
throw new LoaderException("'" + codebase + "' is not a directory");
}
@Override
public byte[] load(String internalPath) throws LoaderException
{
if (!internalPath.endsWith(".class"))
internalPath = internalPath + ".class";
File file = new File(this.codebase, internalPath);
try (FileInputStream fis = new FileInputStream(file); BufferedInputStream bis = new BufferedInputStream(fis))
{
return IOUtils.toByteArray(bis);
}
catch (IOException e)
{
throw new LoaderException("'" + file.getAbsolutePath() + "' not found.");
}
}
@Override
public boolean canLoad(String internalPath)
{
File file = new File(this.codebase, internalPath + ".class");
return file.exists() && file.isFile();
}
}
View on GitHub (pinned to 31430e0033)
Solutions
- Verify the file exists and is readable at the exact path printed in the message before calling load(): new File(codebase, path.endsWith(".class") ? path : path + ".class").exists().
- Check package separators: internalPath must use '/' internally; the loader appends '.class' if absent, so do not pre-append '.class' twice or pass OS separators.
- Rebuild/restore the class directory or re-point the DirectoryLoader constructor at a directory that actually contains the compiled classes (constructor already validates it is a directory).
- Fix filesystem permissions (chmod/chown) if the path exists but the JVM cannot read it; note permission failures also surface as this 'not found.' message.
- Catch LoaderException per-file in your caller and skip/log the class rather than aborting the whole decompilation run.
Example fix
// before
byte[] bytes = loader.load("com/example/Missing.class");
// after
if (loader.canLoad("com/example/Missing")) {
byte[] bytes = loader.load("com/example/Missing.class");
} else {
// handle missing class: skip, log, or load from another loader
} Defensive patterns
Strategy: validation
Validate before calling
File f = new File(codebase, internalPath.endsWith(".class") ? internalPath : internalPath + ".class");
if (!f.exists() || !f.isFile()) throw new IllegalStateException("Class file missing: " + f.getAbsolutePath()); Type guard
static boolean classFileExists(String codebase, String internalPath) {
String p = internalPath.endsWith(".class") ? internalPath : internalPath + ".class";
File f = new File(codebase, p);
return f.isFile();
} Try / catch
try {
byte[] bytes = loader.load(internalPath);
} catch (org.jd.core.v1.api.loader.LoaderException e) {
logger.warn("Class not loadable: {}", e.getMessage());
// fallback: skip class or load from alternate loader
} Prevention
- Call canLoad(internalPath) before load() — it returns false without throwing.
- Always pass internal paths using '/' separators, never OS-specific separators.
- Keep the class directory intact for the whole decompilation run; avoid cleaning build output mid-run.
- Check read permissions on the codebase directory before batch processing.
- Catch LoaderException per file so one missing class does not abort the batch.
When it happens
Trigger: Calling load(internalPath) (directly or via jd.core decompilation of a directory-based codebase) where codebase/internalPath (with .class appended if missing) does not exist, is a directory, lacks read permission, or an I/O error occurs while reading.
Common situations: Passing an internal path with the wrong package separators or a stale class name after refactoring; pointing the DirectoryLoader at an output directory that was cleaned while decompilation is in flight; files filtered out by obfuscation tools; OS permission issues; symlinks broken after moving the directory.
Understand the failure class
Background: "File not found" and ENOENT errors: why libraries can't find a file that should exist — this error's family across 50 libraries.
Related errors
- Unable to resolve class-filetype.
- Unable to resolve type.
- Invalid Java .class file
- Unknown Java structure
- Invalid constant pool
AI-assisted analysis of Konloch/bytecode-viewer@31430e0033 (2026-09-05).
Data as JSON: /api/errors/e7a619ffb94337e7.
Report an issue: GitHub.