Eclipse hot code replace is not working - java

When I run my program in debug mode and try to use hot code replace feature, it just doesn't change anything in running application and there no error window is shown. I am using eclipse version 3.6.2, JVM 1.6 and Windows 7. I have "Build Automatically" checked, I unchecked "Abort build when build path errors occur", but nothing helps. (And I am not creating/deleting methods or something like that.)

Right click on the project. Go to properties->Java Build Path->Projects tab. See if there is any project dependency which does not exist. Remove those projects.
Try hot deployment again. For me that fixed the issue.

Check if Build Automatically is ticked (✓). This would Build your project automatically on Hot code replacement. This worked for me!

Related

Issues with WildFly 10.10 and Eclipse JSF application [duplicate]

I'm currently experiencing a problem with 'hot code replace' not working on Eclipse Galileo and JBoss 4.2.3.
Among other applications I'm running an exploded Java WAR on my local JBoss. The project from which it is build is managed by Maven. I build the project using the Maven goal war:exploded and then I copy that directory to JBoss with an ANT script.
When I'm now running the application and set a breakpoint anywhere in the code, Eclipse properly halts at that line in the debug mode.
But when I'm making a change to the source file and save it, Eclipse doesn't apply this change to the JBoss.
For example, when I make a normal code line into a comment, the debugger still steps over this comment as if it was regular Java code. Or when I remove a line, the debugger seems to get out of sync with the file and starts stepping over parenthesis.
But I'm not getting any 'hot code replace error'-messages either. It seems to me that Eclipse applies the changes to the source files, but doesn't apply it to the JBoss.
Are there any special preferences that have to be turned on in order to make hot code replace work? Or are there any mistakes in how I build and deploy the application to the JBoss?
I did not work with JBoss but I have two suggestions.
If you run your application in eclipse using the launch configuration
Is your "Project" - "Build Automatically" flag enabled?
If not, the code is not compiled and ignored t runtime.
When you debug an application in remote mode, you can not change the code, but you can change the value of parameters. (I think)
I had issues in a project with Maven and Eclipse. No errors were shown, but hot code replacement was not working. I read that "Build Automatically" has to be checked. I checked this and it still didnt work. I had some errors in other projects in my build path. I believe that was the error. When i researched, I found that the we had to uncheck the "Abort build when buildpath errors". I have given the details in the link below.
I had a similar problem with Open Liberty. Let me build on the accepted answer plus the answer from #user513365 (since a link there is now dead).
In my case I had two issues:
1. Build path errors
In my case my Incomplete build path was because I was using a Maven project with only src/main/java but without a src/test/java (so probably could have solved this by creating the latter).
But I was able to fix Hot Code Replace by going to Preferences -> Java -> Compiler -> Building and make one of two changes:
Either:
uncheck Abort build when build path errors occur OR
using the drop-down, change Incomplete build path from Error to Warning.
2. Make sure Eclipse-built classes are getting loaded
In my case my remote JVM was using a full JAR artifact from my local .m2 Maven repository. The accepted answer of enabling: "Project" - "Build Automatically" misses a subtlety here.
The Eclipse project build in my case is only going to do a hot code replace, if I do the Eclipse build after the debugger is attached. Yes, it will do the Eclipse build automatically, but if I restart my remote JVM and simply attach the debugger, it is still configured to load this class from my local .m2 JAR, and NOT pick up my local change.
FINAL NOTE ON THIS ANSWER VS. OTHER ANSWERS
If you are constantly changing the class that you are building automatically you might not notice the subtlety in point 2., and the accepted answer combined with the build path error mentioned in #user513365's answer will be all you need.
First check is the Project/Build automatically.
It may be also required to check the application server deployment configuration,
E.g. for JBoss, in Eclipse, in the Servers view, double click on the server and there is a Deployment Scanners section with two check boxes:
Add missing deployment scanners
Remove added deployment scanners before shutdown
https://docs.jboss.org/author/display/AS7/Deployment+Scanner+configuration
JBoss AS/ Deployment Scanner configuration
I just recently had this problem in Eclipse 2019-06 and found I had to uncheck the option in "Replace classfiles containing compilation errors" in Preferences->Java->Debug->Hot Code Replace group. All the other options there were checked.
Previous to doing that I was getting "Hot code replace failed - Delete method not implemented" despite my only change being to ass a System.out.println call.
As soon as I changed that option ( in the same debug session ) it started working for me.

