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

Ant JAVAC Task

vishwas bhatt
Ranch Hand

Joined: Nov 30, 2000
Posts: 129
Hi Folks,

I am using eclipse(3.0.1) and Ant(1.6.2) and JSK 1.4.2
In My Project I am using default package. Which is not supported by 1.4.

Now when I set Compliance level in Eclipse 1.3 every thing goes fine. But I want to Compile Through Ant's Javac Task.

<javac target="1.1" verbose="true" srcdir="${midlet.src}" nowarn="true" destdir="${midlet.classes}" compiler="javac1.3" source="1.3">

But it gives an error on all default Package Import.

Even I had this option too but no result.

<property name="build.compiler" value="org.eclipse.jdt.core.JDTCompilerAdapter" />


do I need to Install JDK 1.3 for doing this.

Please tell me how can I compile on java 1.3 using Ant JAVAC Task
[ May 30, 2005: Message edited by: Bear Bibeault ]
Naren Chivukula
Ranch Hand

Joined: Feb 03, 2004
Posts: 577

Hi Vishwas,

As I'm new to Ant, I can suggest you to get apache-ant-1.6.4 which is bug free. Other this is to ensure your source directory and destination directories in the target tag.

Regards,
Narendranath


Cheers,
Naren
(OCEEJBD6, SCWCD5, SCDJWS, SCJP1.4 and Oracle SQL 1Z0-051)
vishwas bhatt
Ranch Hand

Joined: Nov 30, 2000
Posts: 129
Hi Naren,

let me follow your suggestion. I am installing Ant 1.6.4 hope this will resolve this probelm.

Is there anyone who can give more input in this?


Thanks
waiting for reply
vishwas bhatt
Ranch Hand

Joined: Nov 30, 2000
Posts: 129
Hi Folks,

I have done all the updation required and suggested by Naren.
But still same error,

It is giving me error where I am using or importing default package.

Please look at this and suggest me something.

<target name="Device">
<property name="build.compiler" value="org.eclipse.jdt.core.JDTCompilerAdapter"/>
<javac includes="**/*.java, *.java" srcdir="${midlet.src}" destdir="${midlet.classes}" source="1.3" compiler="javac1.3">
<classpath>
<pathelement location="${cldc_lib}"/>
<pathelement location="${midp10_lib}"/>
<pathelement location="C:/eclipse/plugins/org.eclipse.jdt.core_3.0.2"/>
</classpath>

</javac>
</target>

Thanks
Waiting for reply.
vishwas bhatt
Ranch Hand

Joined: Nov 30, 2000
Posts: 129
Is there anyone who can reply on this?


Thanks
waiting for reply.
Rashid Darvesh
Ranch Hand

Joined: Feb 13, 2004
Posts: 189
i too have a similar problem, we had a project done in jdk1.5 and hosted on tomcat. now we want to move it to oracle application server. since oracle does not support jdk1.5, i have to use retroweaver to convert the byte code from 1.5 to 1.4. I need to know is this the best practice to do.
are there any other ways which i can use.
even though i managed to do it i have to call this conversion from ant scripts, i am really confused about how to do this.
any suggestion or help is much appreciated.
Rashid
Corey Klaasmeyer
Greenhorn

Joined: Jun 22, 2005
Posts: 1
In order to use JDTCompilerAdapter this is all correct except for the attribute compiler="javac1.3". If you look at the ant code, this invokes the sun compiler and effectively overrides your build.compiler setting. Your properties and target should look like this:

<property name="build.compiler" value="org.eclipse.jdt.core.JDTCompilerAdapter"/>

<javac includes="**/*.java, *.java" srcdir="${midlet.src}" destdir="${midlet.classes}" source="1.3"">
...
</javac>

Now, I have a question. I'm using:

<property name="build.compiler" value="org.eclipse.jdt.core.JDTCompilerAdapter"/>

<javac includes="**/*.java, *.java" srcdir="${midlet.src}" destdir="${midlet.classes}" source="1.5"">
...
</javac>

And I get this message:

"Compliance level '1.4' is incompatible with source level '1.5'. A compliance level '1.5' or better is required"

So, how do I set compliance level?

Corey
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61662
    
  67

"corey",

There aren't may rules that have been put into place here on the Ranch, but one that we take very seriously regards the use of proper names. Please take a look at the JavaRanch Naming Policy and adjust your display name to match it.

In particular, your display name must be a first and a last name separated by a space character, and must not be obviously fictitious.

Thanks!
bear
Forum Bartender


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Ant JAVAC Task