• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Ant JAVAC Task

 
vishwas bhatt
Ranch Hand
Posts: 129
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 577
Java Notepad Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
vishwas bhatt
Ranch Hand
Posts: 129
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 129
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 129
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there anyone who can reply on this?


Thanks
waiting for reply.
 
Rashid Darvesh
Ranch Hand
Posts: 189
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 65120
91
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic