Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 660187
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T23:07:42+00:00 2026-05-13T23:07:42+00:00

I have an executable jar Client.jar that requires jndi.properties file. Since the jndi properties

  • 0

I have an executable jar Client.jar that requires jndi.properties file.
Since the jndi properties is not part of the Client.jar, and java -jar ignores the -classpath argument,

How can I execute the jar and let it know where the jndi.properties is?

Thanks

// Edit, error message

java -jar Client2.jar 
Exception in thread "main" javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file:  java.naming.factory.initial
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:645)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
at javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.java:325)
at javax.naming.InitialContext.lookup(InitialContext.java:392)
at com.don.Client.main(Client.java:10)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T23:07:43+00:00Added an answer on May 13, 2026 at 11:07 pm

    We need more information on how the application is told the location of the JNDI properties file.

    Is it expecting the properties file location as a command line argument? If so, you should invoke the command as follows:

    java -jar <jarfile> <arguments>
    

    where the <arguments> include the relevant option giving the JNDI properties file.

    Is it expecting the JNDI properties file as a system property? If so, you should invoke the command as follows:

    java -jar <jarfile> -D<someproperty>=<location>
    

    where the <someproperty> is the name of the relevant property.

    Is it expecting to find property file on the classpath? If so, you should invoke the command something along the following lines:

    java -cp <jarfile>:<directory> <main-class>
    

    where <main-class> is the main class name from the JAR file manifest, and <directory> contains the JNDI properties file with the name expected by the application.

    If the application is properly documented, the preferred way of setting up the JNDI properties file will be in the installation and/or usage documentation.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to have an executable file that will call some other programs. The
I have an executable that depending on the command line switch supplied looks something
I have an executable that is started by a windows service, this program will
I have an executable that defaults to 32-bit. It doesn't have source code and
I have a setup executable that I need to install. When I run it,
So I have this Java project made up of several classes, some external JAR
I have an executable module created by third party. I would like to inject
I'm thinking how to arrange a deployed python application which will have a Executable
I have a Windows executable (whoami) which is crashing every so often. It's called
I have several independent executable Perl, PHP CLI scripts and C++ programs for which

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.