Eclipse acting oddly, often unresponsive on Run - java

My Eclipse installation has been giving me greif today. After corrupting my Android project to where it would not build any more I was forced to reinstall both eclipse and re-create my project from Scratch.
However, eclipse is still acting oddly. When I press the green Run button in the tool bar quite often it appears to do nothing. No dialog, no progress indicators, no output on the console. If I leave it for a bit and/or hammer the run button constantly, eventually it runs.
What is going on. Have I ticked a 'Run in Background' check box somewhere by mistake. If and even if not, how can I re-configure eclipse to be just a little more responsive again.
EDIT: Turns out in the project settings Eclipse had enabled XML validation for every type of check, this has sped things up a little. However, it's still far from as it was when working well. My guess is there are a number of esoteric lesser used settings enabled somehow. I would still like to know how not to have the Run progress in the background.

Check if disabling Project > Build Automatically and optimizing memory settings in eclipse.ini works.

I have the same problem, sometimes it works and sometimes not. My solution when it happens just click right button on your project in Package Explorer -> Run As -> Android application.

Related

Why is IntelliJ IDEA hanging on "Indexing"?

Want to improve this post? Provide detailed answers to this question, including citations and an explanation of why your answer is correct. Answers without enough detail may be edited or deleted.
I'm running on Arch Linux, on an i7-5930k 6 core CPU and 64GB of DDR4 RAM, and I'm using IntelliJ IDEA 14.
IDEA was working just fine for me several days ago, but one day, suddenly, it began hanging after opening a project, during the "Indexing" stage. I did not update IDEA and nothing changed about my projects. The IDE's UI hangs after it opens the project, with just a tiny little sliver of the progress bar for "Indexing" complete. Every 5-10 minutes or so it unfreezes and the progress bar crawls forward a little bit, before the IDE freezes again for another few minutes. This happens repeatedly for anywhere between 15 minutes and an hour, until it is finally finished indexing, at which point it hangs for another 5-10 minutes doing nothing, before it finally unlocks and allows me to develop.
While this is happening, my system is fairly unresponsive - Firefox tabs take a long time to switch, and scrolling in them is laggy. Opening a new terminal window takes a long time. Switching windows in general takes awhile. In htop, one of my CPU cores is loaded at 100% while the rest have a normal load, and about 6GB of RAM is used (fairly normal load when this system is idle.)
Things I have tried that have not helped:
Delete caches folder
Delete entire ~/.IntelliJIDEA14 folder
Reinstall IntelliJ package
Download IntelliJ manually from JetBrains' site and run it from my Downloads folder (to see if there was something wrong with the Arch AUR package)
Configure IntelliJ to use my system JVM and Maven for importing instead of its embedded tools
Opening multiple different projects (not just the one I initially experienced the issue on.)
This issue is really hurting my workflow, if anybody has any solution to this I would be very greatful.
Try Invalidating the cache and restarting IntelliJ.
In the File menu, select Invalidate Caches / Restart... and then click the Invalidate and Restart button.
I've finally figured it out. The solution was... Rather odd. TL;DR: Run it under strace. Read on for a more detailed explanation.
I came upon it when I decided to run IntelliJ under strace to see what files it was opening to determine whether or not it was a filesystem bottleneck.
This gave me some very strange results: strace was spewing out a near-constant stream of segfaults. Not only that, but IntelliJ was running just fine, not taking forever to index.
After consulting with a friend, I learned that on Arch Linux, systemd logs a dump of a process's memory every time a segfault occurs, except when a debugger is attached. strace is considered a debugger. Arch was thrashing my disks when it kept logging memory dumps due to all the segfaults, hence why the indexing was taking so long, because it was fighting for disk I/O.
My solution for now is to simply run IntelliJ under strace. I will, however, be looking into the issue further, as I don't think java should be segfaulting that much.
edit Intellij[VERSION]/bin/idea.properties,
set idea.max.intellisense.filesize=50
update:
Intellij will skip index files that size larger than 50kb.try this if you have many libraries or many large files(too many characters one line or too many lines)
I had this issue as well with version 2016.2 on Mac OS X. I had to do a force quit to end the application, then I deleted the .idea folder. The next time I launched IntelliJ everything worked fine, it had no problem indexing the project.
I was stuck with a similar issue with the latest IntelliJ Idea 2019.3, so maybe it'll help. For me the issue was with one of the plugins, uninstalling/reinstalling, cleaning caches didn't help. My steps were:
Kill intellij, start it over
When it's starting and about to load a project, be quick and cancel opening the project. This way you'll end up with a small window with a list of previously opened projects and a few menu items.
Open menu > plugins, disable them all
Restart intellij idea, open any project.
If step 4 above succeeds (which happened to me), one by one try enabling the plugins to see which one is causing error. For me it was Kubernetes plugin from JetBrains.
Select Help -> Debug Log Settings...
Add the following line (note the leading # symbol)
#com.intellij.util.indexing:trace
Relaunch the IDE (don't need to invalidate cache as that will cause it to start from scratch, whereas restarting from the point of failure, for me anyway, reported the problem file as soon as I restarted):
Scheduling indexing of file://C:/dev/tools/ruby/lib/ruby/2.2.0/x64-mingw32/win32ole.so by request of index Stubs
Our project doesn't use win32ole so I moved the file to a safe location and restarted my IDE... Bingo, problem gone, indexing finally completed after almost 1 year of effectively using intellij as a slightly-smarter-than-notepad ruby editor.
In my case I found out that Intellij is actually trying to index a 50GB directory with logs that was under the project's root. Make sure that if you have such a directory, it is marked as "Excluded" in the IDE.
You can see which file the IDE is indexing currently in the Indexing Status window (access by clicking on the indexing message in the toolbar). You may need to enlarge this window to see the full path of the file currently being indexed.
In PhpStorm, what solved this for me was excluding folders I didn't need to be indexed from the indexing (specifically the vendor folder, a caches folder, and a few asset folders that contained thousands of images). Instantly it began making progress and completed.
To do this:
in the project directory list, right click the folder you want to exclude
Mark Directory As
Excluded
seems that there might be several reasons for getting into this "indexing" hell. I spent few hours trying to fix it using the ideas above.
At the end of the day, with some profiling work, I found that the bad guy in my case was the csv plugin:
https://plugins.jetbrains.com/plugin/10037-csv-plugin
I had few (not so large) CSV files serving as input, and although I marked them as not to be indexed, the plugin kept trying to index them.
Once I removed the plugin everything worked fine.
Disabling unused plugins will improve the indexing. In my case I have disabled Kotlin plugin from File -> Settings->Plugins
if you check the intellij logs (can be found under C:\Users<User Name>.IntelliJIdea2019.1\system\log ) you will get a pointer what is failing. I was getting an error in Kotlin. After disabling the plugin and restarting Intellij fixed my issue
java.lang.RuntimeException: java.io.EOFException
at com.intellij.util.ExceptionUtilRt.rethrow(ExceptionUtilRt.java:31)
at com.intellij.util.ExceptionUtil.rethrow(ExceptionUtil.java:120)
at com.intellij.openapi.vfs.newvfs.persistent.FSRecords$DbConnection.handleError(FSRecords.java:516)
at com.intellij.openapi.vfs.newvfs.persistent.FSRecords$DbConnection.access$000(FSRecords.java:153)
at com.intellij.openapi.vfs.newvfs.persistent.FSRecords.writeAndHandleErrors(FSRecords.java:965)
at com.intellij.openapi.vfs.newvfs.persistent.FSRecords.access$300(FSRecords.java:47)
at com.intellij.openapi.vfs.newvfs.persistent.FSRecords$AttributeOutputStream.close(FSRecords.java:1629)
at kotlin.io.CloseableKt.closeFinally(Closeable.kt:53)
at org.jetbrains.kotlin.idea.caches.FileAttributeServiceImpl.write(FileAttributeServiceImpl.kt:64)
at org.jetbrains.kotlin.idea.caches.FileAttributeServiceImpl.writeBooleanAttribute(FileAttributeServiceImpl.kt:48)
at org.jetbrains.kotlin.idea.caches.IDEKotlinBinaryClassCache.getKotlinBinaryClass(IDEKotlinBinaryClassCache.kt:67)
at org.jetbrains.kotlin.idea.caches.IDEKotlinBinaryClassCache.getKotlinBinaryClassHeaderData(IDEKotlinBinaryClassCache.kt:8
I had a similar problem with 2019.1.4. However, mine would change directories and sometimes, eventually, finish. If it did finish, it was somewhere in the 8-10 minute range.
I was all over SO, and even JetBrains' forums. I excluded directories via Project Structure | Modules. I used Invalidate Caches And Restart on multiple occasions. I tried having only 1 project open to let it finish. I installed and tried 2019.2.4 and 2019.3.3 (the latter would crash for other reasons). And best of all, it only seemed to happen on one project!
What ultimately led me to an answer was Help > Activity Monitor... where I found psi.impl.cache.impl.todo was running at nearly 100% CPU and not showing signs of stopping.
It turned out, I had a TODO filter setup with a poorly-defined RegEx. It was something like \b.*wip\b.*; the idea was to find all of our "WIP" values. Well, the leading .* was a huge mistake and one that didn't occur to me until losing many hours blaming a plugin upgrade. I believe the reason this was a bad filter was because the project it was hanging on is in ExtJS, which is JavaScript, which means things are in triplicate with the app.js file and whatnot...
Update
In IntelliJ 2020.x and 2021.x, the option has moved to Help > Diagnostic Tools > Activity Monitor.
Had the same issue in the past on some Scala project. I have installed IDEA 16 EAP (https://confluence.jetbrains.com/display/IDEADEV/IDEA+16+EAP) and the problem has gone.
I ran into this problem today on a Mac. It would hang before I was able to get to the menu and invalidate the cache.
I deleted the cache from command line using the following command and it worked for me.
rm -rf ~/Library/Caches/JetBrains/IntelliJIdea*
After that it started up with no issues.
I had the same problem with IntelliJ 2017.3.2. When I clicked on the indexing progress bar I noticed it was hung on a directory within my build directory. When I did a gradlew clean which removed that directory then the indexing was able to proceed.
I have encountered this problem, and resolved it:
remove idea
delete all files and dirs which name regex 'jetbrain' and 'IntelliJ' in my computer(Mac mini)
then install idea
I also try just delete idea cache files, it do not work.
I was using the Elm plugin and installed the elm-bounded-nats package which included a semi-large source file. IntelliJ kept hanging on this file, but did not always report this correctly in the indexing popover dialog (perhaps due to threading). When I exluded this specific file in Settings -> File Types ("Nats.elm") indexing managed to complete successfully. Now the editor renders errors for this package but the compilation process still works.
Invalidate Cache and Restart did not work for me on IntelliJ 2021.3 Ultimate.
I was curious to see if the new Repair IDE feature on 2021.3 Ultimate version works on this issue on my mac.
On startup, IntelliJ froze on indexing
Force quit and relaunched IntelliJ
On Startup, manually "paused" the indexing from the status bar at the bottom
Invalidated cache and restarted
Still froze on indexing
Forced quit and relaunched IntelliJ
Repeated Step #2 on startup
From File Menu, executed Repair IDE, and went through repair steps
FIXED; no longer froze on indexing
Quit IntelliJ and Relaunch
No Index issues
I was also facing freezing issue with intellij 2021.3. Earlier I was using intellij 2021.1 version and that was working fine but since I upgraded intellij version to 2021.3 it started freezing on indexing of files.
Someone in this thread suggested to repair ide using Repair IDE feature. But that didn't worked for me.
So, I went through the thread dumps available in intellij logs folder. After analyzing logs, I found out that calls are blocking on Package Search plugin. So, I disabled that plugin in settings -> plugin. To do that I had to pause indexing at start for time being. After disabling this plugin, it is working fine for me.
This is a known issue and I know disabling it is not a correct fix for it. But I will use it till intellij will release an official fix for this issue.
There might be another project opened parallelly in new window which is being indexed.
It looks like the problem can come from many different sources as other answers point out.
In my case, it was the Subversion plugin that had difficulties to communicate with the server and make the IDE to hang on indexing.
I was able to resolve this problem by removing all of my "target" folders from my project.

Running Android app from Eclipse after setting up for obfuscation

So, this may be the stupidest question ever, but I can't figure it out.
I set up my project to use Proguard obfuscation when I export the APK. A couple weeks later, here I am making some changes to my app in preparation for an update, and I right click on my project and do Run As -> Android Application, just like I always used to while testing.
I was quite surprised to be greeted with a java.lang.NoClassDefFoundError, on the first line of my main method that references obfuscated code. The code compiles in Eclipse, but when run using Run As -> Android Application, it crashes immediately.
However, if I export an APK from Eclipse and manually install it on my phone, the app runs fine! It takes quite a while to export due to the obfuscation though, and while I'm testing it's a pain to wait for it every single time I want to test a change.
So I'm pretty sure this is related to obfuscation, Proguard, and the Eclipse build process. But I'm not sure exactly what's going wrong, or when.
I've tried cleaning the project, I've tried taking "proguard.config=proguard.cfg" out of my project.properties file. Somewhere along the line, something obfuscation-related happened to my project that makes my app un-runnable without exporting an APK. What causes this?
I was under the impression that doing Run As -> Android Application will NOT invoke Proguard. So what's going on?
(Note: The same thing happens using "Debug As" rather than "Run As")
EDIT 1
I've tried commenting out the proguard.config line in project.properties, cleaning the project, and rebuilding it. Same problem.
Additionally, I tried renaming/removing proguard.cfg, but the problem persisted.
Which got me thinking, maybe this isn't an obfuscation-related problem, but rather a project setup problem? But how could it work when exporting an APK yet crash when I Run As -> Android Application? Doesn't make sense.
EDIT 2
The solution is in a comment on the accepted answer. Thank you for putting me on the right path!
I suggest you disable proguard unless you're doing a release build. When you disable/enable proguard you will need to Project > Clean (and re-build if you don't have Project > Build Automatically checked; Project -> Build or CTRL-B).

Eclipse edits and saves don't make changes to running program - powercut

So I was busy writing away in eclipse when there was a power cut. Luckily I had been saving regularly and so when I got back on I still had all my work.
However after writing a few lines and running it and spending a while trying to figure out why it wasn't working I realized that whatever I wrote didn't change what ran. I could even comment out bits of code OR EVEN the entire program OR EVEN YET DELETE LINES OF CODE, yet it still runs as if the same code was there from before the power cut. In the file menu all the save features are grayed out, yet if I control S and restart my pc or restart eclipse then it has made changes to the code and saved however the new code has made no effect on anything and still runs as before.
Has anyone else experienced this?
Has eclipse got some auto save feature for problems such as power cuts in order to prevent work less?
Has this put eclipse in a special mode that I can exit back to the normal mode?
When issues like this happen, the first thing to do is to click on Project -> Clean in the main menu.
The Project was corrupt.
Solution
Copying classes across into a new project and deleting old project.
Try restarting eclipse. Perhaps it kept some content in the editor but the link was broken from the actual file that it's building. Maybe copy your code just in case the file is out of sync with the editor.
My problem was the folder was in a different workspace, so the old version of my file was in there, but my newer saved version was in a different workspace. I didn't realize the newer version was somewhere else. This happened because I need to send files back and forth from my main computer to my laptop for school, then return the folder again. So be extra aware of your workspace locations! If you export a project from Eclipse, it will always choose one by default, but you can choose another in the export menu.

Cleaning Projects and Servers to see my changes working

Let me explain..
I used to program all day just cleaning projects(Project > Clean) and JBoss server(Right click on it > Clean) sometimes.
Something around 10 times in a day of 8 hours working.
Now I need to do it all the time, otherwise it won't get my code updated.
Is there something that I can do to avoid doing it all the time?
Is it even possible?
You can use 'ant' script to clean and build and link it with Eclipse as Builder.
First create a ant script with a target which will do the clean build.
Now go to Eclipse and right click the project and select 'Properties' and select 'Builders'. Click 'Add' button and select 'Ant Builder'. In the shown dialog , point to the ant file you created. Select 'Targets' and select the targets which you want to run.
Run your server in debug mode, so that it has hot-swap enabled. Then make sure you send each changed file to the server. This can be done either via WebToolsPlatform or using the FileSync plugin. If using ant, this looks interesting
A paid option to increase creativity is JRebel. I haven't used it, and the advice I pointed out above are sufficient for me, but take a look at it as well.
Btw, avoid doing clean that often. It is a slow process.

How to uninstall plugins in Eclipse 3.4.X or higher

The GUI for managing plugins in Eclipse got a bit of an overhaul in version 3.4.0.
This GUI is accessed via the "Software Updates..." option in the Help menu.
The option to remove the selected Mylyn plugin is greyed out. In fact, this is true of virtually every installed plugin. I know that the Mylyn plugins are optional, so why amn't I provided with an option to remove them?
The following text is quoted from the Eclipse help docs:
The Uninstall wizard allows you to review and uninstall items in your configuration. This wizard is shown when you select items and press Uninstall... from the Installed Software page. To uninstall software from your system:
Click Help > About and then click Installation Details... to open a dialog showing pages that provide more detail about your installation.
Click the Installed Software tab to see a list of the software items that you have installed into your system.
Select the items that you wish to uninstall.
Click Uninstall...
The Uninstall Details page will show you a list of the items that will be uninstalled. Expanding each item will show what additional items (if any) will be uninstalled as a result of your choice.
If you change your mind about which items should be uninstalled, you may click Back to see a checkmark list of the items you selected before. You may check and uncheck different items in the list, and click Next when you are ready to continue.
Click Finish to start the uninstall.
Once all of the software is uninstalled successfully, you will be prompted to restart for the Workbench. Click Yes when asked to exit and restart the Workbench for the changes to take effect.
And just to update it for Helios - Eclipse 3.6
Help->Install New Software at the bottom of dialog there is link What is already installed once you click on that you will get list of installed plugins and Uninstal... button
eclipse 3.5(Galieo)
Help>> Install New Software >> Already Installed Plugins >> select Plugins >> Uninstall works charm.
There are distributions of Eclipse that come packaged with certain plugins that can't be mix-and-matched. That is the case with Mylyn, that went from a student's thesis project to an integral part of Eclipse. If you want to actually get rid of Mylyn, you may want to install Eclipse classic instead of the distribution you have, and then install the stuff you need.
The standard Eclipse distributions come with Myln.
BTW, Eclipser 3.5 completely changes all these screens :(
If you are using Windows, make sure you are running Eclipse as administrator. Without administrator privileges, some options may be grayed-out in "Installed Software".
In eclipse Helios (version 3.6), to uninstall a plugin:
Go to Help->Install New Software...
Click on "What is already installed?" link at the bottom right side of the dialog
In the Installed Software tab choose the software you want to uninstall
Click on the "Uninstall..." button at the bottom
Click 'Finish' on the Uninstall Details dialog
Observe the 'Uninstalling Software %' status at the bottom status bar of eclipse
Click 'Restart Now' when prompted to do so.
Eclipse restarts. Choose the workspace. Now when you go again to the Installed Software window , you do not find the uninstalled software.
In Eclipse 3.6 Helios, the interface has changed again. Go to "About Eclipse", and then click the "Installation Details" button in the about box.
While Help → About Eclipse IDE [or wherever it was in the past or will be in the future] → Installation Details → Installed Software → Uninstall... is the official and preferred way there are features/plugins the latter button of which is disabled.
Remember also that there aren't only plugins but features too. In my case I wanted to remove Mylyn and Wild Web Developer from a rather fresh Eclipse IDE for Enterprise Java and Web Developers package. I did the following.
But first a:
DISCLAIMER
Enter ECLIPSE_HOME at your own risk. Mistakes like typos might be in the following, too. I take no responsibility for whatsoever.
Created the directories features.DISABLED and plugins.DISABLED in Eclipse's home dir.
Moved *mylyn* from ECLIPSE_HOME/features to ECLIPSE_HOME/features.DISABLED
Moved *wildwebdeveloper* from ECLIPSE_HOME/features to ECLIPSE_HOME/features.DISABLED
Moved *mylyn* from ECLIPSE_HOME/plugins to ECLIPSE_HOME/plugins.DISABLED
Moved *wildwebdeveloper* from ECLIPSE_HOME/plugins to ECLIPSE_HOME/plugins.DISABLED
After starting Eclipse there were about a dozen "not found" errors in Eclipse's Error Log view. If you double-click on each of them you can see which dependency plugin JAR(s) haven't been found.
Set the Error Log view's filter to just display errors and warnings.
Moved the dependency plugin *.jars mentioned in the errors from ECLIPSE_HOME/plugins.DISABLED back to ECLIPSE_HOME/plugins one by one (with Eclipse restart after each) until no "not found" error appeared in the view any longer. It were nine *mylyn*.jars in the end.:
*.mylyn.commons.core_*
*.mylyn.commons.net_*
*.mylyn.commons.notifications.core_*
*.mylyn.commons.notifications.ui_*
*.mylyn.commons.screenshots.ui_*
*.mylyn.commons.ui_*
*.mylyn.commons.workbench_*
*.mylyn.commons.wikitext.markdown_*
*.mylyn.commons.wikitext.*
Note that this applies to a rather fresh Eclipse 2021-03 (4.19.0) installation. It might be different from one – even patch – version to the other.
Furthermore:
Keep Eclipse's Error Log view open for a while. The underlying OSGi activates bundles (plugins) on the fly if they are referenced from an other bundle (plugin) for the first time. And if one isn't there then...
Check the Error Log view especially after installing new features/plugins. They might rely on plugins/JARs you moved to .DISABLED. If that's the case move the according JAR(s) back to ECLIPSE_HOME/plugins and/or ECLIPSE_HOME/features.
If something doesn't work as it did in the past once in the future remember what you did and ... → Error Log view.
I'm running (a relatively fresh copy of) 3.4.1. I was able to select the same plug-in shown in your screen shot (Mylyn Bridge: Java Development) to get an enabled "Uninstall..." button. I'd suggest getting the latest updates and trying again.
It sure looks like there's no way to do this.
I just had exactly this problem with a fresh download of the Eclipse Java IDE (Ganymede SR2). I didn't want Mylyn, but I didn't want "Eclipse Classic", either, because the download was twice the size, I presume because it includes source.
The apparent solution was to update everything and restart Eclipse, after which the "Uninstall..." button became enabled for the Mylyn plugins. Unfortunately, this only uninstalled the most recent, updated version (3.0.11 IIRC), reverting to the un-uninstallable 3.0.5.
I just don't know what the hell these Eclipse developers are thinking! Removing plug-ins from Eclipse became a pain in the ass since Helios!
I hear you pal... I just went through the whole day trying to figure out as no one seems to give an straight answer like "do this, that, done."
Man I'd rather be programming instead....
Found, in the middle of my evening that it is possible to uninstall pretty much everything. The issue is that the damn thing is hidden in the "HELP->ABOUT". Who would guess after going over and over through the "Help->Install New Software" or "Help->Check for updates" and never finding anything like "remove" or "reinstall" or "force reinstall".
Seriouly, I'd rather go back to 1990 when we had Microsoft, Borland and Watcom.. you picked your platform and you'd be with 1/3 of the world of developers with you.. ok, perhaps Watcom didn't hit that mark but you get the point.
So... to uninstall any plugin from Eclipse Helios (Service Release 1) or Springsource 3.5.2 (or 3.6.1 I 'm using), do this:
close all your projects (just to be on the safe side);
Hit menu "HELP-->ABOUT" (yeah.. help, about);
Hit "Installation Details" button and you get the list with all plugins;
Click on the one you want to remove; hit uninstall;
If want to remove more than one, just apply the change without restart;
Goto to 4) as needed
Finally, restart Eclipse and reinstall what you need !
It was hard to find, but it worked very well for me.

Categories

Resources