gpt4 book ai didi

java - J2ME Polish - 无法执行 J2ME Polish 任务 : java. lang.IllegalArgumentException : The property [dir. dist] 未在输入 [${dir.dist}] 中定义

转载 作者:太空宇宙 更新时间:2023-11-04 14:09:09 27 4
gpt4 key购买 nike

我正在尝试启动并运行 J2ME Polish 示例项目,但很困难。

我正在使用带有 J2ME Polish 插件的 Netbeans 8.0.2。

当我尝试创建 J2ME Polish 项目 ( File > New Project > Java ME > J2ME Polish Project ) 时,New Project 向导工作正常,直到我到达最后一步,此时单击 Finish 按钮不会执行任何操作。然后我必须关闭向导并手动打开项目(似乎已创建 - 尽管可能不完全?)。

接下来,我将 enough-j2mepolish-client.jar 重新定位到项目的根目录后,通过引用 Output 来修复资源投诉。

然后我尝试清理并构建项目,但我在 build.xml 窗口中收到此错误:

ant -f M:\\Netbeans\\J2ME-Polish-Project rebuild
clean:
Deleting directory M:\Netbeans\J2ME-Polish-Project\build
pre-init:
pre-load-properties:
exists.config.active:
exists.netbeans.user:
exists.user.properties.file:
load-properties:
exists.platform.active:
exists.platform.configuration:
exists.platform.profile:
basic-init:
cldc-pre-init:
cldc-init:
cdc-init:
semc-pre-init:
semc-init:
savaje-pre-init:
savaje-init:
sjmc-pre-init:
sjmc-init:
ojec-pre-init:
ojec-init:
cdc-hi-pre-init:
cdc-hi-init:
nokiaS80-pre-init:
nokiaS80-init:
post-init:
init:
j2mepolish-init:
j2mepolish:
J2ME Polish 2.4 (2013-08-27) (GPL License)
Loading device database...
Processing [7] devices...
building application for [Generic/jtwi] (1/7):
using locale [de_DE]...
java.lang.IllegalArgumentException: The property [dir.dist] is not defined in input [${dir.dist}]
at de.enough.polish.Environment.getProperty(Environment.java:537)
at de.enough.polish.Environment.writeProperties(Environment.java:452)
at de.enough.polish.ant.build.BuildSetting.getDestDir(BuildSetting.java:621)
at de.enough.polish.ant.PolishTask.initialize(PolishTask.java:1613)
at de.enough.polish.ant.PolishTask.execute(PolishTask.java:600)
at de.enough.polish.ant.PolishTask.execute(PolishTask.java:436)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
at sun.reflect.GeneratedMethodAccessor150.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:435)
at org.apache.tools.ant.Target.performTasks(Target.java:456)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1393)
at org.apache.tools.ant.Project.executeTarget(Project.java:1364)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1248)
at org.apache.tools.ant.module.bridge.impl.BridgeImpl.run(BridgeImpl.java:286)
at org.apache.tools.ant.module.run.TargetExecutor.run(TargetExecutor.java:555)
at org.netbeans.core.execution.RunClassThread.run(RunClassThread.java:153)
M:\Netbeans\J2ME-Polish-Project\build.xml:82: Unable to execute J2ME Polish task:
java.lang.IllegalArgumentException: The property [dir.dist] is not defined in input [${dir.dist}]
at de.enough.polish.Environment.getProperty(Environment.java:537)
at de.enough.polish.Environment.writeProperties(Environment.java:452)
at de.enough.polish.ant.build.BuildSetting.getDestDir(BuildSetting.java:621)
at de.enough.polish.ant.PolishTask.initialize(PolishTask.java:1613)
at de.enough.polish.ant.PolishTask.execute(PolishTask.java:600)
at de.enough.polish.ant.PolishTask.execute(PolishTask.java:436)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
at sun.reflect.GeneratedMethodAccessor150.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:435)
at org.apache.tools.ant.Target.performTasks(Target.java:456)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1393)
at org.apache.tools.ant.Project.executeTarget(Project.java:1364)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1248)
at org.apache.tools.ant.module.bridge.impl.BridgeImpl.run(BridgeImpl.java:286)
at org.apache.tools.ant.module.run.TargetExecutor.run(TargetExecutor.java:555)
at org.netbeans.core.execution.RunClassThread.run(RunClassThread.java:153)
BUILD FAILED (total time: 1 second)

