Java desktop application take long time to run - java

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.

Related

Eclipse faster auto refresh

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.

javaws.exe poor performance compared with java.exe in java8

You have to contract for supporting non public available Java releases with Oracle for example Java6 ended with 1.6.0_45 publicly but with support you can use 1.6.0_80. Our aim is to stay supported and public available java platform. Therefore we want to migrate our jnlp based RIA application from Java6 to java8 platform. In migration testing we have experienced performance problem. We try to simulate this problem in Java 8 poor GUI performance compared to Java 6 but we realize that the problem not related the that question.
After the introduction, in order to find out the root cause of problem we profiled the application with java mission control(jmc) bundled with jdk. when we profile application launched at workspace we cannot see any performance degradation. And then we realize that problem occurs only JAVAWS environment. Our application runs as expected at java environment but in javaws environment some GUI's are really slow , it adds 6 seconds more to response time.
My first question is that how we profile java application launched by javaws? Because to use jmc we need to set some JVM arguments (java-vm-args="-XX:+UnlockCommercialFeatures -XX:+FlightRecorder") but javaws doesn't support this JVM parameters. You can find supported list at here
My Second question is that why application doesn't run identical at both environment(java and javaws)? We examined signed and unsigned version of our application and both have same situation. By the way our application uses all-permission.
You can pass any JVM arguments you want to javaws by typing them in:
Java Control Panel > Java > View > Runtime Parameters
As for the poor performance, are you referring to application load time? or is it also slow after the applicatio is started?
If you're talking about load time, then yes javaws is slower (about 3-5 seconds slower) because it has to contact Internet to check if your jar files are black listed or if the certificate is expired. I'm not sure exactly what it is doing in these few seconds but I agree that it is disappointing performance hit and I hope someone can shed more light on it.
Thanks Saeid. Problem is determined. We profiled finally and we found that javaws consume long time to load resources e.g. icons, images. to make a solution we cached the resources and for absence images we return a empty image.
You can see this at
To profile application launched by javaws we make a solution following steps in ubuntu
1. move java executable javam
2. create a script file named java and insert following script
#!/bin/bash
/full/path/of/javam XX:+UnlockCommercialFeatures -XX:+FlightRecorder "$#"
3. run application and check java is launched by ps -ef | grep javam
4. run jmc and profile it.

Why won't the VisualVM Profiler profile my Scala console application?

I assume the question is strongly related to this one but it is closed and the solution does not seem clear to me.
I am trying to use VisualVM to profile a console Scala application of mine. I do this by starting VisualVM, starting my Scala application, opening its node in VisualVM, going to the "Profiler" tab and clicking "CPU". The button goes grey for some time (while status never changes to anything from "profiling inactive"), then back active but no profiling data appears shown.
The application does some file reading, data processing (which takes about a minute), stdout data output and exits. I've also tried adding Thread.sleep(60000) to the beginning and to the end of the program to ensure enough time for VisualVM to capture it and do the job, nothing changed though.
Unlike to the related question I've linked to I don't launch my app from Eclipse or anything else - I use the following command line to launch it:
java -classpath myapp.jar:lib/* MyApp.Main
all the libraries (including scala-library.jar) are put in lib/. The app works as expected.
Updates:
I have tried YourKit Java Profiler 11.0.2 and it fails with AttachNotSupportedException.
I've managed with YourKit by attaching the agent manually.
It seems worth stressing that I neither run the application from an IDE (or a build tool) nor have I modified any JVM options but classpath. As far as I understand this problem appears to depend on a JVM version and user/permission issues and. The objective is to figure out the actual mechanism of the problem and the way to configure all the things to work.
Versions of the software used:
YourKit Java Profiler 11.0.2
VisualVM 1.3.4
SBT 0.12.3 (to build but not to run (I've tried both actually))
Scala 2.9.2
Oracle Java 1.7.0_04-b20
XUbuntu Linux 12.04 32-bit i386
Linux kernel 3.2.0-24-generic-pae
I have used VisualVM to profile a Scala application two days ago, so I believe it should work. Here are my suggestions:
Take out YourKit out of the equation and run things without it for a starter
Take out scala out of the equation, try profiling a Java hello world that does while (true) { Thread.sleep(10000); }
Get that to work then put back Scala, then put back YourKit.
Edit: based on your input, I suggest to explicitly set the remote JMX connection. You can start java with the following options:
-Dcom.sun.management.jmxremote=true
-Dcom.sun.management.jmxremote.port=20000
-Dcom.sun.management.jmxremote.ssl=false
-Dcom.sun.management.jmxremote.authenticate=false
Then in VisualVM, add a JMX connection to localhost:20000.

JavaFX 2 and Linux

JavaFX 2 is not support Linux yet. Does this mean a client Linux machine (user machine) cannot run it or a server Linux machine (host machine) cannot run it or both?
*EDIT:*
JavaFX is for rich client. So the server will not run it, but store it and client will get it and run it, right?
JavaFx depends on hardware acceleration to run. This is currently not supported on linux (expected 2012). So if your server is executing JavaFx code, then it would not run on the server. If it is only delivering code to clients, like in an applet, then it would work.
It means you can't use the JavaFX libraries on a machine running Linux. Neither a client Linux machine, nor a server Linux machine can use them.
Response to Edit
You can still store and serve JavaFX code on Linux machines. You just can't execute the JavaFX code on a Linux machine.
Note that JavaFX is different from Java. You can still use Java on Linux machines.
I realize this question was posed a while back (11/2011), but I thought it might help to point out the related Open Source project from the OpenJDK community called OpenJFX. Feel free to help out with development, if you're qualified to do so as well. Given the secure nature of Linux, this project should prove a secure/safe way to utilize the "hardware acceleration to run"; though, it's still in the development stages.
Take a look at the project wiki to learn how to build OpenJFX on Linux.

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