I've currently got a snippet of java code running in eclipse, which has a bug somewhere. In fixing the bug, I'd like to see what the program's actually doing. I know Java traces where the program goes when it displays an error message; can I access that data to find out where I'm going wrong?
Thanks!
If you are not familiar with breakpoints and debugging process this tutorial from Vogella will help you. Breakpoints will help you to understand the flow of program and can see where it starts and stops.In debugging mode when you hover over variable you can actually see what's happening there and values as well. This way you will know where this error is coming from and what could be the solution.
Related
Problem
My code runs without problem but this prompt keeps appearing. I have run into this problem a lot but I just ignored it since the code runs fine. However it's starting to get rather annoying and all the fixes I saw online did not work. I suspect this has something to do with 'hot code replace'.
I also did set "Build automatically".
I saw on some other post that I could disable hot code replace by going to Preferences>Run/Debug, but I found no such option.
Any help is appreciated, thanks!
Apparently I was running in debug, I confused my shortcut keys... Problem fixed lol
I'm trying to solve Google's foobar challenges. I'm not going to spoil the actual question for anyone else, but the title is "Save Beta Rabbit". My solution is coded in Java, and every time I try to verify it I get an Error(400): Bad request. This appears to be an error on their part. I've tested the code locally on my machine and it works fine. Also, if it was a problem with runtime or memory, foobar explicitly tells you that. It also explicitly tells you when you have complier errors. Anybody know anything about this? Challenge is on a timer here.
UPDATE: I've traced down where the bug is. When you recursively call the same static method twice, the bug occurs. Unless anyone else has seen this before, I'm going to report it to Google through the feedback mechanism and close this question.
I got the same error in a Java solution. Without getting into implementation details, it turns out it was a performance problem. After I fixed it the verifier worked.
I am very new to Eclipse, java programming and well all "programming" in general and I have recently been learning how to use Eclipse. I've been using it for about a week now and it has been going decent so far. Apart from some errors,(mostly on my part) that has been fixable by restarting the program itself.
However when I started using it today I could no longer see the suggestions made from the Quick Fix command, for example if I type findVi and then press CTRL+1, it shows "No suggestions available" instead of "findViewById()" or something similar.
I know it's the correct binding, I even reset the keys to default to be sure. It still finds the ID if i type it manually but I would like to able to finish words faster that way.
If you guys got any suggestions that can help me out, please let me know.
Thanks.
- First of all if you are new with Java, and want to practice Java, you should NEVER USE ANY IDE, that way you learn the proper syntax, and it helps your error finding skills.
- But as you wrote "findViewById()" it seems that you are doing Android, Now this happens sometimes that Eclipse behaves weirdly with Android. Thats the reason when you make any changes into your Eclipse GUI while working with Android, its always better to see if those changes have taken effect.
- This problem usually goes off after closing and re-opening the Eclipse once or twice.
- Ok try this....
Type findVie then press Ctrl + Space-Bar See if the suggestion pops up...
You can access the Content Assist preferences from Window > Preferences > Java > Editor > Content Assist... perhaps something got messed up.
I am developing Android app in eclipse with Android SDK 2.3, but i am unable to see the errors like we see in java or .net, there are no run time errors tracing, if there is some error i have to place alerts there to check it, where as compiler does not place any error in its window. Its quite strange that it gives compile time error but no run time error. Please help.
Thanks
Atif
Go to Window->Show View->Other.., and select Android->LogCat. This is the running system trace. I believe this is what you are looking for.
So first thing about android is, you will not be able to look your output details in console as your java or .net shows. As you might know emulator is what is considered to be your output window. And in order to find compile time errors eclipse makes it easy by highlighting your mistakes instantly. And as you have asked for, to look at your runtime errors android uses a special view called Logcat. This is were you will be listed out with all the runtime details of android. And as you have said that you are not able to view even System.out.println messages not being viewed, you might find it a bit strange but actually android does print these mesages in Logcat for you. So as the user sparkymat has suggested follow the steps and you are done.
Error I am getting:
Sorry!
The application {name} (process {package}) has stopped unexpectedly. Please try again.
The application fetches some data from the internet (my server) and then parse's it to take the data out of the XML. The program does not crash if the data is the same every time (empty every fetch or populated). But it seems to crash when the data changes even though the variables are not set as final and specify "new" on each instance.
The question: is it possible to diagnose the problem more fully from Android? I am not getting any messages in the console (developing live on the phone linked to eclipse).
Thanks for your help!
To diagnose problems in Android it is important to look at the Logcat output. This is the standard output for all Android applications. If this is not helping you could think about using try/catch blocks around the problematic code part or I also would recommend to register a global UncaughtExceptionHandler that catches all exceptions that are nowhere else catched.
You could add a try/catch clause perhaps or typical Log.e messages wherever you feel it's crashing and print the stackTrace.
If it's linked to Eclipse, then the debugging messages should appear (unless you set your manifest feature to be non-debuggeable).
One thing to try is to look at the data that works and the one that doesnt, and note the differences. Then, in the xml that works, add a line of the xml that doesnt work. Do this line by line to determine what part (if at all it does) causes the error. This is assuming your code is okay but the data being sent is wrong.
Hm, before doing this make sure it is a data issue and not code.