# How to generate an entity class from an OPT template? **Category:** [Platform](https://discourse.openehr.org/c/platform-implem/7) **Created:** 2024-09-06 01:57 UTC **Views:** 91 **Replies:** 4 **URL:** https://discourse.openehr.org/t/how-to-generate-an-entity-class-from-an-opt-template/5665 --- ## Post #1 by @linforest How to use the generator to generate an entity class from an OPT template? ``` java -jar generator-version.jar -h show help -opt path to opt file -out path to output directory -package package name -config optional Path to config file ``` [GitHub: Usage](https://github.com/ehrbase/openEHR_SDK#usage) When trying to do this in the syntax above, I got an error message: ``` Error: Failed to initialize the Main Class org.ehrbase.openehr.sdk.generator.ClassGeneratorRunner Reason: java.lang.NoClassDefFoundError: org/apache/commons/cli/ParseException ``` Thanks. --- ## Post #2 by @vidi42 @linforest are you using the jar downloaded from maven central? Can you try building the jar from the source code? Just clone the [openEHR SDK](https://github.com/ehrbase/openEHR_SDK), do a `mvn clean install` of the project and then try with the `openEHR_SDK\generator\target\generator-2.17.0.jar`. Not sure why it's not working with the jar from maven central, or if it's supposed to work directly from there. --- ## Post #3 by @stefanspiska If you look at https://github.com/ehrbase/openEHR_SDK/blob/develop/generator/pom.xml During build it copies the dependencies to /lib and takes them from there. So you seam to be missing the java dependencies --- ## Post #4 by @linforest Yes, it's from maven central. As your suggested, I will try a locally-built copy. Thanks. --- ## Post #5 by @linforest Your guess is likely right because the ehrbsse jars are limited to client, generator and their dependencies. Thanks. --- **Canonical:** https://discourse.openehr.org/t/how-to-generate-an-entity-class-from-an-opt-template/5665 **Original content:** https://discourse.openehr.org/t/how-to-generate-an-entity-class-from-an-opt-template/5665