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!
You need to setup jdk as jre in Prefereces->Java->Installed JREs, and check it as "separate jre" in External Tools Configuration->JRE in case of Eclipse
Edit: Run > External Tools > External Tool Configuration
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!
I have a little better solution with less modification:
This fix path issue (just add ext\ to fix issue)
<path id="fxant">
<filelist>
<file name="${java.home}\..\lib\ant-javafx.jar"/>
<file name="${java.home}\lib\ext\jfxrt.jar"/>
</filelist>
</path>
Before doing this, you need to have a jdk1.8.xxx in your installed JREs list, not the jre included in the jdk package but jdk itself.
Next, in Run\External Tools\External Tools Configuration open the JRE tab and check that Execution environment is CDC-1.1/Foundation-1.1 (jdk1.8.xxx)
That's all !
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With