Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / September 2007

Tip: Looking for answers? Try searching our database.

Building a jar with Ant

Thread view: 
jaja - 16 Sep 2007 14:27 GMT
Hi there,
I am trying to build my jar using the Ant facility.
I wrote build.xml and build.properties files and executed build.cmd
file.

I got the following error:

"complie:
    [echo] Compiling java files
    [echo]
    [javac] Compiling 38 source files to C:\Dev_Env\...\build\output

BUILD FAILED
C:\Dev_Env\...\build\build.xml:98: The following error occurred while
executing this line:
C:\Dev_Env\...\build\build.xml:54: 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"

My current JAVA_HOME is set to C:\j2sdk which do exists.
My current ANT_HOME is set to c:\ant

This is the compilation segment in build.xml:
----------------------------------
    <target name="complie" depends="init">
        <echo message="Compiling java files">
        </echo>
(line 54)        <javac srcdir="${java_src}" destdir="${dest}" source="1.4">
            <classpath>
                <fileset dir="${dest}/lib">
                    <include name="**/*.jar"/>
                </fileset>
            </classpath>
        </javac>
    </target>
------------------------------------

It seems to me that for some reason it takes a wrong jdk path but I
can't understand why and from where.

Any help will be appreciated.
Thanks!
jaja - 16 Sep 2007 14:46 GMT
> Hi there,
>  I am trying to build my jar using the Ant facility.
[quoted text clipped - 38 lines]
> Any help will be appreciated.
> Thanks!

By the way, I just saw that even in the ant.bat file it is set
JAVA_HOME=C:\j2sdk which seems to be ok to my knowledge...
jaja - 16 Sep 2007 15:03 GMT
> > Hi there,
> >  I am trying to build my jar using the Ant facility.
[quoted text clipped - 43 lines]
>
> -               -

Ok, I found at least a workaround:
I copied the file tools.jar from c:\j2sdk\lib to the ant lib directory
and build was successful.
Roedy Green - 17 Sep 2007 03:59 GMT
>My current JAVA_HOME is set to C:\j2sdk which do exists.

That sounds like a pretty old Java.  Try using the current version.

JAVA_HOME=E:\program files\java\jdk1.6.0_02

Signature

Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.