Search code examples
javaline-numbers

How can I include line numbers in Java source code?


I'm reaching the climax of my final year programming project, which is written in Java (using the Wicket web framework). I have to provide the examiners with the source code (on CD) with each line clearly numbered. I know that in Eclipse you can number the lines of code, but obviously this will only work if the person viewing the code uses Eclipse. Is there any way to include line numbers in the source code itself? If so, how?


Solution

  • You can use cat to do this

    cat -n input.java > output.java