Eclipse faster auto refresh - java

I use Eclipse to run my application only. I use an external editor (Atom) for my main development. I turned on "Refresh using native hooks or polling" to have Eclipse refresh regularly (more info here on how to do that).
My problem is... on OSX (MacBook Pro), it's a 15 sec delay. On my old crappy PC, it's pretty much instant.
My question, is there any way to speed up the polling time on OSX?

(I am not on a Mac, so I can't test this for you.)
Zend have written a refresher for Eclipse that uses Java 7 new features.
https://github.com/zendtech/studio-workspace-refresher
There are others out there to (https://github.com/zch/AutoRefresher and https://github.com/psxpaul/EclipseJava7Refresher) but based on the age and source of the zend one it is where I would start.
Note that you have hit upon one of the biggest issues people have with Eclipse. The new (as of Oct 2015) Friends Of Eclipse funding is aiming to tackle some of these issues. This one has a bug you can track Bug 480551.

There is no configuration that changes the operation of the polling refresh used on the Mac (org.eclipse.core.internal.refresh.PollingMonitor).
The refresh runs much quicker on Windows because it uses file system native hooks rather than polling.

Related

Expedite the develop / deploy / run cycle with Spring, Maven and Wildfly

I've just recently entered the Java world for a client of mine. I have 18 years experience as a .Net developer, but the Java side is new.
Coming from .Net, I'm used to expecting to be able to make a code change, compile my code and run it with a debugger attached all usually within sub 30 seconds, maybe 1 minute on large projects needing a full recompile.
I'm finding my current process with this Java project is taking me upwards of 5-6 minutes. Because of the long time and multiple steps, I find myself starting on other tasks or losing track of what I was doing.
Here is my current process for making a change and testing it:
Make code change
(~200s) Recompile code with Maven on the main Maven module mvn clean install. If I do -DskipTests I can save about 60 seconds here.
(~5s) Stop Wildfly server
(~5s) Copy .war file from myproject\target\myproject.war to c:\wildfly\standalone\deploy\
(~90s) Start Wildfly server c:\wildfly\bin\standalone.bat
Re-login to application (my session expired)
Attach debugger
Again, it is not only the amount of time required for each of these steps but the fact that there are so many steps and the waiting time in-between each makes for distraction as well - after all, who is going to sit and stare at a screen for a 3 minute compile? Whatever I go off to do, I am surely not going to return to that screen at the exact moment the compile is complete. There is going to be wasted time in there.
Further more, I'm repeating this process every time I want to make a single code change.
Is there a way to streamline this process? I.e.:
Is there a way to join some of these steps
Can I speed up the Wildfly boot process?
What will speed Maven up?
Can I do something like "Edit & Continue" which exists in .Net (i.e. live code changes).
Is there a way to get around having to have Wildfly reinitialize anytime I deploy a new war?
Disclaimer: My answer includes processes I personally use, thus it may not be the optimum or most popular solution. Anyway, these things tend to be bound to developer's personal preference.
Find below some recommendations that could speed up the development process.
Use a proper IDE for Java development
Using a popular java IDE can make development faster as it supports integration with build tools(Maven), Version Control Systems, Application Servers(Wildfly) and much more.
Popular choices are Eclipse, IntelliJ, Netbeans and much more.
Fast redeployment
As I said above, a proper IDE would support integration with application servers, Wildfly for your case. By using a Wildfly IDE plugin, you can speed things up as you do not have to wait for app server to boot every time you make a code change. IDE starts once the server and then applies your changes to the running instance.
Personally, I also prefer to use a standalone Wildfly installation instead of integrating it with IDE. To achieve fast redeployment I use hotswap agent. Note that you have to install DCEVM, an alternate JVM which however is not interfering with your main JVM.
Finally, to conclude it is understandable that you make a big turn from .NET to Java and you may feel lost at some points. I would advise to spend some time setting up your environment, and once you have finalised it and you feel comfortable, development will become much easier.
Why stop, move the archive and re-start the server ?
Check out the following maven plugin which will allow you to automate at least that part of it..
https://docs.jboss.org/wildfly/plugins/maven/latest/examples/deployment-example.html

Websphere Eclipse plug-in and Ant dev environment setup

We use Eclipse to develop and Websphere 7.0 to run our code. We use a plugin for Eclipse which allows you run run a copy of WAS locally and integrated with Eclipse. This works but it's not great. Each time I have to make a change I have to run my Ant script (5 mins.) then do my install into WAS and restart the app in WAS (another 5 mins). This is not efficient (actually it's downright annoying!)
What's the best setup Websphere allows, ignoring for a min what is easy to do etc. I want to know what to aim for. Obviously I would love to be able to save in eclipse then go to my browser and refresh the screen, am I mad?
I have looked at this about using Websphere's native Ant, and it is one avenue but I'm sure there's better.
Can I use jpda like I do when starting Tomcat and develop directly in the code? I will still need Ant when doing a full re-build as I have some Java file generation to do but for the in-process builds???
Thanks-in-advance for any and all help.
There is not just one straightforward single best answer as it depends a lot on the application you are doing.
If you rely on ant to make the build and that takes five minutes for any update you do then it may be hard to get away from that. You may not have to do it like that, you may be able to do incremental compilations (only compiling the updated classes) and that should be a lot quicker (but since I don't know anything about your application it is hard for me to tell you that this is a way forward for you). The updates you make in WAS and if that requires a total restart of the application depends on many different factors.
If I update only a jsp file it usually does not require a full application restart, but if you start to update the classes and definitely when you update your web.xml or something like that, a full restart of the application may be required.
The time it takes for you to restart your application depends a lot on what actions your application will perform when you start it up. If you have an application that takes five minutes to start up, then every restart will cost a lot. Is there something you can do to reduce the restart time in certain configurations? Can you divide your application into separate deployables to reduce the startup time for each individual application?
It all depends on your needs and requirements.
We used to have long startup times for our local servers, but since we had upgraded disks (SSD-disks) and enough memory the server startup time has been reduced by 80-90%.

JVM/Java forces applications to run slower on first start, Windows 8?

I have tried three IDEs, all of which I'm fairly sure require Java to run, and all of them start up very very slow (30 seconds to 1 minute) on the first launch of the day. After that, they all start up lightening fast.
The three programs are: Aptana Studio 3, Eclipse, and PHP Webstorm.
Based on upon my web searches, I have modified the AptanaStudio3.ini using some of the suggestions on how to speed it up and they all work ... for every start up after the first launch, that is, but the first launch of the day remains painfully and inexplicably slow.
I have searched SO and I did not see any questions speaking to this issue. If anyone finds an answer here, thank you very much but I could not.
My only conclusion is that this issue is related to how Java runs on Windows 8 since all three software programs are adversely affected. Is this a known bug in Java on Windows 8? I have no idea what to think but I would be greatly appreciative if someone can offer help.
OBSERVATION: from my testing, it seems that if I start up my laptop and then launch Eclipse or Aptana within the first say the first 10 minutes of booting, it launches quicker (still slow but not as bad) then if I were to wait for about an hour and then launch my IDE. Not sure what this indicates.
Thanks
Though you can tune the Eclipse (or Aptana) .ini file and do things like disable class verification and boot using the JVM DLL, this has more to do with OS and hardware disk caching than the JVM. Boot each of the IDEs from a Ramdisk and you'll see that they boot equally as quickly from RAM the first time as they do from 'disk' the second time.
Source: I've spent a lot of time trying to solve this problem already. :)
It might be worth checking your antivirus scanner behaviour - I have precisely this problem.
In spite of SSD & reasonably quick i5 on win8 ultimate, the first boot time for eclipse is measured in many minutes (can be over 10), with subsequent restarts being done in a matter of tens of seconds. The whole PC can do a full restart in about half a minute, so its unlikely to be a raw I/O issue.
From looking at the cpu hogs & digging from there, it appears that the a/v (macafee) is doing an on-access scan for all the eclipse components & plugins after every boot & I suspect this is where much of the time is being taken.
I'll post an update when I've persauded someone to exclude eclipse & jvm from the on-access scan...
Since Aptana Studio is based upon Eclipse there is no big difference to be expected.
This is not a known Bug for Java on Windows 8, since I experienced it at least already in Windows 7. AFAIK it has to do with starting the JVM for the first time.
Of course you could throw a lot of memory at it or tweak the .ini of the IDE. The JVM-startupprocess wouldn't really be affected and it would still be slow. What is neglectable for a server is a problem on the desktop. For details take a look at http://en.wikipedia.org/wiki/Java_performance#Startup%5Ftime

Java desktop application take long time to run

When I run any project java desktop application in netbeans (F6) or run any .jar file java desktop application, it's always delay about 20 seconds or more.
I tested this project on another computer, it works ok (no delay).
Does my computer have an error with Java? Any solution for this problem?
Edit 12/11/2011
Is it true? I check my system, and I think my java application load too much because I can't turn on "Java Quick Starter". It is in Control Panel > Java > [tab] Advanced > Miscellaneous > Java Quick Starter
In my laptop, I can't enable Java Quick Starter.
Thanks for your help!!!
Netbeans will compile your project first, this takes a while. A directly ran java application with a reasonable size jar file should not take more than a second to launch. Of course this does not account for the system you use, if everything you do is slow, so is launching java applications.
Maybe you could try to rise the JVM memory and see what happens...
I think there are 2 params you can give to the Javac to do that they are Xmx( max ) Xms(starting mem)
Or you could try to run jviVisualVM which is a app that comes with java for memory throubleshooting it should be inside java\bin directory
In response to your question about Java Quick Starter. The introduction on the sun website show the following:
JQS is enabled by default in Windows XP and Windows 2000 operating systems and is not necessary on Windows Vista as Vista offers its own pre-loading mechanisms.
and later:
Note: JQS service will perform runtime checks and stop running when a laptop is running on batteries. JQS service will resume when the power cord is plugged in, as performance benefit of JQS is largely dependent on overall system configuration.
Perhaps this is one of your problems.

Eclipse Helios x86 issues on Windows 7 x64, even on clean system

I have a problem with Eclipse for some time. When I move to Windows 7 x64 on my notebook, Eclipse starts getting "Freeze", for example, when using Content Assist (Code Helper), or using any other option in Eclipse. I am using quite bunch of plugins, so, I tried to delete them all, and check clean IDE. But this didn't help. I downloaded fresh Eclipse Helios for Windows x64, didn't help. I even formated the disk, reinstall Windows, install only JDK and Eclipse but it always occur. What can I do ?
Edit:
Memory: I did not change memory, and IDE freeze, change memory to 512,1024,2048 MB, keeps freezing. (via vm parameters).
Anti-Virus: I am using ESET Smart Security, but with our without it, Eclipse keeps freezing.
After much frustration, I disabled AVG and it worked fine.
Several leads.
Check whether this freeze the freeze is linked to a huge consumption of CPU or disk usage. Unlikely.
If not then this is probably a network issue. Then disable the firewall for a while and try again. Eclipse now reports your plugin usage at the beginning of a session and it might be busy looking for a connection.
Close all editors from previous session. In the past, eclipse tried to access xml DTD with from the network instead of the local catalog and that would fail if you were offline of course.
Finally, let me tell you that if this is for running eclipse you've selected the worst OS. OSX and Linux are much better options. I used to do so as well. But for the last two years, I've run Windows only inside VirtualBox when I couldn't avoid it (TOAD, Macromedia Fireworks) and I wished I had migrated before.
The crucial point is how much memory you have for Eclipse and if you have any anti-virus software installed that needs to preparse all the class files Eclipse wants to look in.
Does it settle after some usage?

Categories