TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?)

share|improve this question
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 '12 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? – Jubobs Jan 17 '14 at 17:41

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.

share|improve this answer

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.

share|improve this answer
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 '15 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 '15 at 7:10
In that case, it certainly pre-dates the question! – cfr Jan 3 '15 at 13:37

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.