JDK-4251590 : Swing doesn't work when using UNC
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 1.2.0,1.3.0
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_nt
  • CPU: x86
  • Submitted: 1999-07-04
  • Updated: 1999-09-21
  • Resolved: 1999-09-21
Related Reports
Duplicate :  
Description

Name: krT82822			Date: 07/04/99

I am trying to run java code over a network using UNC for my path and
classpath. (i.e. path=\\foo\drive_c\jre\bin, classpath=\\foo\drive_c\classes.)

Run the following simple program using the UNC setup above and you get:
Exception in thread "main" java.lang.Error: can't load javax.swing.plaf.metal.MetalLookAndFeel
at javax.swing.UIManager.initializeDefaultLAF(UIManager.java:826)
at javax.swing.UIManager.initialize(UIManager.java:896)
at javax.swing.UIManager.maybeInitialize(UIManager.java:913)
at javax.swing.UIManager.getUI(UIManager.java:535)
at javax.swing.JPanel.updateUI(JPanel.java:110)
at javax.swing.JPanel.<init>(JPanel.java:70)
at javax.swing.JPanel.<init>(JPanel.java:100)
at javax.swing.JRootPane.createGlassPane(JRootPane.java:225)
at javax.swing.JRootPane.<init>(JRootPane.java:181)
at javax.swing.JFrame.createRootPane(JFrame.java:154)
at javax.swing.JFrame.frameInit(JFrame.java:147)
at javax.swing.JFrame.<init>(JFrame.java:124)
at Test.main(Test.java:7)

import javax.swing.*;

class Test
{
   public static void main(String[] args)
   {
      JFrame frame = new JFrame();
   }
}

Programs that don't use Swing don't appear to be affected. If you map the drive it
works but we want to avoid this because we want to allow our users to install from
a business server without any extra setup.
(Review ID: 53586) 
======================================================================

Name: krT82822			Date: 07/04/99


1.  To reproduce the problem, run the following equivalent:

set JAVAHOME=\\clash\d\kktam\bs5\jrun\win32\1.2
set CLASSPATH=\\clash\d\kktam\jreExperiment\classes
%JAVAHOME%\bin\java.exe  -classpath %CLASSPATH% jreExperiment.CMain


2.  Here is the java source code:

package jreExperiment;
import javax.swing.JFrame;

public class CMain {

  public static void main(String[] args) {
    System.getProperties().list(System.out);


    JFrame theFrame = new JFrame(); // This line causes problems with UNC bootclasspath
    System.exit(0);
  }
}


3.  The exact log of this application:

D:\kktam\jreExperiment>set JAVAHOME=\\clash\d\kktam\bs5\jrun\win32\1.2
D:\kktam\jreExperiment>set BOOTSTRAP=\\clash\d\kktam\bs5\jrun\win32\1.2\lib\rt.jar
D:\kktam\jreExperiment>set CLASSPATH=\\clash\d\kktam\jreExperiment\classes
D:\kktam\jreExperiment>\\clash\d\kktam\bs5\jrun\win32\1.2\bin\java.exe  -classpath \\clash\d\kktam\jreExperiment\classes jreExperiment.CMain
-- listing properties --
java.specification.name=Java Platform API Specification
awt.toolkit=sun.awt.windows.WToolkit
java.version=1.2
java.awt.graphicsenv=sun.awt.Win32GraphicsEnvironment
user.timezone=America/Los_Angeles
java.specification.version=1.2
java.vm.vendor=Sun Microsystems Inc.
user.home=C:\WINNT\Profiles\kktam
java.vm.specification.version=1.0
os.arch=x86
java.awt.fonts=
java.vendor.url=http://java.sun.com/
user.region=US
file.encoding.pkg=sun.io
java.home=\\clash\d\kktam\bs5\jrun\win32\1.2
java.class.path=\\clash\d\kktam\jreExperiment\classes
line.separator=

java.ext.dirs=\\clash\d\kktam\bs5\jrun\win32\1.2\li...
java.io.tmpdir=C:\TEMPos.name=Windows NT
java.vendor=Sun Microsystems Inc.
java.awt.printerjob=sun.awt.windows.WPrinterJob
java.library.path=\\clash\d\kktam\bs5\jrun\win32\1.2\bi...
java.vm.specification.vendor=Sun Microsystems Inc.
sun.io.unicode.encoding=UnicodeLittle
file.encoding=Cp1252
java.specification.vendor=Sun Microsystems Inc.
user.language=en
user.name=kktam
java.vendor.url.bug=http://java.sun.com/cgi-bin/bugreport...
java.vm.name=Classic VM
java.class.version=46.0
java.vm.specification.name=Java Virtual Machine Specification
sun.boot.library.path=\\clash\d\kktam\bs5\jrun\win32\1.2\bin
os.version=4.0
java.vm.version=1.2
java.vm.info=build JDK-1.2-V, native threads, symcjit
java.compiler=symcjit
path.separator=;
file.separator=user.dir=D:\kktam\jreExperiment
sun.boot.class.path=\\clash\d\kktam\bs5\jrun\win32\1.2\li...
Exception in thread "main" java.lang.Error: can't load javax.swing.plaf.metal.Me
talLookAndFeel
        at javax.swing.UIManager.initializeDefaultLAF(UIManager.java:826)
        at javax.swing.UIManager.initialize(UIManager.java:896)
        at javax.swing.UIManager.maybeInitialize(UIManager.java:913)
        at javax.swing.UIManager.getUI(UIManager.java:535)
        at javax.swing.JPanel.updateUI(JPanel.java:110)
        at javax.swing.JPanel.<init>(JPanel.java:70)
        at javax.swing.JPanel.<init>(JPanel.java:100)
        at javax.swing.JRootPane.createGlassPane(JRootPane.java:225)
        at javax.swing.JRootPane.<init>(JRootPane.java:181)
        at javax.swing.JFrame.createRootPane(JFrame.java:154)
        at javax.swing.JFrame.frameInit(JFrame.java:147)
        at javax.swing.JFrame.<init>(JFrame.java:124)
        at jreExperiment.CMain.main(CMain.java:18)


5.  If JAVAHOME does not contain UNC, then there is no problem.

The following runs correctly:

set JAVAHOME=d:\kktam\bs5\jrun\win32\1.2
set CLASSPATH=\\clash\d\kktam\jreExperiment\classes
%JAVAHOME%\bin\java.exe  -classpath %CLASSPATH% jreExperiment.CMain
(Review ID: 53050)
======================================================================

Name: skT88420			Date: 08/25/99


Property files cannot be found in JAR files when
executing with a distant JRE.
We need to install our application only once on a network
and let the customers execute it from a shortcut.
Customers use the distant JRE.

The problem appears where using custom property files
or any Swing component for it uses
javax.swing.plaf.basic.ressources.basic.properties and
maybe javax.swing.plaf.basic.ressources.metal.properties

If property files are copied out of the JAR, everything is OK.
Swing works well with UNC in this case.
So if you solve this problem, it should solve bug 4251590,

because the exception :
Exception in thread "main" java.lang.Error: can't load javax.swing.plaf.metal.MetalLookAndFeel
                                          at javax.swing.UIManager.initializeDefaultLAF(UIManager.java:826)

is in fact due to not being able to find basic.properties in rt.jar.
(see bug 4230563)
(Review ID: 94358)
======================================================================

Comments
WORK AROUND Name: krT82822 Date: 07/04/99 Map the network drive. ====================================================================== Name: skT88420 Date: 08/25/99 get javax.swing.plaf.basic.ressources.basic.properties, javax.swing.plaf.basic.ressources.metal.properties and any custom property file out of JAR files (Review ID: 94358) ======================================================================
11-06-2004

EVALUATION This looks like a duplicate of 4258001 hans.muller@Eng 1999-09-21
21-09-1999