Not able to configure path to run java class in ANT build file

By | July 12, 2018
Questions:

I have a directory

tools > util > src > utilities > legacy > SqlGenerator.java and

build.xml on same level as tool.

I am trying to run this inside ANT file

  <property name="sql.dir" value="${basedir}/tools/util/src/utilities/legacy" />
 <java  failonerror="false" fork="true" classname="SqlGenerator.java" classpath="${sql.dir}">
  <arg value="sourcefiles"/>
  <arg value="${gen.dir}"/>
</java>

The exception I get while trying to run is

[java] Exception in thread "main" java.lang.NoClassDefFoundError: SqlGenerator            
[java] Caused by: java.lang.ClassNotFoundException: SqlGenerator        
[java]  at java.net.URLClassLoader$1.run(URLClassLoader.java:202)      
[java]  at java.security.AccessController.doPrivileged(Native Method)  
[java]  at java.net.URLClassLoader.findClass(URLClassLoader.java:190)  
[java]  at java.lang.ClassLoader.loadClass(ClassLoader.java:306)     
[java]  at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)    
[java]  at java.lang.ClassLoader.loadClass(ClassLoader.java:247)      
[java] Could not find the main class: SqlGenerator.  Program will exit.  
[java] Java Result: 1
Answers:

Leave a Reply

Your email address will not be published. Required fields are marked *