*
The moose likes Ant, Maven and Other Build Tools and the fly likes Ant script execution fails Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "Ant script execution fails" Watch "Ant script execution fails" New topic
Author

Ant script execution fails

lakshminarayanan samp
Greenhorn

Joined: Feb 15, 2011
Posts: 10
Hi,

I am trying to run Ant script and getting following error at line:

<javac deprecation="on"
destdir="${prj.build}"
debug="${prj.debug}"
debuglevel="lines,source"
classpathref="compile.classpath">
<src path="${prj.src}"/>

Unable to find a javac compiler; com.sun.tools.javac.Main is not on the classpath. Perhaps JAVA_HOME does not point to the JDK.
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

lakshminarayanan samp wrote:Perhaps JAVA_HOME does not point to the JDK.

Perhaps ? Does it ?


[My Blog]
All roads lead to JavaRanch
Nikhil Pasupukuntla
Greenhorn

Joined: Jun 04, 2009
Posts: 21
You have to set the classpath variable i.e; point the JAVA_HOME variable to the java lib directory


Nikhil Pasupukuntla
SCJP 1.5 | OCPJWCD 1.5
lakshminarayanan samp
Greenhorn

Joined: Feb 15, 2011
Posts: 10
Hi,

I have set JAVA_HOME to lib of JDK.

JAVA_HOME = C:\Program Files\Java\jdk1.6.0_19\lib

under user variables. Still does not work. I am using Windows XP.
Should I restart system?
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

JAVA_HOME should point to the directory where java is installed, not to the lib directory. Change it to C:\Program Files\Java\jdk1.6.0_19
lakshminarayanan samp
Greenhorn

Joined: Feb 15, 2011
Posts: 10
I tried that also. It does not work
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

Open a new command prompt and type : set
You'll see a list of environment variables. Copy/paste the JAVA_HOME here.
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

One more thing : are you executing ant from the command line, or via an IDE ?
lakshminarayanan samp
Greenhorn

Joined: Feb 15, 2011
Posts: 10
I ran SET from command prompt

JAVA_HOME=C:\Program Files\Java\jdk1.6.0_19

and I use Eclipse to run this. And script is in File system not in Workspace.
tomorrow I am planning to make it run as Jar. SO I will not IDE.
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

Eclipse ? Check this : http://wiki.eclipse.org/FAQ_Why_can't_my_Ant_build_find_javac%3F
lakshminarayanan samp
Greenhorn

Joined: Feb 15, 2011
Posts: 10
What will I do for Jar then?

When I make my application as Jar, where will I specify tools.jar or Ant Runtime and all?
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

You shouldn't have to specify anything except the JAVA_HOME. Come back tomorrow if you have more problems But I don't understand what you mean by "tomorrow I am planning to make it run as Jar. SO I will not IDE."
lakshminarayanan samp
Greenhorn

Joined: Feb 15, 2011
Posts: 10
Ok. I created Jar now. And I have JAVA_HOME as before.

I am getting following error:

