JavaFX的构建失败 [英] JAVAFx Build Failed

查看:1284
本文介绍了JavaFX的构建失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建的JavaFX应用程序的Windows,这是真的很酷。我可以从E(FX)clipse,全部的寄托都工作正常运行它,但我不能让从​​项目的JAR文件。
我可以将其导出(右键点击 - >导出 - >运行的JAR文件)。但是,如果我运行在Mac OS X上的罐子,在菜单栏我得到的菜单项,而不是我的应用程序的名字,我真的不喜欢的java。
我搜索了如何隐藏菜单项,或者只是重新命名它,我发现我在build.fxbuild文件重命名的应用程序标题*。现在,我不能建立它。

原来这就是我真正想要的:删除/隐藏/重命名的java菜单项中的Mac OS X.
如果您有任何经验,请与我分享。我将非常感激:)。

我收到以下错误,当我尝试运行build.xml文件:

  [javac的] 22编译源文件到C:\\用户\\哈桑\\桌面\\程序\\工作区\\ Raktar_vevo 2.7 \\版本\\班
[javac的]警告:[选项]结合不设置与-source 1.7自举类路径
[javac的]注:C:\\用户\\哈桑\\桌面\\程序\\工作区\\ Raktar_vevo 2.7 \\ build中的\\ src \\程序\\SajátKészlet.java使用未经检查或不安全的操作。
[javac的]注:重新编译-Xlint:未选中的详细信息。
[javac的] 1警告
 [复制]复制12个文件到C:\\用户\\哈桑\\桌面\\程序\\工作区\\ Raktar_vevo 2.7 \\版本\\ classesinit    -fx任务:
  [的taskdef]无法加载从资源COM /阳光/ JavaFX的/工具/ ANT / antlib.xml定义。它不能被发现。
做部署:
     [复制]复制20个文件到C:\\用户\\哈桑\\桌面\\程序\\工作区\\ Raktar_vevo 2.7 \\ DIST \\库构建失败
C:\\用户\\哈桑\\桌面\\程序\\工作区\\ Raktar_vevo 2.7 \\ build.xml文件:217:问题:无法创建任务或类型的JavaFX:com.sun.javafx.tools.ant:资源
原因:这个名字是不确定的。
操作:检查拼写。
操作:检查所有的自定义任务/类型已经被宣布。
操作:检查任何与LT; presetdef> /< macrodef>声明发生。
任何类型或任务已在此命名空间中定义还
总时间:22秒

**
我用:
-Windows 7 64位
-jdk 8 U5
-JAVA_HOME设置
-e(FX)clipse(开普勒),我下载了所有功能于一身的版本(懒惰的链接

非常感谢你的帮助!


解决方案

在新的JavaFX项目,生成的文件build.xml,也许有错误的文件路径。

\r
\r

<?XML版本=1.0编码=UTF-8? >\r
<项目名称=App2的默认=​​办部署BASEDIR =。的xmlns:FX =JavaFX的:com.sun.javafx.tools.ant>\r
<目标名称=的init-FX-任务>\r
&所述;路径ID =fxant>\r
<&文件列表GT;\r
<文件名=$ {java.home} \\ .. \\ lib目录\\蚂蚁javafx.jar/> <! - 走错了路 - >\r
<文件名=$ {java.home} \\ lib目录\\ jfxrt.jar/> <! - 走错了路 - >\r
< /文件列表>\r
< /路径>\r
\r
<的taskdef资源=COM /阳光/ JavaFX的/工具/ ANT / antlib.xml\r
URI =JavaFX的:com.sun.javafx.tools.ant\r
classpathref =fxant/>\r
< /目标与GT;

\r

\r
\r

您必须检查哪里都是蚂蚁javafx.jar和jfxrt.jar?
例如,JDK 1.8这两个文件都在不同的地方,
C:\\ Program Files文件\\的Java \\ jdk1.8.0_20 \\ lib目录\\蚂蚁javafx.jar
C:\\ Program Files文件\\的Java \\ jre1.8.0_20 \\ lib目录\\分机\\ jfxrt.jar

所以现在我只找到自己修改的方式...

\r
\r

<?XML版本=1.0编码=UTF-8? >\r
<项目名称=应用程序默认值=办部署BASEDIR =。的xmlns:FX =JavaFX的:com.sun.javafx.tools.ant>\r
<目标名称=的init-FX-任务>\r
&所述;路径ID =fxant>\r
<&文件列表GT;\r
<文件名=C:\\ Program Files文件\\的Java \\ jdk1.8.0_20 \\ lib目录\\蚂蚁javafx.jar/>\r
<文件名=C:\\ Program Files文件\\的Java \\ jre1.8.0_20 \\ lib目录\\分机\\ jfxrt.jar/>\r
< /文件列表>\r
< /路径>\r
\r
<的taskdef资源=COM /阳光/ JavaFX的/工具/ ANT / antlib.xml\r
URI =JavaFX的:com.sun.javafx.tools.ant\r
classpathref =fxant/>\r
< /目标与GT;

\r

\r
\r

后修改文件,右击选择运行方式Ant构建!

I created an app with JavaFx for windows, which is really cool. I can run it from e(fx)clipse, everthing works fine, but I can't make a jar file from the project. I can export it (Right click->Export->Runnable Jar File). However, if I run the jar on MAC OS X , in the menu bar I get "java" menuitem instead of my application name ,which i really don't like. I searched for how to hide that menuitem, or just rename it, and I found that I have to rename the "Application title*" in the build.fxbuild file. Now I can't build it.

So this is what I really want: to remove/hide/rename the "java" menuitem in Mac OS X. If you have any experience, please share it with me. I will be really grateful :) .

