お客様のマシンでの Java への依存を避けるために、アプリケーション Jar と JRE もパックしているデスクトップ アプリケーションがあります。
ただし、問題は、顧客がすでに Machine に Java をインストールしている場合です。一部のクラスの Java バージョンの依存関係が原因で、クラス定義の例外がないなどの問題に直面しています。
ここで私の質問は、アプリケーションがパッケージ化された JRE を常に使用してアプリケーションを起動し、インストールされている場合はシステム JRE を使用しないようにする方法です。
C:\Users\User\Nokia\1830 PSS-APA>jre\bin\java -jar apat.jar
Exception in thread "ApaPowerControlChart" java.lang.NoClassDefFoundError: Could
not initialize class sun.font.SunFontManager
at sun.font.FontDesignMetrics.getMetrics(Unknown Source)
at sun.swing.SwingUtilities2.getFontMetrics(Unknown Source)
at javax.swing.JComponent.getFontMetrics(Unknown Source)
at javax.swing.plaf.basic.BasicLabelUI.getPreferredSize(Unknown Source)
at javax.swing.JComponent.getPreferredSize(Unknown Source)
at java.awt.GridLayout.preferredLayoutSize(Unknown Source)
at java.awt.Container.preferredSize(Unknown Source)
at java.awt.Container.getPreferredSize(Unknown Source)
at javax.swing.JComponent.getPreferredSize(Unknown Source)
at java.awt.BorderLayout.preferredLayoutSize(Unknown Source)
at java.awt.Container.preferredSize(Unknown Source)
at java.awt.Container.getPreferredSize(Unknown Source)
at javax.swing.JComponent.getPreferredSize(Unknown Source)
at java.awt.BorderLayout.preferredLayoutSize(Unknown Source)
at java.awt.Container.preferredSize(Unknown Source)
at java.awt.Container.getPreferredSize(Unknown Source)
at javax.swing.JComponent.getPreferredSize(Unknown Source)
at javax.swing.JRootPane$RootLayout.preferredLayoutSize(Unknown Source)
at java.awt.Container.preferredSize(Unknown Source)
at java.awt.Container.getPreferredSize(Unknown Source)
at javax.swing.JComponent.getPreferredSize(Unknown Source)
at java.awt.BorderLayout.preferredLayoutSize(Unknown Source)
at java.awt.Container.preferredSize(Unknown Source)
at java.awt.Container.getPreferredSize(Unknown Source)
at java.awt.Window.pack(Unknown Source)
at com.nokia.APA.Chart.ApaPowerControlChart.display(Unknown Source)
at com.nokia.APA.Chart.ApaPowerControlChart$1.run(Unknown Source)
Exception in thread "ApaPowerControlChart" java.lang.NoClassDefFoundError: Could
not initialize class sun.font.SunFontManager
at sun.font.FontDesignMetrics.getMetrics(Unknown Source)
at sun.swing.SwingUtilities2.getFontMetrics(Unknown Source)
at javax.swing.JComponent.getFontMetrics(Unknown Source)
at javax.swing.plaf.basic.BasicLabelUI.getPreferredSize(Unknown Source)
at javax.swing.JComponent.getPreferredSize(Unknown Source)
at java.awt.GridLayout.preferredLayoutSize(Unknown Source)
at java.awt.Container.preferredSize(Unknown Source)
at java.awt.Container.getPreferredSize(Unknown Source)
at javax.swing.JComponent.getPreferredSize(Unknown Source)
at java.awt.BorderLayout.preferredLayoutSize(Unknown Source)
at java.awt.Container.preferredSize(Unknown Source)
at java.awt.Container.getPreferredSize(Unknown Source)
at javax.swing.JComponent.getPreferredSize(Unknown Source)
at java.awt.BorderLayout.preferredLayoutSize(Unknown Source)
at java.awt.Container.preferredSize(Unknown Source)
at java.awt.Container.getPreferredSize(Unknown Source)
at javax.swing.JComponent.getPreferredSize(Unknown Source)
at javax.swing.JRootPane$RootLayout.preferredLayoutSize(Unknown Source)
at java.awt.Container.preferredSize(Unknown Source)
at java.awt.Container.getPreferredSize(Unknown Source)
at javax.swing.JComponent.getPreferredSize(Unknown Source)
at java.awt.BorderLayout.preferredLayoutSize(Unknown Source)
at java.awt.Container.preferredSize(Unknown Source)
at java.awt.Container.getPreferredSize(Unknown Source)
at java.awt.Window.pack(Unknown Source)
at com.nokia.APA.Chart.ApaPowerControlChart.display(Unknown Source)
at com.nokia.APA.Chart.ApaPowerControlChart$1.run(Unknown Source)
Exception in thread "ApaPerformanceChart" java.lang.NoClassDefFoundError: Could
not initialize class sun.font.SunFontManager
at sun.font.FontDesignMetrics.getMetrics(Unknown Source)
at sun.swing.SwingUtilities2.getFontMetrics(Unknown Source)
at javax.swing.JComponent.getFontMetrics(Unknown Source)
at javax.swing.plaf.basic.BasicTabbedPaneUI.getFontMetrics(Unknown Sourc
e)
at javax.swing.plaf.basic.BasicTabbedPaneUI.calculateMaxTabWidth(Unknown
Source)
at javax.swing.plaf.basic.BasicTabbedPaneUI$TabbedPaneLayout.calculateSi
ze(Unknown Source)
at javax.swing.plaf.basic.BasicTabbedPaneUI$TabbedPaneLayout.preferredLa
youtSize(Unknown Source)
at java.awt.Container.preferredSize(Unknown Source)
at java.awt.Container.getPreferredSize(Unknown Source)
at javax.swing.JComponent.getPreferredSize(Unknown Source)
at java.awt.BorderLayout.preferredLayoutSize(Unknown Source)
at java.awt.Container.preferredSize(Unknown Source)
at java.awt.Container.getPreferredSize(Unknown Source)
at javax.swing.JComponent.getPreferredSize(Unknown Source)
at javax.swing.JRootPane$RootLayout.preferredLayoutSize(Unknown Source)
at java.awt.Container.preferredSize(Unknown Source)
at java.awt.Container.getPreferredSize(Unknown Source)
at javax.swing.JComponent.getPreferredSize(Unknown Source)
at java.awt.BorderLayout.preferredLayoutSize(Unknown Source)
at java.awt.Container.preferredSize(Unknown Source)
at java.awt.Container.getPreferredSize(Unknown Source)
at java.awt.Window.pack(Unknown Source)
at com.nokia.APA.Chart.ApaPerformanceChart.display(Unknown Source)
at com.nokia.APA.Chart.ApaPerformanceChart$1.run(Unknown Source)
Exception in thread "ApaChannelTuningChart" java.lang.NoClassDefFoundError: Coul
d not initialize class sun.font.SunFontManager
at sun.font.FontDesignMetrics.getMetrics(Unknown Source)
at sun.swing.SwingUtilities2.getFontMetrics(Unknown Source)
at javax.swing.JComponent.getFontMetrics(Unknown Source)
at javax.swing.plaf.basic.BasicTabbedPaneUI.getFontMetrics(Unknown Sourc
e)
at javax.swing.plaf.basic.BasicTabbedPaneUI.calculateMaxTabWidth(Unknown
Source)
at javax.swing.plaf.basic.BasicTabbedPaneUI$TabbedPaneLayout.calculateSi
ze(Unknown Source)
at javax.swing.plaf.basic.BasicTabbedPaneUI$TabbedPaneLayout.preferredLa
youtSize(Unknown Source)
at java.awt.Container.preferredSize(Unknown Source)
at java.awt.Container.getPreferredSize(Unknown Source)
at javax.swing.JComponent.getPreferredSize(Unknown Source)
at javax.swing.JRootPane$RootLayout.preferredLayoutSize(Unknown Source)
at java.awt.Container.preferredSize(Unknown Source)
at java.awt.Container.getPreferredSize(Unknown Source)
at javax.swing.JComponent.getPreferredSize(Unknown Source)
at java.awt.BorderLayout.preferredLayoutSize(Unknown Source)
at java.awt.Container.preferredSize(Unknown Source)
at java.awt.Container.getPreferredSize(Unknown Source)
at java.awt.Window.pack(Unknown Source)
at com.nokia.APA.Chart.ApaChannelTuningChart.display(Unknown Source)