Java program runs smoothly in Netbeans, but slowly in Eclipse and as an executable jar

The java program, which often attends the swing / awt animation (but no more advanced than g.fillOval (...)), works with sequential 60fps in Netbeans and about 6 frames per second when launched in Eclipse or runs as a jar file with unix terminal. The program was developed at Netbeans and is a desktop application (not webstart, japplet or ...). This happens on Ubuntu 10 with java 1.6. How is this possible?

$ java -version
java version "1.6.0_22"

Java (TM) SE Runtime Environment (build 1.6.0_22-b04)

HotSpot (TM) Java client virtual machine (build 17.1-b03, mixed mode, sharing)


Set the default jvm for the sun version and output the jvm used by netbeans and the unix terminal, which was the same for both:

java.runtime.name=Java(TM) SE Runtime Environment, sun.boot.library.path=/usr/lib/jvm/java-6-sun-1.6.0.22/jre/lib/i386, java.vm.version=17.1-b03, java.vm.vendor=Sun Microsystems Inc.

However, this did not matter, since there still remains a significant mismatch in the frame rate. Is there any other factor that could be played here?

+4
source share
2 answers

One possible reason may be that NetBeans may use one JVM, and the Eclipse and java commands may use another. See which NetBeans platform is used for your project and compare it with Eclipse.

There may also be something with the arguments you passed to the JVM. Check it out too.

+3
source

Ubuntu has a very handy utility. Try the following:

 sudo update-java-alternatives -s java-6-sun 

in the shell. This may lead to some errors ...

 update-alternatives: error: no alternatives for mozilla-javaplugin.so. update-alternatives: error: no alternatives for xulrunner-1.9-javaplugin.so. update-alternatives: error: no alternatives for mozilla-javaplugin.so. update-alternatives: error: no alternatives for xulrunner-1.9-javaplugin.so. 

This is only a problem with the java plugin for Firefox. You can ignore it. If you have other problems, check which java you installed by issuing:

 sudo update-java-alternatives -l 

Or you can use the interactive version:

 sudo update-java-alternatives --config 

(... I have not tested this one).

If for any reason you do not have Sun JDK comments, write a comment.


EDIT

Do you use hardware acceleration? Try adding this JVM property:

 -Dsun.java2d.opengl=True 

To find out the details you can also use:

 -Dsun.java2d.trace=log 

See OpenGL acc for more details.

+1
source

Source: https://habr.com/ru/post/1334684/


All Articles