Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is my application starting up in more than 2 minutes?

I'm running a graphical java application made with swing on my windows 7 64 bits computer.

My application is a runnable jar file that I launch from my command prompt by using the following command:

C:\path\to\jre\java.exe -jar myProg.jar

My problem is that, I get huge performance performance issues when I'm using JRE8 32bits while not when using JRE7 32bits or JRE8 64bits.
Note that the application is runned with the same jar file ; the only difference is that it's being ran by different JREs.

I tried different JRE8 version and the problems persists...

When I compare both output when using the "-verbose" argument, I see that I get more than 1500 outputs with text : '[Loaded xxxxxx from shared objects file]' for the JRE7 while I get none for JRE8.
Mayby it may be somehow linked ?

Does anyone have an idea on what the problem could be ?


Here are some outputs from the JRE7

[Loaded MainFrame.MainFrame$XtrFileFilter from rsrc:./]
[Loaded java.awt.event.HierarchyListener from shared objects file]
[Loaded java.lang.InterruptedException from shared objects file]
[Loaded java.io.FileWriter from shared objects file]
[Loaded javax.swing.CellEditor from shared objects file]
[Loaded javax.swing.table.TableCellEditor from shared objects file]
[Loaded java.awt.image.RenderedImage from shared objects file]
[Loaded java.awt.image.WritableRenderedImage from shared objects file]
[Loaded java.awt.image.BufferedImage from shared objects file]
[Loaded sun.awt.util.IdentityArrayList from c:\Program Files (x86)\Java\jdk1.7.0_45\jre\lib\rt.jar]
[Loaded java.awt.Window$Type from c:\Program Files (x86)\Java\jdk1.7.0_45\jre\lib\rt.jar]
[Loaded java.util.concurrent.atomic.AtomicBoolean from shared objects file]
[Loaded sun.awt.AWTAccessor$WindowAccessor from c:\Program Files (x86)\Java\jdk1.7.0_45\jre\lib\rt.jar]
[Loaded java.awt.Window$1 from c:\Program Files (x86)\Java\jdk1.7.0_45\jre\lib\rt.jar]
[Loaded sun.awt.AWTAccessor$FrameAccessor from c:\Program Files (x86)\Java\jdk1.7.0_45\jre\lib\rt.jar]
[Loaded java.awt.Frame$1 from c:\Program Files (x86)\Java\jdk1.7.0_45\jre\lib\rt.jar]
[Loaded java.awt.ComponentOrientation from shared objects file]
[Loaded java.awt.Component$3 from c:\Program Files (x86)\Java\jdk1.7.0_45\jre\lib\rt.jar]
[Loaded javax.swing.ImageIcon from shared objects file]
[Loaded MainFrame.Simulation.Simulation from rsrc:./]
[Loaded MainFrame.Optimization.Optimization from rsrc:./]
[Loaded MainFrame.Convergence.Convergence from rsrc:./]
[Loaded java.awt.event.WindowEvent from shared objects file]
[Loaded MainFrame.Menu from rsrc:./]

Here are some JRE8 outputs

[Loaded MainFrame.MainFrame from rsrc:./]
[Loaded java.util.EventListener from c:\Program Files (x86)\Java\jre1.8.0_45\lib\rt.jar]
[Loaded java.awt.event.ActionListener from c:\Program Files (x86)\Java\jre1.8.0_45\lib\rt.jar]
[Loaded javax.swing.Action from c:\Program Files (x86)\Java\jre1.8.0_45\lib\rt.jar]
[Loaded sun.reflect.NativeMethodAccessorImpl from c:\Program Files (x86)\Java\jre1.8.0_45\lib\rt.jar]
[Loaded sun.reflect.DelegatingMethodAccessorImpl from c:\Program Files (x86)\Java\jre1.8.0_45\lib\rt.jar]
[Loaded javax.swing.UIManager from c:\Program Files (x86)\Java\jre1.8.0_45\lib\rt.jar]
[Loaded javax.swing.UIManager$LookAndFeelInfo from c:\Program Files (x86)\Java\jre1.8.0_45\lib\rt.jar]
[Loaded sun.awt.OSInfo from c:\Program Files (x86)\Java\jre1.8.0_45\lib\rt.jar]
[Loaded sun.awt.OSInfo$WindowsVersion from c:\Program Files (x86)\Java\jre1.8.0_45\lib\rt.jar]
[Loaded sun.awt.OSInfo$1 from c:\Program Files (x86)\Java\jre1.8.0_45\lib\rt.jar]
[Loaded sun.awt.OSInfo$OSType from c:\Program Files (x86)\Java\jre1.8.0_45\lib\rt.jar]
[Loaded java.awt.Toolkit from c:\Program Files (x86)\Java\jre1.8.0_45\lib\rt.jar]
[Loaded sun.awt.AWTAccessor$ToolkitAccessor from c:\Program Files (x86)\Java\jre1.8.0_45\lib\rt.jar]
[Loaded java.awt.Toolkit$4 from c:\Program Files (x86)\Java\jre1.8.0_45\lib\rt.jar]
[Loaded sun.awt.AWTAccessor from c:\Program Files (x86)\Java\jre1.8.0_45\lib\rt.jar]
[Loaded java.awt.Toolkit$5 from c:\Program Files (x86)\Java\jre1.8.0_45\lib\rt.jar]
[Loaded java.util.ResourceBundle$Control from c:\Program Files (x86)\Java\jre1.8.0_45\lib\rt.jar]
[Loaded sun.util.CoreResourceBundleControl from c:\Program Files (x86)\Java\jre1.8.0_45\lib\rt.jar]

