I usually use minted to display highlighted source code. But it seems as if minted would not support Java bytecode (see list of supported languages).

How can I insert highlighted java bytecode?

(Is there perhaps another "language" that has a similar instruction set? Does listings have an option for bytecode? Has somebody manually created a highlighting file for minted/listings?)

  • 1
    Creating a style using listings is easier than writing a new lexer for pygments. It is a matter of adding the appropriate keywords on different lists: \keywords=[1]{iconst,iload,iconst}, \keywords[2]={goto,return}, etc... Each keyword type can be highlighted differently using keywordstyle=[1]{\color{blue}} and so on.
    – guillem
    Nov 9, 2012 at 7:09
  • I know this question is old, but if it still stand, could you specify the type of syntax highlighting you're trying to achieve?
    – jub0bs
    Jan 17, 2014 at 17:41

2 Answers 2


Since, AFAICS, no one has done this already, you need to write a JVM lexer for Pygments. That involves some not quite trivial Python programming: see the official instructions for several approaches to constructing a lexer, but you will likely find that the RegexLexer suffices for your needs.


It has been possible to highlight JVM bytecode since v1.3 of listings using the language name of JVMIS (Java Virtual Machine Instruction Set, I believe). It's actually mentioned on that page you linked in the OP.

  • Are you certain that this was true when this question was asked? Your answer strongly suggests that the OP has simply not bothered to read the information on the linked page. If that's the case, fair enough. But, if the support you mention is actually newer than the question, then might I recommend a slightly less scathing tone?
    – cfr
    Jan 3, 2015 at 3:31
  • @cfr I re-read my answer and I honestly don't think it qualifies as "scathing." It was intended to be a casual tone, if anything. JVMIS is not a very intuitive keyword when one wants to highlight JVM bytecode, so I established the link for OP. This has been supported since v1.3c (05/2006): take a look at page 2. Having come across this question earlier today, before I found my answer, I thought I would come back and post it for future readers of this question.
    – kstev
    Jan 3, 2015 at 7:10
  • 1
    In that case, it certainly pre-dates the question!
    – cfr
    Jan 3, 2015 at 13:37
  • The mentioned page tells that listings package can display JVMIS, but OP asked about minted package. Both are mentioned there, but I wouldn't call them drop-in replacements for one another. Jun 18, 2020 at 9:22

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .