Netbeans application is very slow

I am currently working on a task for school, and I finished programming, but I had a serious problem.

When I run the program in the netbeans IDE, everything works as it should, and its very smooth.

But when I try to run the Jar file, it lags, and my timer takes 3-5 seconds per second.

Is there something I should check before exporting the jar file, or am I starting it incorrectly?

It does the same on my 64-bit Windows 7, Ubuntu 12 64-bit, Ubuntu 11 64-bit, and on Windows 7 32-bit. So this is not an OS problem. And I have a new java runtime

+4
source share
3 answers

My first thought is that maybe Netbeans is launching jvm for your program with more memory. Try to start the jar with increased jvm memory settings. You know that this is one of the java options like -Xmx512m when you run java -jar -Xmx512m yourjar.jar on the command line.

Another suggestion, Netbeans probably executes your clean .class files instead of a single packed jar file. If you can print the classpath, you can try to execute it in the same way that netbeans does. This may end up with you having to deploy multiple jar files to avoid this problem. Do you use many other jar files in your code?

This is based on my experience using eclipse and executing it differently in the IDE compared to the exported jar file.

+1
source

The JAR seems to be built with default compression. I created the JAR manually and set the option 0 (without ZIP compression). It is worth a try.

For more information on the options available when creating a JAR, see here .

+1
source

If you have a version of Eclipse INDIGO, just click on the node project and click on export, then select “Runnable JAR file” in the java section, click “Next”, then finish and do it! :)

0
source

All Articles