I runned a Xshare:dump for both JRE7 and JRE8 and I got the following results:

JRE7:

Loading classes to share ... done.
Rewriting and unlinking classes ... done.
Calculating hash values for String objects .. done.
Calculating fingerprints ... done.
Removing unshareable information ... done.
Moving common symbols to metadata section at 0x3a033570 ... done.
Moving vmSymbols to metadata section at 0x3a1d2170 ... done.
Moving the remaining symbols to metadata section at 0x3a1d3478 ... done.
Moved 44361 symbols, 1703760 bytes.
Moving pre-ordered read-only objects to shared space at 0x38a30000 ... done.
Moving read-only objects to shared space at 0x38e129b0 ... done.
Moving string char arrays to shared space at 0x38e20cd8 ... done.
Moving pre-ordered read-write objects to shared space at 0x39430000 ... done.
Moving read-write objects to shared space at 0x399e8fb0 ... done.
Moving String objects to shared space at 0x39a3e920 ... done.
Read-write space ends at 0x39a7dd28, 6610216 bytes.
Updating references to shared objects ... done.

An error has occurred while processing the shared archive file.
Unable to create shared archive file c:\Program Files (x86)\Java\jdk1.7.0_45\jre\bin\client\classes.jsa.
Error occurred during initialization of VM
Unable to use shared archive.

JRE8:

Allocated shared space: 27394048 bytes at 0x14a00000
Loading classes to share ...
Preload Warning: Cannot find javax/swing/JComponent$2
Preload Warning: Cannot find javax/swing/RepaintManager$1$1
Preload Warning: Cannot find javax/swing/plaf/metal/MetalLookAndFeel$MetalLazyValue
Preload Warning: Cannot find javax/swing/plaf/metal/MetalLookAndFeel$MetalLazyValue$1
Preload Warning: Cannot find javax/swing/text/AbstractDocument$InsertStringResult
Preload Warning: Cannot find sun/awt/windows/WToolkit$3$1
Preload Warning: Cannot find sun/java2d/Disposer$2
Preload Warning: Cannot find sun/java2d/d3d/D3DScreenUpdateManager$1
Preload Warning: Cannot find sun/java2d/d3d/D3DScreenUpdateManager$1$1
Loading classes to share: done.
Rewriting and linking classes ...
Rewriting and linking classes: done
Number of classes 2383
    instance classes   =  2369
    obj array classes  =     6
    type array classes =     8
Calculating fingerprints ... done.
Removing unshareable information ... done.
Shared Lookup Cache Table Buckets = 4108 bytes
Shared Lookup Cache Table Body = 50352 bytes
ro space:   5650016 [ 47.7% of total] out of  12582912 bytes [44.9% used] at 0x14a00000
rw space:   5396096 [ 45.6% of total] out of  12582912 bytes [42.9% used] at 0x15600000
md space:    753892 [  6.4% of total] out of   2097152 bytes [35.9% used] at 0x16200000
mc space:     34032 [  0.3% of total] out of    131072 bytes [26.0% used] at 0x16400000
total   :  11834036 [100.0% of total] out of  27394048 bytes [43.2% used]
like image 589
Jsncrdnl Avatar asked Apr 21 '15 14:04

Jsncrdnl


People also ask

Why does it take so long for an app to open on my computer?

The reasons may be software-related problems, such as virus infection, problematic programs, outdated apps, or system file damage. They could also be hardware issues, like a full system partition, an old HDD/computer with poor performance, etc..

How do I make apps open faster on startup?

1) Choose an application that you want to start up quicker. 2) Create a shortcut and place it on the desktop. 3) Right click the shortcut item and click properties. 5) Add /prefetch:1 right after the last " marks in the target field.

Why does my laptop take 5 minutes to start up?

One of the possible reasons why this issue occurs is due to software conflicts. These conflicts pertain to system processes, antivirus software and system application that automatically run in the background when you start Windows.


1 Answers

Maybe the Shared Class Data archive of your installation is missing or corrupted.

You may try as suggested in the documentation under “Regenerating the Shared Archive”

To regenerate the archive, log in as the administrator; in networked situations, log on to a machine of the same architecture as the Java SE installation and ensure that you have permission to write to the installation directory. Then execute the command

java -Xshare:dump Diagnostic information will be printed as the archive is generated.

Note that you can enforce the use of the shared data to get an error message (rather than slowdown) if it fails, as described on the same page:

Manually Controlling Class Data Sharing

The class data sharing feature is automatically enabled when conditions allow it to be used. The following command line options are present primarily for diagnostic and debugging purposes and may change or be removed in future releases.

-Xshare:off
Disable class data sharing.
-Xshare:on
Require class data sharing to be enabled. If it could not be enabled for various reasons, print an error message and exit.
-Xshare:auto
The default; enable class data sharing whenever possible.
like image 150
Holger Avatar answered Nov 15 '22 21:11

Holger