除了 J2ME Polish 之外,我对 Ant 也是全新的,所以也许这可能是一个简单的问题来解决(尽管我在 1 小时后还没有成功......)。

为了完整起见,这是我的 <property name="dir.dist" value="dist" /> 文件:

<!-- When you are using NetBeans 5, just rename this file     -->
<!-- to build.xml. You can then use the normal menu items -->
<!-- run, debug, build and so forth from within NetBeans. -->

<!-- This file controls the build process. -->
<!-- The most important target is the "j2mepolish", -->
<!-- which controls for what devices the application should -->
<!-- be created and so on. -->
<!-- -->
<!-- Call the "emulator" target to skip the obfuscation -->
<!-- and to build the example for only one handsets. -->
<!-- The default target builds and obfuscates the example. -->
<!-- -->
<!-- The full documentation can be found at -->
<!-- http://www.j2mepolish.org -->
<!-- -->
<!-- Have fun! -->
<project
name="J2ME-Polish-Project"
default="j2mepolish">

<!-- extend the default NetBeans build script: -->
<import file="nbproject/build-impl.xml"/>

<!-- The polish.home property needs to point to the directory -->
<!-- containing the J2ME Polish installation. -->
<property name="polish.home" location="P:\Program Files\J2ME-Polish" />

<!-- import global properties -->
<property file="${polish.home}/global.properties" />


<!-- Definition of the J2ME Polish task: -->
<taskdef name="j2mepolish"
classname="de.enough.polish.ant.PolishTask"
classpath="${polish.home}/lib/enough-j2mepolish-build.jar"
/>


<!-- build targets, each target can be called via "ant [name]",
e.g. "ant clean", "ant test j2mepolish" or just "ant" for calling the default-target -->

<target name="setdeploy"
description="Call this target first to set the OTA download-URL, e.g. ant setdeploy j2mepolish"
>
<property name="deploy-url" value="http://www.company.com/download/" />
</target>

<target name="enableDebug"
description="Call this target first to skip the obfuscation step, call the emulator and start the debugger, e.g. ant enableDebug j2mepolish"
>
<property name="debug" value="true" />
</target>


<target name="test"
description="Call this target first to skip the obfuscation step and call the emulator, e.g. ant test j2mepolish"
>
<property name="test" value="true" />
<property name="dir.work" value="build/test" />
</target>

<target name="j2mepolish-init"
depends="init"
>
<property name="test" value="false" />
<property name="dir.work" value="build/real" />
<property name="deploy-url" value="" />
</target>

