Ubuntu Technical

Ubuntu technical problems and solutions reference, a modern cookbook.

Tag Archives: java

Using bash to count number of lines of code in a project

As the title suggests, here are 2 ways of counting the lines of code you just wrote, in whatever language. My examples will look into .java files.

To make the result include commented line, in other words, every line in the files.

cd {project location}
find . -type f -name '*.java' -exec cat {} \; | sed '/^\s*$/d' | wc -l

The second command excludes commented out lines. It only counts code, pure code.

cd {project location}
find . -type f -name '*.java' -exec cat {} \; | sed '/^\s*#/d;/^\s*$/d;/^\s*\/\//d' | wc -l

Cheers



Flattr this

Advertisements

Gtk-WARNING **: Unable to locate theme engine in module_path: “pixmap”

People seem to encounter the error:

Gtk-WARNING **: Unable to locate theme engine in module_path: "pixmap"

in different situations. For me it appeared while running my open source project in Eclipse, a project that is based on swing.

The solution was installing gtk2-engines-pixbuf:

sudo apt-get install gtk2-engines-pixbuf



Flattr this

%d bloggers like this: