0

I was working this afternoon in my project without problems. Before come home I did a commit to my svn to continues it in home, but now when I try to run it shows a code error that hadn't shown before. The Following code it's supposed to initiate new scene using controllers and passing parameters. Error:

enter image description here

Someone knows what is happening? If you say "The code is wrong" it's not possible cause I was using the exactily same code in my work.

Detail, in the afternoon i was using Mac OS and now I'm using Windows. And IDE is Netbeans in booth places

2
  • 1
    Verify that the versions of JavaFX are the same. Also verify that netbeans using the correct libraries/platform Commented Jan 26, 2013 at 4:02
  • 1
    No idea why it doesn't work in one of your environments Victor. Exact same code works fine for me (OS X, Java7u11, IntelliJ Idea 12) - Idea doesn't flag it as an error. I originally wrote the code on a Windows NetBeans 7.3beta2 machine against Java7u11 and it was fine there too. You can try adding SyntaxRules suggested cast LoginController controller = (LoginController) loader.getController(), though I wonder why it is necessary as Java correctly infers the type without a cast for me. Commented Jan 27, 2013 at 5:10

2 Answers 2

2

My problem was not about code, actually the code is right. The problem ocurred because my Netbeans was pointing to a old version of JavaFX. The way to fix it was to uninstall everything about java from my computer and after reinstall with the newer versions of JDK, JavaFx and Netbeans.

Sign up to request clarification or add additional context in comments.

Comments

1

Cast your loaders to their appropriate types. For the first cast it to the Login Controller and for the second cast it to the MainViewController.

NetBeans only see's an abstract Object being returned, even though what is actually being returned is a little more specific. I'm not sure why this happened when you moved from one platform to the next (I assume you have the same version and everything), but some compliers will catch this as an error and others will not. Technically there is no error, just questionable results.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.