user3239126
user3239126

Reputation:

Java FX sample is throwing error while opening it in NetBeans

I am exactly following the steps mentioned in the following doc under the following heading:

How Do I Run a Sample in an IDE?

However, in Netbeans 7.4, I am getting the following error:

   ant -f C:\\Users\\akhare\\Desktop\\javafx_samples-2_2_51-windows\\javafx-samples-2.2.51\\src\\Ensemble jfxsa-run
C:\Users\akhare\Desktop\javafx_samples-2_2_51-windows\javafx-samples-2.2.51\src\Ensemble\nbproject\build-impl.xml:88: The J2SE Platform is not correctly set up.
 Your active platform is: default_platform, but the corresponding property "platforms.default_platform.home" is not found in the project's properties files. 
 Either open the project in the IDE and setup the Platform with the same name or add it manually.
 For example like this:
     ant -Duser.properties.file=<path_to_property_file> jar (where you put the property "platforms.default_platform.home" in a .properties file)
  or ant -Dplatforms.default_platform.home=<path_to_JDK_home> jar (where no properties file is used)
BUILD FAILED (total time: 0 seconds)

Not sure why I am getting the aforementioned error. Please advise. Thanks

Upvotes: 2

Views: 2515

Answers (4)

The Godfather
The Godfather

Reputation: 1

Right-click on

Project libraries --> properties --> select a platform

even if a platform is selected, reselect it.

Upvotes: 0

Tel
Tel

Reputation: 111

Yashar's solution worked for me if you do a clean and build after. To elaborate, right-click on project, select properties, click on libraries, click on manage platforms..., then add platform..., then just reselect your default platform, so it doesnt have the JDK x.x (Default), instead is just JDK x.x

the output window will look something like this:

Deleting: C:\Users\xxx\Documents\NetBeansProjects\propertiesextractordemo\build\built-jar.properties
deps-jar:
Updating property file: C:\Users\xxx\Documents\NetBeansProjects\propertiesextractordemo\build\built-jar.properties
compile:
Detected JavaFX Ant API version 1.3
jfx-deployment:
jar:
Copying 12 files to C:\Users\xxx\Documents\NetBeansProjects\propertiesextractordemo\dist\run411357528
jfx-project-run:
Executing C:\Users\xxx\Documents\NetBeansProjects\propertiesextractordemo\dist\run411357528\PropertiesExtractorDemo.jar using platform C:\Program Files\Java\jdk1.8.0_60/bin/java

Upvotes: 0

Yashar
Yashar

Reputation: 2723

According to solution here, Which solved my problem, You need to go to your project properties and change your java platform from JDK xxx(default) to JDK xxx

Upvotes: 1

brian
brian

Reputation: 10979

Usually when I try opening a project with those kind of errors, it asks me to resolve the problem.

What you can do now is right click on the project in the project window and choose properties. In the Libraries node you can set the java platform. Then it will build the project using that platform.

enter image description here

You can also use Manage platforms if you have another jdk to use. If you're having trouble you have to say which jdk you're using.

Upvotes: 0

Related Questions