aspose file tools*
The moose likes Ant, Maven and Other Build Tools and the fly likes Javac error 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 "Javac error" Watch "Javac error" New topic
Author

Javac error

kumar hai
Greenhorn

Joined: Oct 12, 2009
Posts: 26
Hi...using java file im doing compile...javac

i incllude all java file & .classpath & jar files...my issue is my build is got success message but class file not creating in that distfolder...please tell me clear details for javac...i check google also..using that information i updated...but not class file generating for my scripts...

<javac srcdir="${src}" destdir="C:\ant\Output" classpath="${src}/commonj-sdo-2.1.0.jar">
<include name="**/*.*"/>

please any one help for this...

Siva Masilamani
Ranch Hand

Joined: Sep 19, 2008
Posts: 385
Let us see the script output.


SCJP 6,SCWCD 5,SCBCD 5

Failure is not an option.
kumar hai
Greenhorn

Joined: Oct 12, 2009
Posts: 26
means....i am not understand....help clear with this..
Misha Ver
Ranch Hand

Joined: Mar 03, 2008
Posts: 470
Kumar,

1) Check http://faq.javaranch.com/java/UseCodeTags

2) The code you have posted doesn't have enough information to answer your question. You have to post entire build.xml file, also check http://faq.javaranch.com/java/PostRealCode

3) Most likely in your build.xml, you just do no call the target which contain the code you have posted. In this case you would get "BUILD SUCCESSFUL" message from ANT, but because your code is kind of commented out - no class file will be created.
Siva Masilamani
Ranch Hand

Joined: Sep 19, 2008
Posts: 385
Let us see the script you are using and also the output you are getting when you execute the script
kumar hai
Greenhorn

Joined: Oct 12, 2009
Posts: 26
<copy flatten="true" todir="${jar.file}">
<fileset dir="${src}" includes="**/.classpath,**/gen/**,**/*.MF,**/*.jar"/>
</copy>

<copy flatten="true" todir="${java.file}">
<fileset dir="${src}" includes="**/*.java"/>
</copy>
</target>

<target name="compile">
<javac srcdir="${java.file}" destdir="${class}" classpath="${jar.file}/log4j-1.2.15.jar"/>
</target>


Hi,
please check above copy tasks...i am copy .classpath file,.jar fil & other files to on location,,,& also i am copy java file to one location...

in javac task i am compiling all java file & include jar file(this is classpath file)..& also below i mention .classpath file details..please tell me if i need to include any more file for compiling...


------------------------------------

<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="lib" path="log4j-1.2.15.jar"/>
<classpathentry excluding="gen/|gen/src/" kind="src" path=""/>
<classpathentry kind="src" path="gen/src">
<attributes>
<attribute name="optional" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/WebSphere Process Server v6.2 JRE"/>
<classpathentry kind="con" path="org.eclipse.jst.server.core.container/com.ibm.ws.ast.st.runtime.runtimeTarget.v61.bi/wps.v62"/>
<classpathentry kind="output" path=""/>
</classpath>

---------------------------------------
Siva Masilamani
Ranch Hand

Joined: Sep 19, 2008
Posts: 385
what is the output you are getting when you execute the script???

I am not sure about eclipse classpath file.

But i believe your script is not finding the source file properly...

So let me see the output when you run the script

Also why do you use flattern???i think it will erase out the directory structure of your source file.
kumar hai
Greenhorn

Joined: Oct 12, 2009
Posts: 26
im not include that .classpath file...only jar file i inlucde

<target name="compile">
<javac srcdir="${java.file}" destdir="${class}" classpath="${jar.file}/log4j-1.2.15.jar" fork="yes">
</javac>

below the output:

please help ....



Buildfile: javac.xml

copy:
[delete] Deleting directory c:\ant\java.class
[delete] Deleting directory c:\ant\jars
[mkdir] Created dir: c:\ant\jars
[mkdir] Created dir: c:\ant\java.class
[delete] Deleting directory c:\ant\class
[mkdir] Created dir: c:\ant\class
[copy] Copying 4 files to c:\ant\jars
[copy] Copied 2 empty directories to 2 empty directories under c:\ant\jars
[copy] Copying 4 files to c:\ant\java.class

compile:
[javac] Compiling 4 source files to c:\ant\class

BUILD FAILED
C:\ant\javac.xml:32: Error running javac.exe compiler

Siva Masilamani
Ranch Hand

Joined: Sep 19, 2008
Posts: 385
I believe your javac is not in the path

Type javac in your command prompt and if you are getting command not found.

Then set the PATH for the javac.


Your path should contain something like this.

PATH=c:/java/jdk1.5/bin

Do not delete the existing path.Just add the above path to it.

then type javac -version.

Then try running your script
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Please UseCodeTags when posting code or configuration. Unformatted code and configuration is very difficult to read. You can edit your post to include them by using the button.
 
jQuery in Action, 2nd edition
 
subject: Javac error