• Post Reply Bookmark Topic Watch Topic
  • New Topic

Code won't run in eclipse?  RSS feed

 
Alice Hampton
Ranch Hand
Posts: 217
Chrome Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My code won't launch in eclipse I just get this error at line 196:



This is my error : Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at Help.<init>(Help.java:196)


I know it can run because I actually took screenshots of how it looked for my work, so I'm a little curious as to whats happened :S - It has however been developed on a completely different pc to that I am trying to run it on....

 
Swastik Dey
Rancher
Posts: 1815
15
Android Eclipse IDE Java Java ME
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't think eclipse is an issue, as it's just an IDE. Make sure that tree and root object is not null.
 
Campbell Ritchie
Marshal
Posts: 56536
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you get an Exception like that, the code definitely is running.
 
Alice Hampton
Ranch Hand
Posts: 217
Chrome Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's all I really have set up for my tree really







I think the problem lies within my tree where it is says valueChanged(e); as I'm also being told it isn't using my value changed method - I think I've maybe messed my brackets up somewhere because if I take one } out it no longer says that I'm not using that method but it gives me an error because a } is missing :3
 
Swastik Dey
Rancher
Posts: 1815
15
Android Eclipse IDE Java Java ME
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
May be, have another thorough look.
 
Alice Hampton
Ranch Hand
Posts: 217
Chrome Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you reckon that my code:



would actually work if I can get my method to work
 
Campbell Ritchie
Marshal
Posts: 56536
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you are using Eclipse try ctrl‑A→ctrl‑I to improve your indentation.
We have some suggestions about indentation, etc. There are very good reasons for following a recognised indentation convention strictly. You will be able to see the structure of the program and you will be able to see at a glance which { or } is which.
 
Swastik Dey
Rancher
Posts: 1815
15
Android Eclipse IDE Java Java ME
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What are you trying to do here?






 
Alice Hampton
Ranch Hand
Posts: 217
Chrome Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yeah I use it often ctrl a + I I mustn't of re done it before showing the code.

I'm just trying to get my tree to display the keys out the prop file, I had it working not long ago.

Also I don't suppose you would know a better way of getting the first letter of a string? I was doing it this way but for some reason it no longer likes me using searchText since I have moved pc's - perhaps the version eclipse or jdk or something is different but it will be easier to just change it I'm thinking

 
Swastik Dey
Rancher
Posts: 1815
15
Android Eclipse IDE Java Java ME
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So, now the problem is different?
 
Alice Hampton
Ranch Hand
Posts: 217
Chrome Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I still have the old problem,I can probably sort that - I was just wondering if perhaps you may know a way around my other issue. Would it be wise to ask elsewhere?
 
Swastik Dey
Rancher
Posts: 1815
15
Android Eclipse IDE Java Java ME
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What's the other issue?
 
Joanne Neal
Rancher
Posts: 3742
16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Alice Hampton wrote: for some reason it no longer likes me using searchText since I have moved pc's

What do you mean by it no longer likes you using searchText ? Do you get a compilation error ? Does the program not run ? Does a black hole open up and swallow your PC ?
 
Alice Hampton
Ranch Hand
Posts: 217
Chrome Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Haha no it hasn't swallowed my pc...yet

It says SearchText cannot be resolved and I cannot get the program to run because of it so I get an unresolved compilation error
 
fred rosenberger
lowercase baba
Bartender
Posts: 12563
49
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Alice,

Remember that programmers like specs - which is short for specifications. It is almost impossible to give us TOO MANY details. So if you can be clear, complete, and concise in what exactly the problem is, you'll find you get much better help, and it will come much faster.

 
Alice Hampton
Ranch Hand
Posts: 217
Chrome Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've just realised...I was calling it by the wrong name it should of been str, ah I feel stupid now,thank you for the replies!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!