https://github.com/atp-mipt/ljv
Lightweight Java Visualizer
https://github.com/atp-mipt/ljv
graphviz-dot java
Last synced: 11 days ago
JSON representation
Lightweight Java Visualizer
- Host: GitHub
- URL: https://github.com/atp-mipt/ljv
- Owner: atp-mipt
- License: gpl-3.0
- Created: 2020-03-23T16:51:10.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2023-04-07T11:57:33.000Z (over 2 years ago)
- Last Synced: 2025-08-20T22:57:24.021Z (about 2 months ago)
- Topics: graphviz-dot, java
- Language: SCSS
- Homepage: https://atp-mipt.github.io/ljv/
- Size: 4.88 MB
- Stars: 292
- Watchers: 6
- Forks: 14
- Open Issues: 10
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# The Lightweight Java Visualizer (LJV)
[](https://github.com/atp-mipt/ljv/actions?query=workflow%3A"build")
[](https://maven-badges.herokuapp.com/maven-central/org.atp-fivt/ljv)LJV a is tool for visualizing Java data structures, using [Graphviz](http://graphviz.gitlab.io/).
It was developed by [John Hamer](https://www.gla.ac.uk/schools/computing/staff/?webapp=staffcontact&action=person&id=4cdcebe68a94) in 2004 and released under GNU GPL (see the [original project page](https://www.cs.auckland.ac.nz/~j-hamer/LJV.html)).
This project aims to upgrade this tool to modern Java and make it an open source library in the modern sense of the word.
See [documentation](https://atp-mipt.github.io/ljv/) and [JavaDoc](https://atp-mipt.github.io/ljv/apidocs/).
## How to use
The tool requires Java 11 or later version. Pull in the LJV dependency:
```xmlorg.atp-fivt
ljv
1.04```
Execute the following (`obj` can be any object that you wish to visualize):
```java
public class Main {
public static void main(String[] args) {
browse(new LJV(), Map.of(1, 'a', 2, 'b'));
}public static void browse(LJV ljv, Object obj) {
try {
var dot = URLEncoder.encode(ljv.drawGraph(obj), "UTF8")
.replaceAll("\\+", "%20");
Desktop.getDesktop().browse(
new URI("https://dreampuf.github.io/GraphvizOnline/#"
+ dot));
} catch (Exception e) {
throw new IllegalStateException(e);
}
}
}
```A browser window will appear with a diagram that will look like this: