1 Reply Latest reply on May 25, 2002 11:30 AM by Phillip Andrews

    How can I use the jndi.properties file from a JAR file clien

    tse tsong Newbie


      I have compiled a client application into a *.class file that runs fine. However, it produced the following error when I tried to run it as a *.jar file :

      [java] NamingException : Need to specify class name in environment or system property, or as an applet para
      meter, or in an application resource file: java.naming.factory.initial

      I understand that the jndi.properties file has something to do with this. I have included the path to the jndi.properties file in my classpath when I do the run. Is there something else that I missed out ? Does the manifest file need to be modified ?

      thanks for your help.
      Tse Tsong

        • 1. Re: How can I use the jndi.properties file from a JAR file c
          Phillip Andrews Newbie

          I had the same problem.
          This worked for me:=

          System.setProperty ("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");

          System.setProperty ("java.naming.provider.url", "localhost:1099");

          System.setProperty("java.naming.factory.url.pkgs", "org.jboss.naming");

          jndiContext = new InitialContext(System.getProperties());

          p.s. Mine only works if I'm connected to the Internet.
          Good luck,

          Phil Andrews