[Tex/LaTex] Insert Bash code with coloration into the latex report

code

I am writing a long report, and I need to include some code I wrote.
I would like my code to appear colorized, as can be seen in some text editors, but not by using the verbatim package.

I need to colorize two distinct languages:

  • Bash language
  • (Java language)<= Already have it, thanks!

Thank you in advance for your help.

Best Answer

Not contradicting anything in JoG's answer:

\documentclass{article}
\usepackage{xcolor}
\usepackage{listings}
\lstset{basicstyle=\ttfamily,
  showstringspaces=false,
  commentstyle=\color{red},
  keywordstyle=\color{blue}
}

\begin{document}

\begin{lstlisting}[language=Java,caption={Java version}]
public class HelloWorld {
   // Here's the main class
   public static void main(String[] args) {
       System.out.println("Hello, world!");
   }
}
\end{lstlisting}

\begin{lstlisting}[language=bash,caption={bash version}]
#!/bin/bash
echo "Hello, world!"
\end{lstlisting}

\end{document}

enter image description here