PhoneGap Android "Could not find *.apk" [duplicate]

I know this question has been asked before and I have seen a plethora of solutions out there, yet none seem to work for me. I was able to build my apk without issues until this error started cropping up. I have tried cleaning my project, removing it from the workspace and reimporting it, removing "Java Builder" from my Builders for the project, building the project manually, reordering my java build path. I have no visible compiler issues and no problems exist in my workspace.
I did experience this issue before and solved it once by removing the project form my workspace and re-importing it and another time I solved it by removing "Java Builder" from my java build path. None seem to work this time. I currently have most of the settings set back to default (i.e. java build is checked again).
I am running windows 7 (64 bit) and using jdk1.6.0_21 via Eclipse 3.6.
Any suggestions would be greatly appreciated as I have lost loads of development time troubleshooting this already.
[Update] My locale is English & I have tried removing the debug.keystore, United States as related to issue 834
Please follow these steps; this might help you out:
Right-click your app project and go to Properties
Select Android from left-hand side list
Uncheck the "Is Library" checkbox
If your app project relies on library projects which are in your workspace, those of course need to have the "Is Library" box checked.
deleting the R.Java file in /Gen folder did the trick for me
I tried all the above solutions. but it didn't work.
The solution was to restart eclipse !!!!!!!
hope this will help someone :)
In my case this problem started after eclipse updated the plugin with the v4.0 API release. I fixed it by going to the main preferences for Eclipse and under Android->Build uncheck 'Skip packaging and dexing until export or launch'
Note: if you eclipse gives you the Unknown Command 'crunch' error then follow this post
I've tried to gather the best of other peoples answers into a step by step list of things to try in order:
Check the project is not set as a library:
Go to Project->Properties
Select Android from left-hand side list
Uncheck the "Is Library" checkbox
Clean and rebuild the project - this should delete and recreate the entire gen folder, including the R.java file mentioned in some peoples answers
Check eclipse and all the Android plugins are up to date
Close the project, exit Eclipse, reopen eclipse, reopen the project.
Go to Java Build Path > Projects and check for any incorrect project dependencies
Go to the main preferences for Eclipse and under Android->Build uncheck 'Skip packaging and dexing until export or launch'
Check JAVA_HOME is set correctly. Follow the steps in this article
If you complete the above list, and still haven't solved the issue, please leave a comment, or if you find something else that works, feel free to edit the answer and add your thing in.
Delete the project from your workspace & import again.
This worked for me.
Can't believe similar issue has been there since 2008.
http://code.google.com/p/android/issues/detail?id=834.
i'm no expert, but eclipse on Windows, doing android apps, refuses to create the default.properties file (in the app root directory). I've just copied one from another app and it works fine. Simple contents, for Android 2.2 project it just says (ignoring comments):
target=android-8
fwiw
I was having the same issue as the OP except that all these suggestions did not work. I found a solution for me.
Make sure that "Skip packaging and dexing until export or launch." is selected.
Go to Window -> Preferences -> Android -> Build. Just make sure that option is selected and apply.
I know this does not make a lot of sense, but having it unselected was giving me this error and with it selected it goes away and the apk is installed.
I am using the auto generated ant build script from android and ONLY using it as my build process in eclipse. I am not using any other build methods.
I figured it out. I was referencing JavaSE-1.5 and using JDK 1.6. I changed it to use 1.6 and that appears to fix it.
Seems like through my research that is an overloaded error message that covers a lot of error cases.
I just fixed this by reselecting a default JRE for the execution environment (JRE6 for JavaSE-1.6 in my case). It got unchecked for some reason.
This fixed my problem. I kept getting the console error in eclipse "Could not find com_android_vending_licensing.apk" and even though it didnt seem to effect the way my app ran, it was annoying. So going into the com_android_vending_licensing project properties and unchecking the "is library" option, building the project to produce the needed apk and then going back into the com_android_vending_licensing project properties and re checking the "is library" check box fixed the problem.
Run Eclipse as "Administrator" and then import the project.
None of these things worked for me. I'm trying to access native code through the jni, first with NDK samples. What I found was the build won't run if jarlist.cache is not present in the project bin directory. If I copy one from another project to that location (may need to refresh to see the folder in Eclipse), build works every time.
Clean the project and it will do. Sometimes it happens unknowingly but keep trying to solve using diff methods.
I had somehow done a Run configuration as a Java application instead of a Android.
the problem for me was I was trying to use IBM RAD which appears to not work properly for this, I installed Eclipse and now have a different error but I should be able to get past it
On my machine (Windows7, 64bit) I could fix this by setting my execution environment to a 32bit variant of the jdk (I used 1.6.0_23). And I tried a lot of things before...
SHA1's answer did it for me: after updating to the latest sdk/adt, my project refused to build an apk; unchecking the option resolved the issue.
I don't know if the update checked this, or if it was checked before but the new adt screwed things up, but things work again now :)
In my case this worked :
Delete R.Java file in /Gen folder
+
Delete all "R.Android" imports that Eclipse added to some of my java classes !!!
and rebuild the project.
remove -- R.java -- Clean the project and run again.. this worked for me ..
Find the project's folder in your system, enter it's Properties via context menu and deselect "Read only" option. Worked in my case.
This seems to be the source of the problem in many cases, moreover some solutions up there base on copying/rewriting the files in the project what makes them non-read-only.
This is caused by JAVA_HOME not being set correctly. It can be easily resolved by following the steps in this article.
Mine was caused by this problem (incompatibility between ADT and SDK), and was fixed thus:
Eclipse > Help
Install New Software
Add 'https://dl-ssl.google.com/android/eclipse/' to 'Work With'
section and press enter
After developer tools appears on the list, check it and click Next
Restart eclipse once download is finished
I my case, I had to switch from API 21 to API 19, clean and build and everything was fine again. I am using a Mac and apparently API 21 is not fully supported on Yosemite.

How can I disable "Initialize Java Tooling" on Eclipse startup?

In our application which is a Eclipse plugin, when Eclipse starts it takes long time and the users are seeing "Initialize Java tooling" message on the left down corner of application. Because our users don't have anything to do with java, I wonder if it is possible to disable Initialize Java tooling.
Another question: What is Initialize Java tooling?
Try to terminate eclipse then backup and delete the folder
.metadata/.plugins/org.eclipse.core.resources/.history
Restarting eclipse will not hang the Java Tooling process.
from Command prompt just type
eclipse.exe -clean
The java-tooling implement a Java IDE supporting the development of any Java application, including Eclipse plug-ins. It adds a Java project nature and Java perspective to the Eclipse Workbench as well as a number of views, editors, wizards, builders, and code merging and refactoring tools. The Java-tooling provides a development environment to developer.
how to disable plugin at startup
you can try disabling the java-tooling while launching the application.I am giving you a snapshot.
go find perspective as Window->Preferences->Run&Launching->java Application-> and make debug an run combobox to none value.
Hope this can solve your problem.
In case of Eclipse Oxygen, this settings can be found at:
Eclipse > Preferences > Run/Debug > Launching > Perspectives > Java Application > Eclipse JDT Launcher
There will be a folder .metadata in your project workspace directory. Just delete the .log files in it and restart eclipse.
Just uncheck "Build Automatically" and force quit Eclipse. Then start it again.
Project>Build Automatically - uncheck
-force quit
-start Eclipse
I know kind of late advice but because I have this issue 3 days now and I am very very frustrated....just have a copy of your eclipse IDE "virgin" as much possible to rerun it. And any plugin you want to have just do it on a direct copied version of this "virgin" eclipse. This is the only way to get away with clumsy plugins and staff under the hood that you cannot control.
It's devastating to import the projects all the time from the start or deleting the metadata folders....
Is to remove or rename the .projects folder in .metadata/.plugins/org.eclipse.core.resources in the workspace folder. This doesn’t seem to affect any project and the .project folder will be recreated when Eclipse restarts

Program in Eclipse not Running

