如何使用build.xml文件编译ResourceBundle类

时间:2012-02-13 06:36:20

标签: java java-me resourcebundle j2mepolish

我开发了J2ME应用程序。 当我尝试通过build.xml文件编译我的应用程序时,我得到以下错误 “D:\ sakina \ TTMF_Project \ TTMFMobileClient \ src \ ConfigurationUtil.java:3:找不到符号     [javac] symbol:class ResourceBundle     [javac] location:package java.util     [javac] import java.util.ResourceBundle;     [javac] ^“

任何人都可以告诉我是否必须在build.xml文件中添加任何内容

<!-- define the installation folder of J2ME Polish -->
<property name="polish.home" location="C:\Program Files\J2ME-Polish" />
<!-- define the installation folder of the WTK -->
<property name="wtk.home" location="C:\WTK2.5.2_01" />
<property name="device" value="Generic/midp2cldc11" />
<property name="devices" value="${device},Generic/AnyMsaPhone,Nokia/Series40E3,Nokia/Series60E3,Sony-Ericsson/JavaPlatform7,Sony-Ericsson/JavaPlatform8"/>
<!-- define the J2ME Polish task, classpath on one line please -->

<property name="polish.client.source" value="${polish.home}/j2mepolish-src/j2me/src/" />
<taskdef 
    name="j2mepolish" 
    classname="de.enough.polish.ant.PolishTask" 
    classpath="${polish.home}/lib/enough-j2mepolish-build.jar:${polish.home}/lib/jdom.jar" />

<!-- start the build with J2ME Polish -->
<target name="j2mepolish" depends="init">

    <j2mepolish>
        <info license="GPL" name="TTMFMobile"  version="1.0.0" jarname="TTMFMobile.jar" deletenotify="Do you really want to exit?" />


        <deviceRequirements>
            <requirement name="Identifier" value="${device}" />
        </deviceRequirements>

        <build usePolishGui="true" fullscreen = "yes">
                        <midlets>
                <midlet name="TMF" class="TTMFMobile" />
            </midlets>
            <libraries>
                <!--<library file="${polish.home}/import/BlackBerry-5.0.0.jar" />-->
                <library file="${polish.home}/import/json-1.0.jar" />
            </libraries>
            <variables includeAntProperties="true" >
                <variable name="polish.TextField.showInputInfo" value="false"/>
                <variable name="polish.TextField.useDirectInput" value="false" />
                <variable name="polish.TextField.suppressDeleteCommands" value="false"/>
                <variable name="polish.TextField.suppressClearCommands" value="true"/>

            </variables>
            <obfuscator name="ProGuard" unless="test or polish.blackberry"  />  
            <resources dir="${resource.dir}" defaultexcludes="yes" excludes="readme.txt">
            </resources>
            <jad>
                <attribute name="MIDlet-Icon" value=""/>
            </jad>
        </build>
        <emulator />
    </j2mepolish>
</target>
<target name="clean">
    <delete dir="build" />
    <delete dir="dist" />
</target>

<target name="init">
    <property name="resource.dir" value="res" />
    <property name="path.deploy" value="deployed"/>
</target>

ConfigurationUtil.java文件::

public class ConfigurationUtil {
    private static ResourceBundle objResourceBundle = ResourceBundle.getBundle("ApplicationResources");
    public static String getConfigValue(String configName){ 
        String configValue = objResourceBundle.getString(configName);

        return configValue;
    }
}

1 个答案:

答案 0 :(得分:0)

您需要检查ConfigurationUtil.java中的代码 在构建期间,此文件中存在编译。修复错误并重建它应该工作。