Why doesn't Android Studio see updates right away? - java

I am using Android Studio 4.1.1. windows 7. I write in Java. I noticed this feature of the program. Changing something in code, layout or resources. I run the program and see that my changes have not appeared! First comes the thought that I was wrong somewhere. I start looking for an error. I don’t find it. I run the program again and it already works as it should. Now I'm used to it. The larger the program, the more often this happens. To be sure of the result, you have to run the program twice each time, because I'm not sure if this time all the changes took effect. It is very uncomfortable. Tell me why this is happening and how to solve this problem.

Related

Error that runs mistakenly the previous codes when Actually want to run the current code in NetBeans

I've got problem with my NetBeans app, once I click on the run button, it runs the previous program
I coded. Like in the image, I ran the program (Which is PasswordGUI) and it indescribably ran the previous code (Which was Ourproject)
.. So, I'm stuck in here and need help
best wishes
I tried to search if my project in the app have kind of untidy which may this problem the untidiness
of my projects..

'Problems' in VSC not finding basic typing errors

I'm writing code in Java using Visual Studio Code for a project I'm working on. I've been quite pleased with the environment until now, when the 'Problems' window seemed to stop detecting I've made basic typing errors. Right now it detects some errors, but it doesn't detect, for example, when I'm using variables that haven't been declared.
E.g. if I would just have a basic main function and run only the line "int a = 0 + foo", VSC would not detect that 'foo' hasn't been declared. Does someone have an idea about what could be causing this? I might add that I have not done anything out of the ordinary that could causes this (the best I know), and I've done 3-4 projects before without running into this problem.
I've only tried Googling the problem. Since I'm quite inexperienced in this field I don't really have any thoughts on what could be the cause of this.

JavaFX program won't run though the code is correct?

So I've been following an oracle tutorial on JavaFX and I copied the code EXACTLY. I even went as far as to copy paste it from the text version into my IDE. I'm 100% sure that the code is correct.
The first one I followed was this video series.
The second tutorial I used to ensure that there were no errors in the code and the text version I copied.
In my frustration I decided to go from my desktop to my laptop to work, so I uploaded the faulty code to my online repository and lo and behold! It suddenly worked! Which indicates that I am right about there being no errors in the code. But as soon as I make any changes, it stops working again.
The error messages I receive indicates that it happens inside of the Application I'm extending in my Start.class where I have the main().
I'm using NetBeans as my IDE, and my project is a Maven project.
The answer seems to be that you need to clean the project when you perform changes to the FX parts. Clean before you run it and it will work fine, provided there actually isn't anything wrong with your code.

How on earth does he debug a running application like this, and more importantly, how can I?

"Debugception!"
You may notice that within the first 15 seconds of this YouTube video (from 1:01:01 to 1:01:16), Markus Persson (aka "Notch", creator of Minecraft) has somehow managed to save/update an application and attach a debugger to it while it was already under the process of being debugged, supposedly all with a simple keyboard shortcut. The previously coded application somehow magically became the newly edited one, and seemingly without relaunching it or spawning a new process... It's possible that this is just some form of locally remote debugging, but something about it just doesn't seem quite right.
I've spent several days Googling and asking around on how he was able to do this, yet to no avail. I've found no such option under Eclipse preferences, and whenever I try to save & debug an already running application, it simply launches a separate instance of the newly updated application, side-by-side with the older, outdated one.
Am I missing something? How was this possible?
How was he able to utilize such an astounding, powerful debugging feature?
Thanks in advance!
Update
Okay, so this appears to be a standard feature specific to Eclipse.
Coming from a background in NetBeans and Visual Studio, I'm astounded that this doesn't seem to exist elsewhere (or at least in NetBeans!)...
This is a built-in feature of Eclipse. If you edit a method while the program is running in debug mode, it will compile the new method, and replace the old method with the new version. If some thread was already running that method, it will jump back to the beginning (AFAIK; this might only happen when the program is paused).
You don't need to re-launch the program or set any special preferences. Just edit and save, and the magic will happen.
Eclipse can't always figure out how to merge your changes into the running program - usually if you changed anything outside a method body (including the method's parameters or return type). In this case, you will get a warning dialog, with the option to stop the program, restart the program or ignore the changes.

Strategies for debugging a runtime Java crash that runs correctly in NetBeans

Sorry in advance. This is a really vague question because I have no idea whatsoever what is going on. I have a Java Swing GUI desktop app that I wrote in NetBeans. While inside of NetBeans, the app works fine and passes all of the tests that I have thrown at it. I've been developing this app over the past several months, deploying it at various phases of its development.
Yesterday, I finished adding and testing some new functionality. I built the application and put it on another computer. I then went to run the program (outside of NetBeans) straight from the jar file. While in the new areas (JDialog boxes), the program crashes. Since I am not in an IDE, I have no feedback to see what is wrong.
The only thing that I can think of (and this is lame) is that I added some switch statements that switch on strings, which I know to new to 1.7. I was previously developing in 1.6. Otherwise, I can think of no reason that the program should work flawlessly inside the IDE, but crash outside of it.
Can anyone offer any suggestions for how I should approach this? I'm at a complete loss.
Thanks very much.
The next debugging step for you is reducing the size of your program until it doesn't crash, then seeing what change you made worked. That should either make the answer obvious or give you a good question to post on SO.
Your idea that it might have to do with switch statements tells you to try:
removing them
removing and compiling on JDK 6 and see if it works
Those are reasonable ways to reduce your program size to see if you can make it run.
I would start from collecting a crash dump data.
If you run the UI on windows you could use DrWatson
If you run the UI in Linux , By default the heap dump is created in a file called java_pidpid.hprof in the working directory of the VM. unless you specify the path yourself by adding this -XX:HeapDumpPath= option to your UI java options.

Categories

Resources