I get the following error when I try to run the build.xml file:

[javac] Compiling 22 source files to C:\Users\Hassan\Desktop\Programming\workspace\Raktar_vevo 2.7\build\classes
[javac] warning: [options] bootstrap class path not set in conjunction with -source 1.7
[javac] Note: C:\Users\Hassan\Desktop\Programming\workspace\Raktar_vevo 2.7\build\src\application\SajátKészlet.java uses unchecked or unsafe operations.
[javac] Note: Recompile with -Xlint:unchecked for details.
[javac] 1 warning
 [copy] Copying 12 files to C:\Users\Hassan\Desktop\Programming\workspace\Raktar_vevo 2.7\build\classesinit

    -fx-tasks:
  [taskdef] Could not load definitions from resource com/sun/javafx/tools/ant/antlib.xml. It could not be found.
do-deploy:
     [copy] Copying 20 files to C:\Users\Hassan\Desktop\Programming\workspace\Raktar_vevo 2.7\dist\libs

BUILD FAILED
C:\Users\Hassan\Desktop\Programming\workspace\Raktar_vevo 2.7\build.xml:217: Problem: failed to create task or type javafx:com.sun.javafx.tools.ant:resources
Cause: The name is undefined.
Action: Check the spelling.
Action: Check that any custom tasks/types have been declared.
Action: Check that any <presetdef>/<macrodef> declarations have taken place.
No types or tasks have been defined in this namespace yet


Total time: 22 seconds 

** I use: -Windows 7 64bit -jdk 8 u5 -JAVA_HOME is set -e(fx)clipse (Kepler), I downloaded the All-in-one version (for the lazy link)

Thanks you very much for your help!

解决方案

When you new the JavaFX Project, the generated file, build.xml, maybe have wrong file path.

<?xml version="1.0" encoding="UTF-8"?>
	<project name="App2" default="do-deploy" basedir="."  xmlns:fx="javafx:com.sun.javafx.tools.ant">
	<target name="init-fx-tasks">
		<path id="fxant">
			<filelist>
				<file name="${java.home}\..\lib\ant-javafx.jar"/> <!-- wrong path -->
				<file name="${java.home}\lib\jfxrt.jar"/> <!-- wrong path -->
			</filelist>
		</path>
	
		<taskdef resource="com/sun/javafx/tools/ant/antlib.xml"      
			uri="javafx:com.sun.javafx.tools.ant"
			classpathref="fxant"/>
	</target>

you have to check that where are the ant-javafx.jar and the jfxrt.jar ? For example, JDK 1.8 the two files are in the difference place, C:\Program Files\Java\jdk1.8.0_20\lib\ant-javafx.jar C:\Program Files\Java\jre1.8.0_20\lib\ext\jfxrt.jar

so now I only find the way to modify by myself...

<?xml version="1.0" encoding="UTF-8"?>
	<project name="App" default="do-deploy" basedir="."  xmlns:fx="javafx:com.sun.javafx.tools.ant">
	<target name="init-fx-tasks">
		<path id="fxant">
			<filelist>
				<file name="C:\Program Files\Java\jdk1.8.0_20\lib\ant-javafx.jar"/>
				<file name="C:\Program Files\Java\jre1.8.0_20\lib\ext\jfxrt.jar"/>
			</filelist>
		</path>
	
		<taskdef resource="com/sun/javafx/tools/ant/antlib.xml"      
			uri="javafx:com.sun.javafx.tools.ant"
			classpathref="fxant"/>
	</target>

after modify the files, right click choose the Run as Ant Build!

这篇关于JavaFX的构建失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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