Hi,
I was going through Si Chen's tutorials and working on the hello3 app. As part of that, I am required to write a java program but it seems to compile it you have to use ant and build.xml (new to java, so these concepts are new to me as well). The tutorial says build.xml can usually be copied over from the other ofbiz apps but a cross examination of the different build.xml files revealed some differences to me. So, what changes do I have to make to make it work for my app or I can, as the tut says, just copy it into my app folder? Kindly help |
Hi,
Copy the build.xml to your application. Then put project name as your project name component, and also change the <target name="init"> Property value to your project name.It will build the jar file in that name. <project name="demoPurpose Component" default="jar" basedir="."> <target name="init"> <property environment="env"/> <property name="desc" value="demoPurpose Component"/> <property name="name" value="demoPurpose"/> <property name="ofbiz.home.dir" value="../.."/> <property name="src.dir" value="src"/> <property name="dtd.dir" value="dtd"/> <property name="lib.dir" value="lib"/> <property name="build.dir" value="build"/> </target> -----Original Message----- From: jaki [mailto:[hidden email]] Sent: Friday, May 23, 2008 10:50 AM To: [hidden email] Subject: compiling java files Hi, I was going through Si Chen's tutorials and working on the hello3 app. As part of that, I am required to write a java program but it seems to compile it you have to use ant and build.xml (new to java, so these concepts are new to me as well). The tutorial says build.xml can usually be copied over from the other ofbiz apps but a cross examination of the different build.xml files revealed some differences to me. So, what changes do I have to make to make it work for my app or I can, as the tut says, just copy it into my app folder? Kindly help -- View this message in context: http://www.nabble.com/compiling-java-files-tp17418910p17418910.html Sent from the OFBiz - User mailing list archive at Nabble.com. Thanks & Regards, Pramod Kumar Das Satyam Computer Services Ltd.| VBU-Retail S - 1,Maitree Vihar Road,Chandrasekharpur,Bhubaneshwar Orissa -751023 Phone - 0674 - 391 - 2323 Extn -2602 Mobile - 09438039476 DISCLAIMER: This email (including any attachments) is intended for the sole use of the intended recipient/s and may contain material that is CONFIDENTIAL AND PRIVATE COMPANY INFORMATION. Any review or reliance by others or copying or distribution or forwarding of any or all of the contents in this message is STRICTLY PROHIBITED. If you are not the intended recipient, please contact the sender by email and delete all copies; your cooperation in this regard is appreciated. |
In reply to this post by Jaki-2
Hello Jaky,
You can put the example component's build.xml file in your own component. build.xml files are very simple to understand. It may possible that you will get the compilation error. This kind of error can be solved by including the JAR files in your "classpath" definition in build.xml file. Suppose you are getting following kind of errors : classes: [javac] Compiling 1 source file to /home/ashish/ofbiz_dev/other/hot-deploy/practice/build/classes [javac] /home/ashish/ofbiz_dev/other/hot-deploy/practice/src/org/ofbiz/practice/PracticeEvents.java:4: package javax.servlet.http does not exist [javac] import javax.servlet.http.HttpServletRequest; [javac] ^ [javac] /home/ashish/ofbiz_dev/other/hot-deploy/practice/src/org/ofbiz/practice/PracticeEvents.java:5: package javax.servlet.http does not exist [javac] import javax.servlet.http.HttpServletResponse; [javac] ^ This kind of error is nothing but the Java file is unable to to find the package. This kind of error can be solved by putting the "j2eespecs" folder in the classpath target. See the below contents :- <target name="classpath"> <path id="local.class.path"> <fileset dir="../../framework/base/lib" includes="*.jar"/> <fileset dir="../../framework/base/lib/commons" includes="*.jar"/> <fileset dir="../../framework/base/lib/j2eespecs" includes="*.jar"/> <fileset dir="../../framework/base/build/lib" includes="*.jar"/> I hope this will help you to come on right track. -- Ashish On Fri, May 23, 2008 at 1:20 AM, jaki <[hidden email]> wrote: > > Hi, > I was going through Si Chen's tutorials and working on the hello3 app. As > part of that, I am required to write a java program but it seems to compile > it you have to use ant and build.xml (new to java, so these concepts are > new > to me as well). The tutorial says build.xml can usually be copied over from > the other ofbiz apps but a cross examination of the different build.xml > files revealed some differences to me. So, what changes do I have to make > to > make it work for my app or I can, as the tut says, just copy it into my app > folder? Kindly help > -- > View this message in context: > http://www.nabble.com/compiling-java-files-tp17418910p17418910.html > Sent from the OFBiz - User mailing list archive at Nabble.com. > > |
Acc. to the tutorial, I should navigate to my component folder (hot-deploy/hello3) and run 'ant'. But doing so gives me the error 'ant is not recognized as an internal or external command'. Do I need to copy ant.bat from main ofbiz folder over to this one??
|
Don't copy ant.bat from main ofbiz folder.Just set the ANT_HOME path in
the Environment Variables. -----Original Message----- From: jaki [mailto:[hidden email]] Sent: Friday, May 23, 2008 12:16 PM To: [hidden email] Subject: Re: compiling java files Acc. to the tutorial, I should navigate to my component folder (hot-deploy/hello3) and run 'ant'. But doing so gives me the error 'ant is not recognized as an internal or external command'. Do I need to copy ant.bat from main ofbiz folder over to this one?? -- View this message in context: http://www.nabble.com/compiling-java-files-tp17418910p17419484.html Sent from the OFBiz - User mailing list archive at Nabble.com. DISCLAIMER: This email (including any attachments) is intended for the sole use of the intended recipient/s and may contain material that is CONFIDENTIAL AND PRIVATE COMPANY INFORMATION. Any review or reliance by others or copying or distribution or forwarding of any or all of the contents in this message is STRICTLY PROHIBITED. If you are not the intended recipient, please contact the sender by email and delete all copies; your cooperation in this regard is appreciated. |
Administrator
|
In reply to this post by Jaki-2
You need to have ant installed and have it on the path (I guess the installation does put ant in the path)
Jacques From: "jaki" <[hidden email]> > > Acc. to the tutorial, I should navigate to my component folder > (hot-deploy/hello3) and run 'ant'. But doing so gives me the error 'ant is > not recognized as an internal or external command'. Do I need to copy > ant.bat from main ofbiz folder over to this one?? > -- > View this message in context: http://www.nabble.com/compiling-java-files-tp17418910p17419484.html > Sent from the OFBiz - User mailing list archive at Nabble.com. > |
In reply to this post by Jaki-2
Heap of thanks you all! I installed ant, set ANT_HOME, made some classpath changes in build.xml and it finally got compiled!
|
Oh Jackie.... that's really great :-)
On Fri, May 23, 2008 at 5:48 AM, jaki <[hidden email]> wrote: > > Heap of thanks you all! I installed ant, set ANT_HOME, made some classpath > changes in build.xml and it finally got compiled! > > jaki wrote: > > > > Hi, > > I was going through Si Chen's tutorials and working on the hello3 app. As > > part of that, I am required to write a java program but it seems to > > compile it you have to use ant and build.xml (new to java, so these > > concepts are new to me as well). The tutorial says build.xml can usually > > be copied over from the other ofbiz apps but a cross examination of the > > different build.xml files revealed some differences to me. So, what > > changes do I have to make to make it work for my app or I can, as the tut > > says, just copy it into my app folder? Kindly help > > > > -- > View this message in context: > http://www.nabble.com/compiling-java-files-tp17418910p17422409.html > Sent from the OFBiz - User mailing list archive at Nabble.com. > > -- Thanks & Regards Ashish Vijaywargiya +919893479711 |
Free forum by Nabble | Edit this page |