There are no stupid questions, just stupid people...

Wes Mckean writes:
 > Ok, so this isn't exactly a jBoss question, but...
 > 
 > I am patterning a JMX server on jBoss' architecture, and I can't get my
 > server to find the MLet configuration file when I do the following:
 > 
 >      URL mletURL =
 > getClass().getClassLoader().getResource("myserver.conf");
 > 
 > It does work with:
 > 
 >      URL mletURL = getClass().getResource("myserver.conf");
 > 
 > Any insight is appreciated.

>From the API doc for java.lang.Class.getResource:

  This method delegates the call to its class loader, after making these
  changes to the resource name: if the resource name starts with "/", it
  is unchanged; otherwise, the package name is prepended to the resource
  name after converting "." to "/". If this object was loaded by the
  bootstrap loader, the call is delegated to ClassLoader.getSystemResource.

So

  getClass.getResource( "myserver.conf" );

is equivalent to

  getClass.getResource( "com.myorg.myproject.myserver.conf" );

Tom

P.S. The stupid people are the ones who don't ask questions.
-- 
Tom Cook - Software Engineer

"We rarely find that people have good sense unless they agree
 with us."
                - Francois, Duc de la Rochefoucauld

LISAsoft Pty Ltd - www.lisa.com.au

--------------------------------------------------
38 Greenhill Rd.          Level 3, 228 Pitt Street
Wayville, SA, 5034        Sydney, NSW, 2000

Phone:   +61 8 8272 1555  Phone:   +61 2 9283 0877
Fax:     +61 8 8271 1199  Fax:     +61 2 9283 0866
--------------------------------------------------


--
--------------------------------------------------------------
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Problems?:           [EMAIL PROTECTED]

Reply via email to