<!-- In this target the J2ME Polish task is used. -->
<!-- It has 3 sections: -->
<!-- 1. The info-section defines some general information -->
<!-- 2. The deviceRequirements-section chooses the devices -->
<!-- for which the application is optimized. -->
<!-- 3. The build-section controls the actual build -->
<!-- process. -->
<target name="j2mepolish"
depends="j2mepolish-init"
description="This is the controller for the J2ME build process."
>
<j2mepolish>
<!-- general settings, these settings basically form the JAD-attributes. -->
<!-- Have a look at the <jad>-section for setting specialised attributes.
You can also define localized attributes in the resources/messages.txt files -->
<info
name="J2ME Polish"
version="1.3.4"
description="A simple project that uses localization."
vendorName="Enough Software"
infoUrl="http://www.j2mepolish.org"
icon="dot.png"
jarName="${polish.vendor}-${polish.name}-${polish.locale}-menu.jar"
jarUrl="${deploy-url}${polish.jarName}"
copyright="Copyright 2005 - 2011 Enough Software. All rights reserved."
deleteConfirm="Do you really want to kill me?"
/>
<!-- selection of supported devices -->
<deviceRequirements if="config.active:defined and (test or enableCompilerMode)" >
<requirement name="Identifier" value="${config.active}" />
</deviceRequirements>
<deviceRequirements if="device:defined and (test or enableCompilerMode)" unless="config.active:defined">
<requirement name="Identifier" value="${device}" />
</deviceRequirements>
<deviceRequirements unless="test or enableCompilerMode">
<requirement name="Identifier" value="${devices}" />
</deviceRequirements>
<!-- build settings -->
<!--
-->
<build
usePolishGui="true"
workDir="${dir.work}"
destDir="${dir.dist}"
compilerMode="${enableCompilerMode}"
compilerDestDir="build/classes"
compilerModePreverify="true"
>
<!-- midlets definition, NetBeans defines all MIDlets in the Ant property manifest.midlets: -->
<midlets definition="${manifest.midlets}" if="manifest.midlets:defined" />
<midlets unless="manifest.midlets:defined">
<midlet class="de.enough.polish.example.MenuMidlet" name="Example" />
</midlets>
<!-- project-wide variables - used for preprocessing. -->
<!-- You can set localized variables in the resources/messages.txt files as well. -->
<variables includeAntProperties="true" >
<!-- use the advanced menubar mode that offers near-native command handling and positioning, on BB and Android use native commands: -->
<variable
name="polish.FullScreen"
value="menu"
unless="polish.blackberry || polish.android"
/>
<variable name="polish.MenuBar.useExtendedMenuBar" value="true" />
<!-- example variables:
In your Java-code you can use the following snipet to use this variable:
//#= private static final String UPDATE_URL = "${ update-url }";
You can change the title of the sample application with the "title"-var.
-->
<variable name="update-url" value="http://www.enough.de/update" />
<variable name="title" value="J2ME Polish" />
</variables>
<!-- Here you can set the dir attribute to "resources2" for an alternative design. -->
<resources
dir="resources/base"
defaultexcludes="yes"
excludes="readme.txt"
>
<root dir="resources/customizations/${customization}" if="${customization}.enabled" />
<!-- add the localization element for created localized
versions of your application: -->
<localization locales="de_DE, en_US" unless="test" />
<localization locales="en_US" if="test" />
</resources>
<!-- obfuscator settings: do not obfuscate when the test-property is true -->
<obfuscator name="ProGuard" unless="test or polish.blackberry" >
<!--
You can set additional parameters here, e.g.:
<parameter name="optimize" value="false" />
-->
</obfuscator>
<!-- debug settings: only include debug setting when the test-property is true -->
<debug if="test or log" verbose="true" level="error">
<filter pattern="de.enough.polish.example.*" level="debug" />
<filter pattern="de.enough.polish.ui.*" level="warn" />
<!-- activate display handler to see log entries in real time:
<handler name="display" />
-->
</debug>
<!-- user defined JAD attributes can also be used: -->
<jad>
<attribute name="Nokia-MIDlet-Category" value="Game" if="polish.group.Series40" />
</jad>
<!--
This is an example for signing MIDlets with J2ME Polish.
You can set the password on the commandline by calling "ant -Dpassword=secret",
or by setting the Ant property above.
Signing is done only for MIDP/2.0 devices.
-->
<!--
<sign
key="SignMIDlet"
keystore="midlets.ks"
password="${password}"
unless="test"
/>
-->
</build>

<!-- execution of emulator(s) -->
<emulator
wait="true"
trace="class"
securityDomain="trusted"
enableProfiler="true"
enableMemoryMonitor="true"
enableNetworkMonitor="true"
if="test and not debug"
>
<!--
<parameter name="-Xjam" value="transient=http://localhost:8080/${polish.jadName}" />
-->
</emulator>

<emulator
wait="true"
trace="class"
securityDomain="trusted"
enableProfiler="false"
enableMemoryMonitor="false"
enableNetworkMonitor="false"
if="debug"
>
<!-- Attach the emulator to the NetBeans debugger: -->
<debugger name="antcall" target="connect-debugger" port="6001" />
</emulator>


</j2mepolish>
</target>

<target
name="emulator"
depends="test,j2mepolish"
description="invokes the emulator"
>
</target>

<target name="clean"
description="allows a clean build. You should call [ant clean] whenever you made changes to devices.xml, vendors.xml or groups.xml">
<delete dir="build" />
<delete dir="dist" includes="**/*" />
</target>

<target
name="cleanbuild"
description="allows a clean build. You should call [ant cleanbuild] whenever you made changes to devices.xml, vendors.xml or groups.xml"
depends="clean, j2mepolish"
/>

<target name="debug" description="debugs the project" depends="enableDebug, test, j2mepolish" />

<target name="deploy"
description="Deploys the applications. Currently empty."
depends="j2mepolish"
/>

<target name="enableBarbie">
<property name="customization" value="Barbie" />
<property name="Barbie.enabled" value="true" />
</target>

<target name="barbie"
description="customizes this project with the settings found in resources/customizations/Barbie"
depends="enableBarbie, j2mepolish"
/>


<target name="enableFrogger">
<property name="customization" value="Frogger" />
<property name="Frogger.enabled" value="true" />
</target>

