Konloch / Konloch/bytecode-viewer

No sources given error while running from command line

Open
#445 2 comments 0 reactions 1 assignee Claimed by @Konloch View on GitHub
Bug CLI Priority
Dominant language
Java
Stars
15.6k
Forks
1.3k
PR merge metrics
No merged PRs in 30d

Description

I tried to run BCV from command line to decompile some jars but kept running into `error: no sources given` message.
After getting into the source code and running it in debug mode I have noticed that this line of code
```java
JarUtils.saveAsJarClassesOnly(BytecodeViewer.getLoadedClasses(), tempZip.getAbsolutePath());
```
runs before BCV has loaded any classes as it is happens in `BytecodeViewer::openFiles()`.

After changing the code in that way I got decompilation from command line working
```java
BytecodeViewer.openFiles(new File[]{input}, false);
Thread.sleep(5 * 1000);
JarUtils.saveAsJarClassesOnly(BytecodeViewer.getLoadedClasses(), tempZip.getAbsolutePath());
```

Is this a bug or am I using CLI in some wrong way?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.