:$
Ok people, bare with me for a second (or 60...)

I'm developing a part of a larger application, and to cut to the chase, i now need to access an Hashtable that I've made global. This aplication is multithreaded, but I'm trying to access this hashtable from the same thread (or so i think...).
When i run the main class, i create all the Instances i need (one of the Global class also, where I'm creating a new hashtable, later it will retrieve it from a file). When creating this new hashtable i immediately print it's size and as it should, it's 0.

On another class, when i try to access this hashtable using the following code:

if(global.getHist().size()>=0)

i get this error

Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
	at ....HelpingHandSearch.Search(HelpingHandSearch.java:78)
	at ...gui.HelpingHandGui.searchButtonActionPerformed(HelpingHandGui.java:192)
	at ....gui.HelpingHandGui.access$000(HelpingHandGui.java:30)
	at ....gui.HelpingHandGui$1.actionPerformed(HelpingHandGui.java:237)

and it goes on, but if u think it's relevant please let me know and i'll post the rest.

If i take out that line, or any try of accessing that hashtable or any other thing from the Global class it works just as it should...

Any ideas? I'm getting frustrated with this, as I know it's probably some dumb mistake but I'm running out of time :)

I would suggest putting a braekpoint on that line to see what is being accessed that is null. Once you find that you might be able to get to the source of the problem.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.