无法从蚂蚁编译,但是从命令行工作,为什么? [英] Unable to compile from ant but works from the command line, why?
问题描述
我正在使用eclipse juno + wpt ,和 ant 1.7 。
我将委内瑞拉名为CrediCard的信用卡公司的付款方式整合到已经工作的网站。 / p>
我们收到了一个.zip包,其中包含以下内容:
我使用debian开发自己编译和运行项目被银行扣押,我们需要一个依赖关系:
libc6.1-1.so.2
需要项目运行,我不太明白。
也是因为生产操作系统也是un debian。
该包有一个名为ejemplodigest.java的源代码示例,其编译方式如下: / p>
javac -classpath / home / DigestJavaLinux / classes ejemplodigest.java
并运行如下:
java -Djava.library .path = / home / DigestJavaLinux / lib / -classpath / home / DigestJavaLinux /:/ home / DigestJavaLinux / classes ejemplodigest
这些命令在命令行上运行完美。要运行它,依赖关系 libc6.1-1.so.2 必须安装在debian中。
当我在项目中包含相应的行,并将类路径添加到ant的javac任务中时,我甚至无法使用ant编译代码。我得到错误
符号:class OasisEMSecIm
[javac] location:class com.bamboo.catW3.business。 impl.MainHtmlController
[javac] OasisEMSecIm digest = new OasisEMSecImp();
在课程的声明和导入中:
import OasisEM。*;
import eMerchantServlet。*;
未找到:
OasisEM不存在。
这是给出的示例源:
// 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);
}
}
我无法做Eclipse也认识它们,我已经尝试将类文件夹添加到Eclipse中,使该类成为jar并添加它。
我检查了路径是否正确接收蚂蚁任务,所有其他的依赖关系都可以正常工作。
ANT问题:为什么示例源用命令行编译,但是当向方法添加相同的行时在我的项目中,将类路径添加到不编译的类文件夹中。
Eclipse问题:我如何使Eclipse识别OasisEMSecImp类?
更新
你好,蚂蚁文件有点长,我会粘贴什么认为是相关的部分:
< 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>
< compilearg 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>
我调试了catw.module.classpath,位置正确。
提前非常感谢你。
我已经了解了这个问题,发现了一个工作对于我的情况,我在我的在这个问题中回答。
希望它帮助某人。
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.
这篇关于无法从蚂蚁编译,但是从命令行工作,为什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!