Сбой развертывания Javafx. Не удается найти артефакты JDK в указанном месте: C:\Program Files\Java\jre1.8.0
Это мой первый проект на JavaFX. Я использую Eclipse, чтобы построить свой проект в виде EXE-файла. Я почти сделал. но я не могу выяснить, в чем проблема, которая была у меня сейчас.
мой код файла сборки муравья здесь.
<?xml version="1.0" encoding="UTF-8"?>
<project name="Feel Free" 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_66\lib\ant-javafx.jar"/>
<file name="C:\Program Files\Java\jdk1.8.0_66\jre\lib\ext\jfxrt.jar"/>
<file name="${basedir}"/>
</filelist>
</path>
<taskdef resource="com/sun/javafx/tools/ant/antlib.xml"
uri="javafx:com.sun.javafx.tools.ant"
classpathref="fxant"/>
</target>
<target name="setup-staging-area">
<delete dir="externalLibs" />
<delete dir="project" />
<delete dir="projectRefs" />
<mkdir dir="externalLibs" />
<copy todir="externalLibs">
<fileset dir="C:\Program Files\Java\jdk1.8.0_66\lib">
<filename name="java-json.jar"/>
</fileset>
</copy>
<mkdir dir="project" />
<copy todir="project">
<fileset dir="C:\Users\Bhuvanesh\workspace\Feel Free">
<include name="src/**" />
</fileset>
</copy>
<mkdir dir="projectRefs" />
</target>
<target name='do-compile'>
<delete dir="build" />
<mkdir dir="build/src" />
<mkdir dir="build/libs" />
<mkdir dir="build/classes" />
<!-- Copy project-libs references -->
<copy todir="build/libs">
<fileset dir="externalLibs">
<include name="java-json.jar"/>
</fileset>
</copy>
<!-- Copy project references -->
<!-- Copy project sources itself -->
<copy todir="build/src">
<fileset dir="project/src">
<include name="**/*"/>
</fileset>
</copy>
<javac includeantruntime="false" source="1.8" target="1.8" srcdir="build/src" destdir="build/classes" encoding="Cp1252">
<classpath>
<fileset dir="build/libs">
<include name="*"/>
</fileset>
</classpath>
</javac>
<!-- Copy over none Java-Files -->
<copy todir="build/classes">
<fileset dir="project/src">
<exclude name="**/*.java"/>
</fileset>
</copy>
</target>
<target name="do-deploy" depends="setup-staging-area, do-compile, init-fx-tasks">
<delete file="dist"/>
<delete file="deploy" />
<mkdir dir="dist" />
<mkdir dir="dist/libs" />
<copy todir="dist/libs">
<fileset dir="externalLibs">
<include name="*" />
</fileset>
</copy>
<fx:resources id="appRes">
<fx:fileset dir="dist" includes="Feel Free.jar"/>
<fx:fileset dir="dist" includes="libs/*"/>
<fx:fileset dir="dist" includes="resources/**"/>
</fx:resources>
<fx:application id="fxApplication"
name="Feel Free"
mainClass="application.Main"
version="1.0"
/>
<mkdir dir="build/classes/META-INF" />
<fx:jar destfile="dist/Feel Free.jar">
<fx:application refid="fxApplication"/>
<fileset dir="build/classes">
</fileset>
<fx:resources refid="appRes"/>
<manifest>
<attribute name="Implementation-Vendor" value="Bhuan Tech"/>
<attribute name="Implementation-Title" value="Feel Free"/>
<attribute name="Implementation-Version" value="1.0"/>
<attribute name="JavaFX-Feature-Proxy" value="None"/>
</manifest>
</fx:jar>
<mkdir dir="deploy" />
<!-- Need to use ${basedir} because somehow the ant task is calculating the directory differently -->
<fx:deploy
embedJNLP="false"
extension="false"
includeDT="false"
offlineAllowed="true"
outdir="${basedir}/deploy"
outfile="Feel Free" nativeBundles="exe"
updatemode="background" >
<fx:platform basedir="${java.home}"/>
<fx:info title="Feel Free" vendor="Bhuan Tech"/>
<fx:application refId="fxApplication"/>
<fx:resources refid="appRes"/>
</fx:deploy>
</target>
И сообщение об ошибке:
Buildfile: C:\Users\Bhuvanesh\workspace\Feel Free\build\build.xml
setup-staging-area:
[delete] Deleting directory C:\Users\Bhuvanesh\workspace\Feel Free\build\externalLibs
[delete] Deleting directory C:\Users\Bhuvanesh\workspace\Feel Free\build\project
[delete] Deleting directory C:\Users\Bhuvanesh\workspace\Feel Free\build\projectRefs
[mkdir] Created dir: C:\Users\Bhuvanesh\workspace\Feel Free\build\externalLibs
[copy] Copying 1 file to C:\Users\Bhuvanesh\workspace\Feel Free\build\externalLibs
[mkdir] Created dir: C:\Users\Bhuvanesh\workspace\Feel Free\build\project
[copy] Copying 14 files to C:\Users\Bhuvanesh\workspace\Feel Free\build\project
[mkdir] Created dir: C:\Users\Bhuvanesh\workspace\Feel Free\build\projectRefs
do-compile:
[delete] Deleting directory C:\Users\Bhuvanesh\workspace\Feel Free\build\build
[mkdir] Created dir: C:\Users\Bhuvanesh\workspace\Feel Free\build\build\src
[mkdir] Created dir: C:\Users\Bhuvanesh\workspace\Feel Free\build\build\libs
[mkdir] Created dir: C:\Users\Bhuvanesh\workspace\Feel Free\build\build\classes
[copy] Copying 1 file to C:\Users\Bhuvanesh\workspace\Feel Free\build\build\libs
[copy] Copying 14 files to C:\Users\Bhuvanesh\workspace\Feel Free\build\build\src
[javac] Compiling 3 source files to C:\Users\Bhuvanesh\workspace\Feel Free\build\build\classes
[copy] Copying 11 files to C:\Users\Bhuvanesh\workspace\Feel Free\build\build\classes
init-fx-tasks:
do-deploy:
[copy] Copying 1 file to C:\Users\Bhuvanesh\workspace\Feel Free\build\dist\libs
[mkdir] Created dir: C:\Users\Bhuvanesh\workspace\Feel Free\build\build\classes\META-INF
BUILD FAILED
C:\Users\Bhuvanesh\workspace\Feel Free\build\build.xml:131: Can not find JDK artifacts in specified location: C:\Program Files\Java\jre1.8.0_66
Total time: 2 seconds
2 ответа
Решение
Скажите затмению использовать JDK вместо JRE, потому что jre не имеет всех библиотечных jar-файлов.
В Eclipse выберите меню "Окно" -> "Настройки". Затем выберите Java-> Установленные JRE. Затем нажмите "Добавить…", выберите "Стандартная виртуальная машина", затем нажмите "Далее". В домашней папке JRE перейдите в папку, в которую вы установили JDK ( c:\Program Files\Java\jdk1.6.0_21).
Ссылка: ссылка