This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 225670 - JavaFX java.lang.ClassNotFoundException: when using javaFX + FXML , happens even in Example Code
Summary: JavaFX java.lang.ClassNotFoundException: when using javaFX + FXML , happens e...
Status: RESOLVED WORKSFORME
Alias: None
Product: javafx
Classification: Unclassified
Component: Project (show other bugs)
Version: 7.3
Hardware: PC Windows 7
: P3 normal (vote)
Assignee: Petr Somol
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-02-03 12:39 UTC by AndreLopes
Modified: 2013-02-05 10:26 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
The Failure Project (134.64 KB, application/octet-stream)
2013-02-04 12:28 UTC, AndreLopes
Details

Note You need to log in before you can comment on or make changes to this bug.
Description AndreLopes 2013-02-03 12:39:43 UTC
Product Version = NetBeans IDE 7.3 RC1 (Build 201301240957)
Operating System = Windows 7 version 6.1 running on amd64
Java; VM; Vendor = 1.7.0_11
Runtime = Java HotSpot(TM) 64-Bit Server VM 23.6-b04

JavaFX java.lang.ClassNotFoundException: when using javaFX + FXML , happens even in Example Code


//////////// LOG : 
ant -f "D:\\Arquivos E Programas\\MeusProjetosJava\\AlterarChatUsers" jfxsa-run
init:
Deleting: D:\Arquivos E Programas\MeusProjetosJava\AlterarChatUsers\build\built-jar.properties
deps-jar:
Updating property file: D:\Arquivos E Programas\MeusProjetosJava\AlterarChatUsers\build\built-jar.properties
compile:
Detected JavaFX Ant API version 1.2
Launching <fx:jar> task from C:\Program Files\Java\jdk1.7.0_11\lib\ant-javafx.jar
Signing JAR: D:\Arquivos E Programas\MeusProjetosJava\AlterarChatUsers\dist\AlterarChatUsers.jar to D:\Arquivos E Programas\MeusProjetosJava\AlterarChatUsers\dist\AlterarChatUsers.jar as nb-jfx

Warning: 
The signer certificate will expire within six months.
Enter Passphrase for keystore: Enter key password for nb-jfx: 
Launching <fx:deploy> task from C:\Program Files\Java\jdk1.7.0_11\lib\ant-javafx.jar
jfx-deployment-script:
jfx-deployment:
jar:
Copying 12 files to D:\Arquivos E Programas\MeusProjetosJava\AlterarChatUsers\dist\run1106134911
jfx-project-run:
Executing com.javafx.main.Main from D:\Arquivos E Programas\MeusProjetosJava\AlterarChatUsers\dist\run1106134911\AlterarChatUsers.jar using platform C:\Program Files\Java\jdk1.7.0_11/bin/java
java.lang.ClassNotFoundException: alterarchatusers.AlterarChatUsers
	at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
	at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
	at java.lang.Class.forName0(Native Method)
	at java.lang.Class.forName(Class.java:264)
	at com.javafx.main.Main.getAppClass(Main.java:506)
	at com.javafx.main.Main.launchApp(Main.java:622)
	at com.javafx.main.Main.main(Main.java:805)
Comment 1 Petr Somol 2013-02-04 11:36:49 UTC
I tried to create JavaFX FXML Application from New Project, as well as the FMXL Login sample. I could not reproduce the problem with current NB 7.3 RC build, JDK7u11 and JDK7u14. 

With older FX SDKs there was a problem with signing FXML applications, yet this is not true any more, I also verified that it works now correctly.

The only way I could reproduce an error message as the one below was to set incorrect application class name in Project Properties->Run panel. Is alterarchatusers.AlterarChatUsers the correct name of your main Application class ?

The easiest way for us to see the cause would be to take a look into the failing project. Can you provide a simple sample project in which the problem occurs ?
Comment 2 AndreLopes 2013-02-04 12:28:39 UTC
Created attachment 130998 [details]
The Failure Project

Hi, Thanks for the Reply. Heres the new version of the project.

The error kept going in jdk 7u11, and jre 7u11.
I updated JRE to u13 and it stopped for a while.

Today, it started Again.
I changed the main method and now another bug happens.

Also, it doesnt use the css, unless i use the javafx scene builder.

Not a clue if its me or a bug.
Comment 3 Petr Somol 2013-02-04 13:26:59 UTC
There were two bugs in the attached project: 1) there was wrong controller referenced from fxml, 2) there was wrong path to fxml file passed to FXMLLoader.

I corrected them as follows: opened fxml in editor and changed fx:controller="alterarchatusers1.pkg1.SampleController" to fx:controller="Controller.SampleController" so that it references the SampleController in Controller package,
 and then I opened StartMain.java and changed FXMLLoader.load(getClass().getResource("Sample.fxml")) to FXMLLoader.load(getClass().getResource("/View/Sample.fxml")) so that the loader knows the full path to your fxml file (otherwise it tried to find it in the same location as your main class).

After these fixes the project compiles and runs correctly. Therefore I assume the problem is not in NB infrastructure.
Comment 4 AndreLopes 2013-02-05 10:26:46 UTC
Yes thank you it worked.
Im not sure if its NB or javaFX error.
Would be interesting if someone would have a look at it, because it was suppose to change automatically wasnt?

Anyway, thank yoU!!! now i know how to fix it myself.