Skip to content
Advertisement

How to inspect jvm module contents from the command line?

I would like to inspect the contents of a resource file of a java module of my locally installed jvm from the command line.

Based on a question about mime type support in a jvm I would like to see the contents of /sun/net/www/content-types.properties in module java.base of my locally installed jvm.

However when scrolling through the files installed for the jvm i was unable to find a file called like java.base.*. However I see a file ./lib/modules being over 130 MB in size. I suspect that this file contains the contents of module java.base. But 7-zip is unable to open this file as an archive.

How can I see the contents of /sun/net/www/content-types.properties in module java.base of my locally installed jvm using the command line?

Advertisement

Answer

Use jimage tool to extract content-types.properties from modules:

jimage extract --dir /tmp --include regex:.*content-types.properties $JAVA_HOME/lib/modules && 
cat /tmp/java.base/sun/net/www/content-types.properties
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement