Eclipse prevents editing after debug mode entered - java

I'm working on an Android project in Eclipse. I just updated to:
Version: Kepler Service Release 2
Build id: 20140224-0627
Since then, if I hit a breakpoint in debug, I can no longer type in any files. The keyboard seems to work for stepping through code and for typing text elsewhere in Eclipse outside the file editors. The behavior persists even if I terminate the debug session. (I'm debugging on a device.)
I need to restart Eclipse in order to be able to change files in the editor. Not too fun! I've not found any recent bug that explains the behavior. FWIW the upgrade wiped out my preferences too. It looks like my install history was lost too because the previous configuration does not seem available to revert to.
Any help appreciated!

This happens when you're debugging .class files instead of their correspodning .java files. This happens a lot when library projects are involved. Some other things happen too -- you can place double breakpoints, &c. It's a bit annoying.
You can normally fix this issue by editing the Source Lookup when debugging. Please see the answer to this question: Debug Android library project with java source code

Related

Eclipse plugin operation does nothing in normal 2019-12 instance, but works fine in rcp debug instance

I'm trying to debug a problem with the Eclipse plugin at https://github.com/davidmichaelkarr/e4macs . This is a fork of the original application, which is now unfortunately abandonware.
As Eclipse has moved on with further releases, there have been a small number of issues in the plugin. I was able to fix the first problem (shown by my diffs with the base repo), but the next problem that appeared around 2019-09 is a little harder to figure out.
Specifically, the "split-window-vertically" command just does nothing when I execute it. It doesn't matter whether it's bound to a key or executed directly from the "execute extended command" prompt. Nothing appears in the log about this.
So, I downloaded an instance of the RCP 2019-12 distro and set up to debug this. I ran an "Eclipse Application" in debug and tested the function. It worked perfectly fine. This means that somehow something else that I have loaded in my regular 2019-12 installation is making this function not do anything.
From the Marketplace Client, I tried installing some of the same plugins in the debug instance that I have in my regular instance, but I didn't get very far doing this. I tried to install the "Spring IDE", but this gave me many errors. It starts out with "Cannot be completed", and it gave me a long list of "will be uninstalled", "Will be upgraded/downgraded", and "Will not be installed". All of the Spring features were in the latter list. I tried to install the "Groovy" plugin, and that gave me several "Missing requirement" errors.
I don't know whether the missing plugins are what is causing the operation to work, and I can't figure out why I can't install the plugins.
I'm not sure what to do here.
Update:
A comment pointed out that the way to install plugins in a debug instance is to add plugins to the target platform. I proceeded to do that, and discovered that one of the choices for sets of plugins to use is from an existing installation, which is perfect, because that's exactly what I want the debug instance to use, all the plugins in my existing 2019-12 installation.
Unfortunately, doing this has apparently removed my other installed plugins as the source of the problem. I tested the plugin code in this newly edited debug instance, which has all of the same plugins as my regular instance, and the plugin is working perfectly fine. In my regular instance, when I execute the operation in question, nothing happens. No error of any kind, and I don't get the expected result. The operation in question is "split-window-vertically", which should do what it sounds like.
Note that by setting the plugin source to the regular installation, that also included the installed copy of the plugin in question, the Emacs+ plugin (which is installed from the "dropins" directory). I'm not sure exactly what that would do. In any case, I set breakpoints in the plugin code, and when I executed the operation, it did hit the breakpoints.
Note that I also did import the same preferences file into the debug instance that I use in the regular installation, so the preferences are identical, and based on the previous information, the set of installed plugins should be almost identical (I'm not convinced they are exactly identical).
The only other difference between the debug instance and my regular installation is that the regular installation is the "Eclipse IDE for Java Developers" variation from the Eclipse installer, but the debug instance was launched from the "Eclipse for RCP and RAP Developers" variation. I have no idea whether that is significant.
Update:
I added logger calls to the plugin code (using "org.eclipse.equinox.log.Logger", is that the correct logger class to use?). I even added a logger call (and even a println) to the constructor of the operation handler class. None of those were seen in the log file. That tells me that something is wrong with my plugin configuration files, like the "plugin.xml" file.
The "plugin.xml" file is 3928 lines long, so I'm a bit hesitant to just paste it here. I tried opening it in Eclipse, and it doesn't complain about anything.
The following is a screen grab showing the relevant entry:
Note that although the executable operation isn't doing anything, and it seems like the handler isn't being executed, there are some aspects of the operation definition that are being properly loaded into Eclipse, like the description of the operation. Emacs+ provides a "describe-command" function, and I can specify "split-window-vertically" to this command, and it properly returns the description of this command as set in the "plugin.properties" file.
Also note that although this particular operation is not doing anything in this version of Eclipse, there are other functions in Emacs+ that are still working perfectly fine.

Eclipse Mars: code is gone

Please, help! I opened Eclipse Mars to continue coding and my code is gone! I don't know what could have caused this but it's all gone. Does anyone have any idea what can I do?
Note: I tried to right-click the java file->Replace With->Previous from local history. But a message says "No local history available for selected resource". Is there any other way?
Thank you in advance!
The first step in debugging this problem is to find out if the code is still exists without using Eclipse. Several possibilities come to mind:
The code is still where you expect, the files exist and the content is OK.
The code is still where you expect, the files exist, but the files are empty.
The workspace directory does not exist any more.
You need to use a file explorer program to find the files and check they are not empty. Try opening them with Notepad++ or similar. If you are lucky, option 1 will be the answer, and Eclipse has got confused. Just use File/Switch Workspace to set the workspace to the directory and all should come right.
Options 2 & 3 indicate you have lost data. There is probably little chance of recovery. Revert to your backups (you do have them?). Otherwise learn a lesson and set up a GIT or SVN server (or subscribe to a cloud service). I just use a very old laptop running Ubuntu with SVN server installed.
As a side issue, Eclipse does not randomly delete or empty files. There are millions of developers world-wide using Eclipse, and if it existed, such behavior would be all over the internet.
I had the same problem and found my file with a strange name in local history with this path:
".metadata/.plugins/org.eclipse.core.resources/.history/"
It was not the last version but better than nothing :)

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.

java.lang.ClassFormatError: Absent Code attribute in method that is not native or abstract in class file "name of class"

I know this question may seems stupid since i cannot give a lot of infos about it, but I think that the problem has to be some kind of bug...
I have written a java program whith NetBeans 7.1, which now gets me this error when trying to run. 10 mins ago it was perfectly running, and i have changed nothing to the class the error refers to
Could this be some kind of NetBeans error? Maybe it is a well know problem?
It also got this exception in NB 7.2
'clean an build' and restarting NB didn't work
updating NB with the latest updates and performing 'clean and build' also didn't work.
So i renamed the cache directory:
c:\Users\userabcd\AppData\Local\NetBeans\Cache\7.2\index\
started NB, waited for it to finish 'background scanning' and pressed 'Debug project' and voila. The cache gets corrupted every once in a while :-/
EDIT: Added Solution B below.
Solution A:
Project Properties
Build >> Compiling
un-check: Compile on Save
Clean and Build
Notes A:
If you leave Compile on Save un-checked, you won't have this problem any longer for this project.
If you enjoy the benefits of the Compile on Save feature, you can re-check the option after you clean and build, and continue work on your project as normal.
Compile on Save is meant to save time by constantly recompiling your .java files into .class files in the background as you save changes to your source code. That way when you build or run your project, most of the compiling work has already been completed allowing you to run and test your code quickly, even for large projects.
NetBeans uses some fancy caching and versioning to avoid having to recompile your entire project every time you save a file. That's why the other solutions listed here will often work; they are ways of defeating this caching-and-versioning system when it occasionally fails, as it has above.
Solution B:
Create empty folder e. g. C:\Temp\mine
Create a new shortcut for NetBeans
with command line parameter in Target:
"C:\Program Files\NetBeans 8.2\bin\netbeans64.exe" --userdir "C:\Temp\mine"
When compile errors occur
(ClassNotFoundException, MethodNotFoundException, etc...)
delete C:\Temp\mine\var\cache
Notes B:
You'll lose all your NetBeans settings the first time.
Much easier to solve future compile errors caused by caching bugs.
Allows running multiple copies of NetBeans, one per userdir.
I got also this exception. My solution was:
edit and save mentioned class (.java file)
clean & build project
deploy to tomcat server
I just had this happen to me with Netbeans 7.4 Beta.
Things I tried:
Restarting Netbeans.
Clean and build.
Shutting down netbeans, renaming the cache dir, starting netbeans and waiting for scanning to complete.
What worked for me:
Making the source file writable and saving a meaningless change (inserting a space).
I don't know why any of the other steps didn't fix the error. Maybe it would have worked if I had done a clean and build after renaming the cache dir?
Its a very frustrating situation to be in - Hopefully this helps someone (perhaps a future me?).
The JDK says for ClassFormatError:
Thrown when the Java Virtual Machine attempts to read a class file and
determines that the file is malformed or otherwise cannot be
interpreted as a class file.
Perhaps a class file has become corrupted. I am going to do the standard IT support statement.
Have you tried restarting NetBeans?
Hope that helps
Got right the same thing with Netbeans 7.1.
Working on a project that works fine for several months.
Now I changed a bean which gets persisted with javax.persistence and now this exception got thrown. Reverted my few changes, clean and compile the project, reboot the whole system: still exceptions.
The curious thing about it: the generated .war works perfectly in a Tomcat at another machine.
UPDATE:
Today I got the same problem again and I couldn't recall how to solve it, but I found this post again. ;)
After a half hour I found the solution: Just change value of the property serialVersionUID, redeploy the app and then you can change the value to its original value and redeploy again -> working.
Seems like Tomcat is holding that class somewhere deep inside – deleting working directories didn't led to success.

Debugger only stops at breakpoints, will not "step over"

I'm trying to debug code that I've built from source. It is started with the wrapper from Tanuki.
I'm debugging inside IntelliJ idea but I'm not sure that is the problem.
The debugger correctly stops at all lines where I've put a break point but never else so F8, "step over" doesn't work. Very tiresome as I have to put break points every where :)
Am I doing something wrong?
How do you build the project? If you build it with Ant or some other tool, make sure that compilation is performed with debug info enabled (debug=true for Ant javac task). Obfuscation and bytecode instrumentation during the build can also affect the possibility to debug. If you run under some non-standard JVM, it may also cause such problem.
When performing remote debug, ensure the target process is started with the correct JVM options suggested in the IntelliJ IDEA Remote debug configuration. Your wrapper configuration may pass them incorrectly.
Make sure you don't have a different jar on the classpath (other than the project) with the same classes. You could be stepping through the compiled classes and "breakpointing" in the sources.
This worked for me: http://devnet.jetbrains.com/thread/267022. Basically there's another lib in the classpath confusing the debugger. Simply find out which library it is by stepping into during the debug. Then find it on the project and delete it.
In my case, it was an auto generated file that was causing the confusion.
happened to me as well, on Eclipse (Mars).
Restart of eclipse solved it... as simple as that...
I also faced the same problem.Below trick worked for me:
Delete the settings for Intellij
Windows User :C:\Users{username}.IntelliJIdea14
This will restart the Intellij for you from the beginning.
Hi I also had the same behavior and I got it fixed by installing the latest IntelliJ after removing/rename the folders found in these locations https://intellij-support.jetbrains.com/hc/articles/206544519
I had to delet all the versions I previously installed. Just give it a try.

Categories