Skip to content

Commit

Permalink
Read class version from byte code / .class 👉 https://youtube.com/shor…
Browse files Browse the repository at this point in the history
  • Loading branch information
AdamBien committed Nov 15, 2024
1 parent c209cd8 commit c0c98dc
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
import java.nio.file.Files;
import java.nio.file.Path;

interface App {
interface S131_ReadClassVersion {

static void main(String... args) throws IOException {
var classPath = Path.of("App.class");
var classPath = Path.of("S131_ReadClassVersion.class");
var version = Files.readAllBytes(classPath)[7];
System.out.println(version);

Expand Down

0 comments on commit c0c98dc

Please sign in to comment.