Im having trouble making a class available to my project, in both ant and eclipse.
I'm using eclipse juno+wpt, and ant 1.7.
I'm integrating a payment plataform from a credit card company called CrediCard in Venezuela to an already working site.
We received a .zip package which contains the following:
Im using debian to develop since, to compile and run the project we were intsructed by the bank that we need a dependency called:
libc6.1-1.so.2
Needed for the project to run, which i dont really understand. Also because the production OS its also un debian.
The package has a source example called ejemplodigest.java, with the instructions to compile it like this:
javac -classpath /home/DigestJavaLinux/classes ejemplodigest.java
And to run it like this:
java -Djava.library.path=/home/DigestJavaLinux/lib/ -classpath /home/DigestJavaLinux/:/home/DigestJavaLinux/classes ejemplodigest
These commands run perfectly on the command line. To run it the dependency libc6.1-1.so.2 must be installed in debian.
How ever im not able to even compile the code with ant, when i include the corresponding lines in my project and add the classpath to the ant's javac task. I get the error
symbol : class OasisEMSecIm
[javac] location: class com.bamboo.catW3.business.impl.MainHtmlController
[javac] OasisEMSecIm digest= new OasisEMSecImp();
In the declaration of the class, and the imports:
import OasisEM.*;
import eMerchantServlet.*;
are not found:
OasisEM does not exist.
This is the example source given:
//import OasisEM.*;
import java.*;
// import eMerchantServlet.*;
class ejemplodigest {
public static void main(String args[]) {
String varMerchant = "00260364"; // Merchant ID
String varStore = "0"; // Store ID
String varTerm = "4001"; // Term ID
String varTotal = "12345445"; // Monto de Transaccion
String varCurrency = "937"; // Codigo de Moneda
String varOrder_id = "444444"; // Order Id
String varDigest; // Valor de Digest
OasisEMSecImp digest= new OasisEMSecImp();
varDigest = digest.getDigest(varTotal,varOrder_id,varMerchant,varStore,varTerm,varCurrency);
System.out.println ("Merchant ID :" + varMerchant);
System.out.println ("Store ID :" + varStore);
System.out.println ("Term ID :" + varTerm);
System.out.println ("Total :" + varTotal);
System.out.println ("Currency :" + varCurrency);
System.out.println ("Order ID :" + varOrder_id);
System.out.println ("Digest " + varDigest);
}
}
I'm not able to make Eclipse recognise them either, i have tried adding the class folder to the Eclipse, making the class a jar and adding it.
I checked and the paths are correctly received by the ant task, with all the others dependencies which work fine.
ANT Question: Why does the example source compiles with the command line, but when adding the same lines to a method in my project and adding the classpath to the class folder it does not compile ?
Eclipse Question: How can i make Eclipse recognise the class OasisEMSecImp ?
UPDATE
Hello, the ant file is a little long, how ever i'll paste what i think is the relevant part:
<path id="library.digest.classpath">
<pathelement location="../../digest/classes"/>
</path>
<path id="catw.module.classpath">
<path refid="library.blazeds.classpath"/>
<path refid="library.hibernate3.classpath"/>
<path refid="library.jta.classpath"/>
<path refid="library.log4j.classpath"/>
<path refid="library.mail.classpath"/>
<path refid="library.oreilly.classpath"/>
<path refid="library.spring-2.0.7.classpath"/>
<path refid="library.velocity.classpath"/>
<path refid="library.jexcel.classpath"/>
<path refid="library.tomcat_5.classpath"/>
<path refid="library.digest.classpath" />
<pathelement location="../catw-common/build/catw-common.jar"/>
</path>
<javac destdir="${catw.output.dir}" debug="${compiler.debug}" nowarn="${compiler.generate.no.warnings}" memorymaximumsize="${compiler.max.memory}" fork="true">
<compilerarg line="${compiler.args.catw}"/>
<bootclasspath refid="catw.module.bootclasspath"/>
<classpath refid="catw.module.classpath"/>
<src refid="catw.module.sourcepath"/>
<patternset refid="excluded.from.compilation.catw"/>
</javac>
I debugged the catw.module.classpath and the location is correct.
Thank you very much in advance.
I have understood the problem and found a work around for my situation, i explain it in my answer in this question.
Hope it helps someone.
I think you didn't set your path in ant correctly. You use relative path in your path element. So please make sure your basedir of the project is set correctly. You may also need to set the verbose to true for some helpful hints.