I need to create UML class diagram online and to generate Java code from it.
Drawing tools such as cacoo don\'t allow to generate code as they are not real UML model
There is one generator that allows you to produce Java source code from a UML model. This module uses the standard UML2 metamodel provided by Eclipse Foundation and as such is compatible with any UML tools using this standard like the UML Designer. It's based on the award winning code generation project, Acceleo.
You can refer this: http://marketplace.eclipse.org/content/uml-java-generator#.UeexrtJqkfA