I've just installed Eclipse 4.2.0 and also imported all my old programs into it, except that when I run my programs, it pops up with a message saying:
Select what to run:
Ant Build: Launches an Ant Build with default
Ant Build...: Launches an Ant Build and allows it to be configured
This message has never appeared to me before. I wonder if it is because I imported my files incorrectly or something that I forgot to install. Please tell me how I can make it work properly again. Thanks in advance.
Ah! this is an issue I've experienced earlier. This tip solved the issue. Here's How to do it.
Make sure that you've built it. Or you can enable Project --> Build Automatically.
After the above option is set, try cleaning the workspace. Project --> Clean and clean all the projects you've imported.
Now restart eclipse and you can launch your program.

'Hot code replace' not working -- Eclipse doesn't change any code on JBoss

I'm currently experiencing a problem with 'hot code replace' not working on Eclipse Galileo and JBoss 4.2.3.
Among other applications I'm running an exploded Java WAR on my local JBoss. The project from which it is build is managed by Maven. I build the project using the Maven goal war:exploded and then I copy that directory to JBoss with an ANT script.
When I'm now running the application and set a breakpoint anywhere in the code, Eclipse properly halts at that line in the debug mode.
But when I'm making a change to the source file and save it, Eclipse doesn't apply this change to the JBoss.
For example, when I make a normal code line into a comment, the debugger still steps over this comment as if it was regular Java code. Or when I remove a line, the debugger seems to get out of sync with the file and starts stepping over parenthesis.
But I'm not getting any 'hot code replace error'-messages either. It seems to me that Eclipse applies the changes to the source files, but doesn't apply it to the JBoss.
Are there any special preferences that have to be turned on in order to make hot code replace work? Or are there any mistakes in how I build and deploy the application to the JBoss?
I did not work with JBoss but I have two suggestions.
If you run your application in eclipse using the launch configuration
Is your "Project" - "Build Automatically" flag enabled?
If not, the code is not compiled and ignored t runtime.
When you debug an application in remote mode, you can not change the code, but you can change the value of parameters. (I think)
I had issues in a project with Maven and Eclipse. No errors were shown, but hot code replacement was not working. I read that "Build Automatically" has to be checked. I checked this and it still didnt work. I had some errors in other projects in my build path. I believe that was the error. When i researched, I found that the we had to uncheck the "Abort build when buildpath errors". I have given the details in the link below.
I had a similar problem with Open Liberty. Let me build on the accepted answer plus the answer from #user513365 (since a link there is now dead).
In my case I had two issues:
1. Build path errors
In my case my Incomplete build path was because I was using a Maven project with only src/main/java but without a src/test/java (so probably could have solved this by creating the latter).
But I was able to fix Hot Code Replace by going to Preferences -> Java -> Compiler -> Building and make one of two changes:
Either:
uncheck Abort build when build path errors occur OR
using the drop-down, change Incomplete build path from Error to Warning.
2. Make sure Eclipse-built classes are getting loaded
In my case my remote JVM was using a full JAR artifact from my local .m2 Maven repository. The accepted answer of enabling: "Project" - "Build Automatically" misses a subtlety here.
The Eclipse project build in my case is only going to do a hot code replace, if I do the Eclipse build after the debugger is attached. Yes, it will do the Eclipse build automatically, but if I restart my remote JVM and simply attach the debugger, it is still configured to load this class from my local .m2 JAR, and NOT pick up my local change.
FINAL NOTE ON THIS ANSWER VS. OTHER ANSWERS
If you are constantly changing the class that you are building automatically you might not notice the subtlety in point 2., and the accepted answer combined with the build path error mentioned in #user513365's answer will be all you need.
First check is the Project/Build automatically.
It may be also required to check the application server deployment configuration,
E.g. for JBoss, in Eclipse, in the Servers view, double click on the server and there is a Deployment Scanners section with two check boxes:
Add missing deployment scanners
Remove added deployment scanners before shutdown
https://docs.jboss.org/author/display/AS7/Deployment+Scanner+configuration
JBoss AS/ Deployment Scanner configuration
I just recently had this problem in Eclipse 2019-06 and found I had to uncheck the option in "Replace classfiles containing compilation errors" in Preferences->Java->Debug->Hot Code Replace group. All the other options there were checked.
Previous to doing that I was getting "Hot code replace failed - Delete method not implemented" despite my only change being to ass a System.out.println call.
As soon as I changed that option ( in the same debug session ) it started working for me.

Categories