1. make a Maven JSF Portlet project with java code in Lifeay IDE
2. drag it to liferay bundle in liferay IDE
3. you will find your java files are not package into .class file in the war , so the function u write will not work.
But when u run mvn clean package in console, and copy the war file to liferay deploy folder, it will works well. And your .class files are included in the war.