Could not load class (org.apache.tools.ant.taskdefs.optional.PropertyFile) for type propertyfile
Could not load class (org.apache.tools.ant.taskdefs.optional.clearcase.CCMkdir) for type ccmkdir
Could not load class (org.apache.tools.ant.taskdefs.optional.dotnet.ImportTypelib) for type importtypelib
Could not load class (org.apache.tools.ant.taskdefs.optional.vss.MSVSSCHECKIN) for type vsscheckin
Could not load class (org.apache.tools.ant.taskdefs.optional.perforce.P4Reopen) for type p4reopen
Could not load class (org.apache.tools.ant.taskdefs.optional.image.Image) for type image
Could not load class (org.apache.tools.ant.taskdefs.optional.dotnet.CSharp) for type csc
Could not load class (org.apache.tools.ant.taskdefs.optional.ssh.SSHExec) for type sshexec
Could not load class (org.apache.tools.ant.taskdefs.optional.ejb.WLRun) for type wlrun
Could not load class (org.apache.tools.ant.taskdefs.optional.perforce.P4Label) for type p4label
Could not load class (org.apache.tools.ant.taskdefs.optional.perforce.P4Revert) for type p4revert
Could not load class (org.apache.tools.ant.taskdefs.optional.ReplaceRegExp) for type replaceregexp
Could not load class (org.apache.tools.ant.taskdefs.optional.javacc.JJTree) for type jjtree
Could not load class (org.apache.tools.ant.taskdefs.optional.extension.JarLibDisplayTask) for type jarlib-display
Could not load class (org.apache.tools.ant.taskdefs.optional.jsp.JspC) for type jspc
Could not load class (org.apache.tools.ant.taskdefs.optional.Test) for type test
Could not load class (org.apache.tools.ant.taskdefs.optional.vss.MSVSSHISTORY) for type vsshistory
Could not load class (org.apache.tools.ant.taskdefs.optional.IContract) for type icontract
Could not load class (org.apache.tools.ant.taskdefs.optional.extension.ExtensionSet) for type extensionSet
Could not load class (org.apache.tools.ant.taskdefs.optional.perforce.P4Submit) for type p4submit
Could not load class (org.apache.tools.ant.taskdefs.optional.ccm.CCMCheckin) for type ccmcheckin
Could not load class (org.apache.tools.ant.taskdefs.optional.ssh.Scp) for type scp
Could not load class (org.apache.tools.ant.taskdefs.optional.perforce.P4Change) for type p4change
Could not load class (org.apache.tools.ant.taskdefs.optional.perforce.P4Delete) for type p4delete
Could not load class (org.apache.tools.ant.taskdefs.optional.vss.MSVSSADD) for type vssadd
Could not load class (org.apache.tools.ant.taskdefs.optional.perforce.P4Integrate) for type p4integrate
Could not load class (org.apache.tools.ant.taskdefs.optional.i18n.Translate) for type translate
Could not load class (org.apache.tools.ant.taskdefs.optional.clearcase.CCLock) for type cclock
Could not load class (org.apache.tools.ant.taskdefs.optional.unix.Chown) for type chown
Could not load class (org.apache.tools.ant.taskdefs.optional.ide.VAJLoadProjects) for type vajload
Could not load class (org.apache.tools.ant.taskdefs.optional.extension.JarLibAvailableTask) for type jarlib-available
Could not load class (org.apache.tools.ant.taskdefs.optional.net.RExecTask) for type rexec
Could not load class (org.apache.tools.ant.taskdefs.optional.dotnet.WsdlToDotnet) for type WsdlToDotnet
Could not load class (org.apache.tools.ant.taskdefs.optional.sitraka.CovMerge) for type jpcovmerge
Could not load class (org.apache.tools.ant.tasksdefs.cvslib.CvsVersion) for type cvsversion
Could not load class (org.apache.tools.ant.taskdefs.optional.ejb.EjbJar) for type ejbjar
Could not load class (org.apache.tools.ant.taskdefs.optional.starteam.StarTeamList) for type stlist
Could not load class (org.apache.tools.ant.taskdefs.optional.j2ee.ServerDeploy) for type serverdeploy
Could not load class (org.apache.tools.ant.taskdefs.optional.dotnet.Ildasm) for type ildasm
Could not load class (org.apache.tools.ant.taskdefs.optional.clearcase.CCCheckin) for type cccheckin
Could not load class (org.apache.tools.ant.taskdefs.optional.clearcase.CCUnlock) for type ccunlock
Could not load class (org.apache.tools.ant.taskdefs.optional.jsp.WLJspc) for type wljspc
Could not load class (org.apache.tools.ant.taskdefs.optional.net.TelnetTask) for type telnet
Could not load class (org.apache.tools.ant.taskdefs.optional.sos.SOSGet) for type sosget
Could not load class (org.apache.tools.ant.taskdefs.optional.perforce.P4Sync) for type p4sync
Could not load class (org.apache.tools.ant.taskdefs.optional.clearcase.CCMklabel) for type ccmklabel
Could not load class (org.apache.tools.ant.taskdefs.optional.perforce.P4Edit) for type p4edit
Could not load class (org.apache.tools.ant.taskdefs.optional.metamata.MAudit) for type maudit
Could not load class (org.apache.tools.ant.taskdefs.optional.ANTLR) for type antlr
Could not load class (org.apache.tools.ant.taskdefs.optional.NetRexxC) for type netrexxc
Could not load class (org.apache.tools.ant.taskdefs.optional.net.FTP) for type ftp
Could not load class (org.apache.tools.ant.taskdefs.optional.sitraka.CovReport) for type jpcovreport
Could not load class (org.apache.tools.ant.taskdefs.optional.ccm.CCMCheckout) for type ccmcheckout
Could not load class (org.apache.tools.ant.taskdefs.optional.XMLValidateTask) for type xmlvalidate
Could not load class (org.apache.tools.ant.taskdefs.optional.perforce.P4Resolve) for type p4resolve
Could not load class (org.apache.tools.ant.taskdefs.optional.ejb.IPlanetEjbcTask) for type iplanet-ejbc
Could not load class (org.apache.tools.ant.taskdefs.optional.ccm.CCMCheckinDefault) for type ccmcheckintask
Could not load class (org.apache.tools.ant.taskdefs.optional.Native2Ascii) for type native2ascii
Could not load class (org.apache.tools.ant.taskdefs.optional.clearcase.CCRmtype) for type ccrmtype
Could not load class (org.apache.tools.ant.taskdefs.optional.scm.AntStarTeamCheckOut) for type starteam
Could not load class (org.apache.tools.ant.types.optional.ScriptFilter) for type scriptfilter
Could not load class (org.apache.tools.ant.taskdefs.optional.vss.MSVSSCHECKOUT) for type vsscheckout
Could not load class (org.apache.tools.ant.taskdefs.optional.StyleBook) for type stylebook
Could not load class (org.apache.tools.ant.taskdefs.optional.sos.SOSCheckin) for type soscheckin
Could not load class (org.apache.tools.ant.taskdefs.optional.net.MimeMail) for type mimemail
Could not load class (org.apache.tools.ant.taskdefs.optional.starteam.StarTeamLabel) for type stlabel
Could not load class (org.apache.tools.ant.taskdefs.optional.Cab) for type cab
Could not load class (org.apache.tools.ant.taskdefs.optional.splash.SplashTask) for type splash
Could not load class (org.apache.tools.ant.taskdefs.optional.clearcase.CCMkbl) for type ccmkbl
Could not load class (org.apache.tools.ant.taskdefs.optional.clearcase.CCCheckout) for type cccheckout
Could not load class (org.apache.tools.ant.types.optional.depend.ClassfileSet) for type classfileset
Could not load class (org.apache.tools.ant.taskdefs.optional.perforce.P4Have) for type p4have
Could not load class (org.apache.tools.ant.taskdefs.optional.jdepend.JDependTask) for type jdepend
Could not load class (org.apache.tools.ant.taskdefs.optional.dotnet.JSharp) for type jsharpc
Could not load class (org.apache.tools.ant.taskdefs.optional.unix.Symlink) for type symlink
Could not load class (org.apache.tools.ant.taskdefs.optional.Script) for type script
Could not load class (org.apache.tools.ant.taskdefs.optional.extension.LibFileSet) for type libfileset
Could not load class (org.apache.tools.ant.taskdefs.optional.ccm.CCMCreateTask) for type ccmcreatetask
Could not load class (org.apache.tools.ant.taskdefs.optional.extension.ExtensionAdapter) for type extension
Could not load class (org.apache.tools.ant.taskdefs.optional.Rpm) for type rpm
Could not load class (org.apache.tools.ant.taskdefs.optional.windows.Attrib) for type attrib
Could not load class (org.apache.tools.ant.taskdefs.optional.metamata.MMetrics) for type mmetrics
Could not load class (org.apache.tools.ant.taskdefs.optional.EchoProperties) for type echoproperties
Could not load class (org.apache.tools.ant.taskdefs.optional.starteam.StarTeamCheckin) for type stcheckin
Could not load class (org.apache.tools.ant.taskdefs.optional.junit.JUnitTask) for type junit
Could not load class (org.apache.tools.ant.taskdefs.optional.ide.VAJExport) for type vajexport
Could not load class (org.apache.tools.ant.taskdefs.optional.unix.Chgrp) for type chgrp
Could not load class (org.apache.tools.ant.taskdefs.optional.starteam.StarTeamCheckout) for type stcheckout
Could not load class (org.apache.tools.ant.taskdefs.optional.perforce.P4Labelsync) for type p4labelsync
Could not load class (org.apache.tools.ant.taskdefs.optional.vss.MSVSSCREATE) for type vsscreate
Could not load class (org.apache.tools.ant.taskdefs.optional.ejb.Ejbc) for type ejbc
Could not load class (org.apache.tools.ant.taskdefs.optional.dotnet.VisualBasicCompile) for type vbc
Could not load class (org.apache.tools.ant.taskdefs.optional.dotnet.WsdlToDotnet) for type wsdltodotnet
Could not load class (org.apache.tools.ant.taskdefs.optional.junit.XMLResultAggregator) for type junitreport
Could not load class (org.apache.tools.ant.taskdefs.optional.clearcase.CCMkattr) for type ccmkattr
Could not load class (org.apache.tools.ant.taskdefs.optional.clearcase.CCUpdate) for type ccupdate
Could not load class (org.apache.tools.ant.taskdefs.optional.vss.MSVSSLABEL) for type vsslabel
Could not load class (org.apache.tools.ant.taskdefs.optional.RenameExtensions) for type renameext
Could not load class (org.apache.tools.ant.taskdefs.optional.vss.MSVSSCP) for type vsscp
Could not load class (org.apache.tools.ant.taskdefs.optional.ide.VAJImport) for type vajimport
Could not load class (org.apache.tools.ant.taskdefs.optional.perforce.P4Fstat) for type p4fstat
Could not load class (org.apache.tools.ant.taskdefs.optional.net.SetProxy) for type setproxy
Could not load class (org.apache.tools.ant.taskdefs.optional.perforce.P4Counter) for type p4counter
Could not load class (org.apache.tools.ant.taskdefs.optional.ejb.WLStop) for type wlstop
Could not load class (org.apache.tools.ant.taskdefs.optional.dotnet.Ilasm) for type ilasm
Could not load class (org.apache.tools.ant.taskdefs.optional.sos.SOSCheckout) for type soscheckout
Could not load class (org.apache.tools.ant.taskdefs.optional.clearcase.CCUnCheckout) for type ccuncheckout
Could not load class (org.apache.tools.ant.taskdefs.optional.extension.JarLibResolveTask) for type jarlib-resolve
Could not load class (org.apache.tools.ant.taskdefs.optional.jlink.JlinkTask) for type jlink
Could not load class (org.apache.tools.ant.taskdefs.optional.javacc.JavaCC) for type javacc
Could not load class (org.apache.tools.ant.taskdefs.optional.pvcs.Pvcs) for type pvcs
Could not load class (org.apache.tools.ant.taskdefs.optional.extension.JarLibManifestTask) for type jarlib-manifest
Could not load class (org.apache.tools.ant.taskdefs.optional.clearcase.CCMklbtype) for type ccmklbtype
Could not load class (org.apache.tools.ant.taskdefs.optional.sound.SoundTask) for type sound
Could not load class (org.apache.tools.ant.taskdefs.optional.script.ScriptDef) for type scriptdef
Could not load class (org.apache.tools.ant.taskdefs.optional.metamata.MParse) for type mparse
Could not load class (org.apache.tools.ant.taskdefs.optional.ejb.BorlandGenerateClient) for type blgenclient
Could not load class (org.apache.tools.ant.taskdefs.optional.javacc.JJDoc) for type jjdoc
Could not load class (org.apache.tools.ant.taskdefs.optional.Javah) for type javah
Could not load class (org.apache.tools.ant.taskdefs.optional.clearcase.CCMkelem) for type ccmkelem
Could not load class (org.apache.tools.ant.taskdefs.optional.ccm.CCMReconfigure) for type ccmreconfigure
Could not load class (org.apache.tools.ant.taskdefs.optional.perforce.P4Add) for type p4add
Could not load class (org.apache.tools.ant.taskdefs.optional.sitraka.Coverage) for type jpcoverage
Could not load class (org.apache.tools.ant.taskdefs.optional.sos.SOSLabel) for type soslabel
Could not load class (org.apache.tools.ant.taskdefs.optional.depend.Depend) for type depend
Could not load class (org.apache.tools.ant.taskdefs.optional.vss.MSVSSGET) for type vssget
Could not load class (org.apache.tools.ant.taskdefs.optional.ejb.DDCreator) for type ddcreator
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

1. You have created a jar ? A jar of what ? What does it contain ?
2. What did you do do get all these errors ? Where do they come from ?
lakshminarayanan samp
Greenhorn

Joined: Feb 15, 2011
Posts: 10
My appliation is jare-ed now.
what it does is - 1. get CVS user name / password and folder where the checked out code should be placed....
2. then run Ant script to check out code from CVS repository using parameters got from user
3. after the project is checked out, run 2 more ant script from the checked out code.

Here is the snippet of ant script which throws error:

<path id="compile.classpath">
<fileset dir="${release-base}/webapp/WEB-INF/lib">
<include name="**/*.jar"/>
</fileset>
<fileset dir="${prj.lib}">
<include name="**/*.jar"/>
</fileset>
</path>

I am logging all the events of the application run - so I saw error mentioned in previous post from that file. As per my knowledge, the properties like release-base and prj.lib are set properly.

I guess te error is from compile.classpath

Any clues?
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

You probably have some libraries missing from your classpath, but
2. then run Ant script

How do you run it ?
lakshminarayanan samp
Greenhorn

Joined: Feb 15, 2011
Posts: 10
to run Ant script that checks out cvs repo, I use
org.apache.tools.ant.Project;
org.apache.tools.ant.ProjectHelper;

classes.

Please note that the errors I mentioned - come when I run application from Eclipse also. Just that I am able to see JAVA_HOME error in console but when I run as Jar, I dont see it anywhere since I dont log it properly.
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

So you're using Ant's API ? Then you'll need to put ant's libraries like ant-nodeps.jar (at least the one you are using) in your classpath when execution your application.
lakshminarayanan samp
Greenhorn

Joined: Feb 15, 2011
Posts: 10
Yes. I have ant.jar and ant-launcher.jar in classpath.

I confused you.

the first ant script works fine.

the error is caused on 2nd ant script which is present inside the checked out code.
and the ant snippet that i posted is from 2nd ant script.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Ant script execution fails
 
Similar Threads
Get the remaining part of a line of text in BASH Shell
Not getting Line Numbers while logging with Log4j
OracleTypes error while Migrating app in Java 6 with Weblogic 10.3.4 server
GANT and GRAILS
OutOfMemory Exception while building using eclipse compiler