javap command not working with %JAVA_HOME% being set

336 Views Asked by At

Im deep diving into the JVM architecture and I wanted to inspect the constant pool for one of my java classes which belongs to a Spring Boot project.

I have my compiled java class and I am trying to run:

javap -v name.class

on my class.
This command is based on the following tutorial:
https://www.baeldung.com/jvm-constant-pool

However Im getting the following error:

javap : The term 'javap' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

In my environment variables I have a variable JAVA_HOME and its set to C:\Program Files\Java\jdk-19

In path, I then add %JAVA_HOME%\bin

So does anyone know how to get it to work from anywhere without the need to run the command from inside the jdk/bin folder?

Much obliged

So far I have tried to verify that java --version and javac --version produce the same result:

java 19.0.1 2022-10-18

Java(TM) SE Runtime Environment (build 19.0.1+10-21)

Java HotSpot(TM) 64-Bit Server VM (build 19.0.1+10-21, mixed mode, sharing)

and

javac 19.0.1

I also tried running the command directly from the jdk/bin folder, where it actually works.
I have reviewed the following posts already and as mentioned, I have set up my stuff correctly(at least according to those instructions).

Javac Command Not Working
JDK installed but no javap?

0

There are 0 best solutions below