Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8165312

CLASSPATH is ignored when using java -jar option

XMLWordPrintable

    • jar
    • x86
    • os_x

      FULL PRODUCT VERSION :
      java version "1.8.0_66"
      Java(TM) SE Runtime Environment (build 1.8.0_66-b17)
      Java HotSpot(TM) 64-Bit Server VM (build 25.66-b17, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      Darwin DRAMPULL-M-H018 15.6.0 Darwin Kernel Version 15.6.0: Thu Jun 23 18:25:34 PDT 2016; root:xnu-3248.60.10~1/RELEASE_X86_64 x86_64

      EXTRA RELEVANT SYSTEM CONFIGURATION :
      This also occurs on CENTOS
      Linux xxx1 2.6.32-573.3.1.el6.x86_64 #1 SMP Mon Aug 10 09:44:54 EDT 2015 x86_64 x86_64 x86_64 GNU/Linux

      A DESCRIPTION OF THE PROBLEM :
      Assume I have a.jar which has a manifest that points to net.example.Main
      Assume I have b.jar which has a service locator for sun.net.spi.NameServiceDescriptor

      export CLASSPATH=a.jar:b.jar
      java -jar a.jar
      This will not use the DNS resolver in b.jar

      java net.example.Main
      This will properly use the DNS resolver in b.jar

      The problem is the -jar case seems to be ignoring the b.jar when the Service Locator pattern is applied to replace the DNS resolver.


      REPRODUCIBILITY :
      This bug can be reproduced always.

            jlahoda Jan Lahoda
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: