*
The moose likes Ant, Maven and Other Build Tools and the fly likes ant problems Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "ant problems" Watch "ant problems" New topic
Author

ant problems

John Gregory
Ranch Hand

Joined: Oct 05, 2006
Posts: 115
I'm trying to run ant on a linux (ubuntu) box. It gets compiled, but
when it goes to run, I get an error stating that it can't find my Main
class and encourages me to have my classpath set. However, it is in set
in my build script. Also, I have things properly set in my .cshrc file,
otherwise, nothing would compile. Does anyone have any ideas???

<project name="mysecondbuild" default="execute">
<path id="run.cp">
<pathelement location="build/classes"/>
</path>
<target name="init">
<mkdir dir="build/classes"/>
<mkdir dir="dist"/>
</target>
<target name="compile" depends="init">
<javac srcdir="src" destdir="build/classes"/>
</target>
<target name="archive" depends="compile">
<jar destfile="dist/project.jar" basedir="build/classes"/>
</target>
<target name="clean" depends="init">
<delete dir="build"/>
<delete dir="dist"/>
</target>
<target name="execute" depends="compile">
<java classname="mysecond.Main.class" classpathref="run.cp">
<arg value="a"/>
<arg value="b"/>
<arg file="."/>
</java>
</target>
</project>

Thanks,

John
Wirianto Djunaidi
Ranch Hand

Joined: Mar 20, 2001
Posts: 210

Try setting your java classname="mysecond.Main"
John Gregory
Ranch Hand

Joined: Oct 05, 2006
Posts: 115
Wirianto,

Yep, thanks, that did the trick!

John
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: ant problems
 
Similar Threads
Howto run specific JUnit tests in ant?
How to Jar?
Obfuscating Package Names
How to run AWT or Swing from Ant
NX: Inserting Directories Into Jar With Ant