Java hashmap nullpointer outside of netbeans?

I figured out that the following (javafx) code (must be this.. there is no other entry point): @Override public void start(Stage primaryStage) { bypasses the main() when I run it as standalone. Maybe the root cause is totally different I don't know.. The fact is that in netbeans, main() is running and on the standalone is not.. I also checked the jar's manifest and the main-class is correct. (just in case) My mind could not go to the fact that main is not running at all!

So, I moved the code I had in main() to the overrided start method and it works. The specification says that the start() method is the main entry point for javafx applications. But, in my understanding, main() should still be called before start().. this could be a bug on javafx.

It's not possible bypass the main method when starting a Java application on the command line - the only possibility is that it's calling some other main method than the one you think it is. Are you perhaps developing an applet? – Esko Luontola Aug 9 at 23:08 I have tried "java -jar file.

Jar" and double click the . Jar // There is no other main method. – Stefanos Kalantzis Aug 9 at 23:28 What about if you remove the call to Application.launch() from the main method?

Then it should stop starting, which means that the main method is indeed being called. If that is the case, then there is still the possibility of multiple class loaders confusing things. – Esko Luontola Aug 10 at 4:57 I removed the Application.launch() from main() and the application runs as standalone but not within netbeans!

– Stefanos Kalantzis Aug 10 at 7:25 Can you put the JAR somewhere for others to download and try? – Esko Luontola Aug 10 at 21:08.

I had something like this before. Hashmap auto-boxing might be the problem here. I think you are trying to autounbox a null value.

Try ExperimentControler.userInput. Put(totalDistance, new Double(300.0)); \EDIT OK thanks @hovercraft, If this doesn't work, you must be storing a null in your hash map somewhere else in your code. Remember that get(totalDistance) is replaced by get(totalDistance).doubleValue(); if you are assigning to an double.As to why it doesn't work out of the jar... no idea sorry.

PS What is the exact line for ExperimentControler.userInput. Get(totalDistance);? Are you assigning it to an Double or a double?

That can make all the difference.

The autoboxing should work in the original code, so this is not the issue. And you had a NullPointerException due to autoboxing problems? Really?

– Hovercraft Full Of Eels Aug 9 at 21:57 yes. If you put null into the hashmap, get will try to autounbox and throw NPE. Check the docs if you don't believe me!

– Sanjay Manohar Aug 9 at 22:00 but he's not putting null in. Again his put and get work without your modification. If you don't believe me, check.

And of course you'll have problems if you put null into a hashmap, but I still don't see how autoboxing issues figure in. – Hovercraft Full Of Eels Aug 9 at 22:02 Besides, his problem is that either the userInput HashMap is null or the ExperimentControler is null (but that's a class, so not likely), not that it contains null values. That's the only reason a NPE will be thrown at the line indicated.

– Hovercraft Full Of Eels Aug 9 at 22:07.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions