This week's book giveaway is in the OCMJEA forum. We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line! See this thread for details.
Hi, In Eclipse, I have a web project that I can compile and run without problem. I have developped a second project where i have included my libruraries and I want to call them from my first project.
In the build path of the caller project I have included my libruary project, Also in the project references of the caller project I have added my librurary project.
inside the caller project, Eclipse can see my libruary package, but when i try to compile with ANT i got the following erropr message :
"Package xxxxxxx does not exist" "import xxxx " error
Well, it's very simple & currently in many projects this approach is being followed.
what is to be done
Lets say we have 2 projs named proj1 & proj2 and proj2 is depending on proj1, As proj1 is the base proj, it needs to be built first and then need to converted to a jar file (proj1.jar) and which has to be included in the build path of proj2.
How to achieve
This can be achieved with build tools e.g ant, maven etc..
My suggestion is to start with ant tool because you will not require any repository for this.
Refer apache -ant web site for ant tasks and samples.
Joined: Jun 28, 2011
Thank you for the hint. Now OI am facing another obstacle,
My project P1, Contain a methods that uses packages from external jars that I have added to the class path. when I run my application from Eclipse as "Java Application" the application runs successfully. but when I try to build a Jar, the compilation fails because ANT is trying to compile the external packages I have included in my application, and since there is no source code for them it fails.
Your help is very appreciated
Joined: Jun 30, 2011
Yes. it fails because ANT does not have the jars in classpath, for that you need to define a PATH entry and give the reference while compiling JAVA classes.
Define path in build.xml <path id="someId">
<fileset dir="path of your lib folder">
<include name="*.jar"/> //to include all the files having .jar extension
Use this path while compiling
<javac srcdir="the src directory" destdir="destination where you want the .class files" classpathref="someId"/> //the Id of the path defined above