无法从 ant 编译但可以从命令行运行,为什么? [英] Unable to compile from ant but works from the command line, why?

查看:26
本文介绍了无法从 ant 编译但可以从命令行运行,为什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法在 ant 和 eclipse 中为我的项目提供一个类.

Im having trouble making a class available to my project, in both ant and eclipse.

我正在使用 Eclipse juno+wptant 1.7.

I'm using eclipse juno+wpt, and ant 1.7.

我正在将委内瑞拉一家名为 CrediCard 的信用卡公司的支付平台集成到一个已经在运行的网站上.

I'm integrating a payment plataform from a credit card company called CrediCard in Venezuela to an already working site.

我们收到了一个 .zip 包,其中包含以下内容:

We received a .zip package which contains the following:

我使用 debian 进行开发,因为为了编译和运行项目,银行要求我们需要一个名为的依赖项:

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

需要运行项目,我不太明白.也因为生产操作系统也是 un debian.

Needed for the project to run, which i dont really understand. Also because the production OS its also un debian.

该包有一个名为 ejempodigest.java 的源代码示例,其编译说明如下:

The package has a source example called ejemplodigest.java, with the instructions to compile it like this:

javac -classpath /home/DigestJavaLinux/classes ejemplodigest.java

并像这样运行它:

java -Djava.library.path=/home/DigestJavaLinux/lib/ -classpath /home/DigestJavaLinux/:/home/DigestJavaLinux/classes ejemplodigest

这些命令在命令行上运行完美.要运行它,必须在 debian 中安装依赖项 libc6.1-1.so.2.

These commands run perfectly on the command line. To run it the dependency libc6.1-1.so.2 must be installed in debian.

当我在我的项目中包含相应的行并将类路径添加到 ant 的 javac 任务时,我什至无法用 ant 编译代码.我收到错误

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();

在类的声明和导入中:

import OasisEM.*;
import eMerchantServlet.*;

未找到:

OasisEM does not exist.

这是给出的示例源:

//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 并添加它.

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 问题:为什么示例源代码可以用命令行编译,但在我的项目中向方法添加相同的行并将类路径添加到类文件夹时,它无法编译?

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 问题:如何让 Eclipse 识别 OasisEMSecImp 类?

Eclipse Question: How can i make Eclipse recognise the class OasisEMSecImp ?

更新

你好,ant文件有点长,我怎么贴我认为相关的部分:

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>

我调试了catw.module.classpath,位置正确.

I debugged the catw.module.classpath and the location is correct.

非常感谢您.

推荐答案

我已经理解了这个问题并找到了解决我的情况的方法,我在我的 这个问题的答案.

I have understood the problem and found a work around for my situation, i explain it in my answer in this question.

希望对某人有所帮助.

这篇关于无法从 ant 编译但可以从命令行运行,为什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