<target name="frogger"
description="customizes this project with the settings found in resources/customizations/Barbie"
depends="enableFrogger, j2mepolish"
/>

<target name="enableAnimations">
<property name="customization" value="Animations" />
<property name="Animations.enabled" value="true" />
<property name="polish.MenuBar.useExtendedMenubar" value="true" />
</target>

<target name="animations"
description="customizes this project with the settings found in resources/customizations/Animations"
depends="enableAnimations, j2mepolish"
/>

<target
name="build-all"
description="Builds your application in all customizations."
>
<subant target="j2mepolish" buildpath="." genericantfile="build.xml" inheritall="false" ></subant>
<subant target="frogger" buildpath="." genericantfile="build.xml" inheritall="false" ></subant>
<subant target="barbie" buildpath="." genericantfile="build.xml" inheritall="false" ></subant>
<subant target="animations" buildpath="." genericantfile="build.xml" inheritall="false" ></subant>
</target>

<!-- NetBeans specific build targets: -->

<target name="run"
depends="test, j2mepolish"
>
</target>

<target name="rebuild"
depends="clean, j2mepolish"
>
</target>

<target name="rebuild-all"
depends="clean, j2mepolish"
>
</target>

<target name="jar"
depends="j2mepolish"
>
</target>

<target name="jar-all"
depends="j2mepolish"
>
</target>

<target name="clean-all"
depends="clean"
>
</target>

<target name="deploy-all"
depends="deploy"
>
</target>

<target name="enable-compiler-mode">
<property name="enableCompilerMode" value="true" />
</target>

<target name="compile-single"
depends="enable-compiler-mode, j2mepolish"
>
</target>

<target name="connect-debugger">
<property name="jpda.port" value="${polish.debug.port}" />
<antcall target="nbdebug"/>
</target>


</project>

非常感谢任何帮助。

更新:(2015 年 2 月 17 日)我已经添加了 <property name="dir.work" value="build/real" /> (就在现有 ojit_code 行之后),但现在在尝试清理/构建项目时收到此错误:

ant -f M:\\Netbeans\\J2ME-Polish-Project rebuild
clean:
Deleting directory M:\Netbeans\J2ME-Polish-Project\build
pre-init:
pre-load-properties:
exists.config.active:
exists.netbeans.user:
exists.user.properties.file:
load-properties:
exists.platform.active:
exists.platform.configuration:
exists.platform.profile:
basic-init:
cldc-pre-init:
cldc-init:
cdc-init:
semc-pre-init:
semc-init:
savaje-pre-init:
savaje-init:
sjmc-pre-init:
sjmc-init:
ojec-pre-init:
ojec-init:
cdc-hi-pre-init:
cdc-hi-init:
nokiaS80-pre-init:
nokiaS80-init:
post-init:
init:
j2mepolish-init:
j2mepolish:
J2ME Polish 2.4 (2013-08-27) (GPL License)
Loading device database...
Processing [7] devices...
building application for [Generic/jtwi] (1/7):
using locale [de_DE]...
M:\Netbeans\J2ME-Polish-Project\build.xml:83: build.xml line 0: found no operator before symbol [.enabled] in term [${customization}.enabled] (both symbol and term might be simplified).
BUILD FAILED (total time: 1 second)

最佳答案

我从未深入了解这个特定的错误消息,但我最终设法启动并运行了另一个 J2ME Polish 演示项目 - 从那时起我可以根据我的要求调整该项目。

基本上,我对 Netbeans 8.0 没有什么兴趣,所以我使用了 Netbeans 7.2.1。对我有用的演示项目(您在 J2ME Polish New Project 向导的最后一步中选择的)是 datefield 项目。

我还发现选择特定设备来编译项目非常重要 - 我刚刚选择了 Generic/midp2 设备(位于向导)并确保在构建项目时将其选择为当前配置。

我预计还会有许多其他的变体也能起作用,但经过一番折腾后,这个组合最终对我有用 - 所以希望这对其他人来说是一个很好的起点。

关于java - J2ME Polish - 无法执行 J2ME Polish 任务 : java. lang.IllegalArgumentException : The property [dir. dist] 未在输入 [${dir.dist}] 中定义,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28548425/

27 4 0
文章推荐: c++ - 将方法传递给包含对象指针的集合的所有元素,C++
文章推荐: css - 通过 包含的 HTML/CSS 未正确显示