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 8217845
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T12:35:07+00:00 2026-06-07T12:35:07+00:00

My following code does not produce expected output: public static void main(String[] args) throws

  • 0

My following code does not produce expected output:

public static void main(String[] args) throws MalformedURLException {

    Configuration.addDefaultResource("/home/some_user/conf.xml");
    Configuration conf = new Configuration();
    System.out.println(conf);
    System.out.println(conf.get("color"));
    assertThat(conf.get("color"), is("yellow"));
}

The property color is set in conf.xml file as follows:

<property>
        <name>color</name>
        <value>yellow</value>
        <description>Color</description>
</property>

Looks like file conf.xml isn’t getting incorporated in default configuration.

The documentation for Configuration.addDefaultResource(String param) says the param should be in classpath. I don’t understand how to add file to the classpath when I am already giving the program full absolute path.

  • 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-06-07T12:35:09+00:00Added an answer on June 7, 2026 at 12:35 pm

    First observation: I don’t know which version of hadoop you use but the addDefaultResource() has been deprecated for a very long time.

    In the later versions of Hadoop the standard way to accomplish what you want is:

    Configuration conf = new Configuration()
    conf.addResource("path/to/file");
    ...
    

    Regarding the classpath issue, you have to simply place the config file in the classpath. So you have to discover what the classpath is to(it is either an environment var or the one which you set with -classpath option). If you didn’t use the -classpath option and there is no classpath environment variable then it is automatically set to the current directory (“.”)

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

Sidebar

Related Questions

In the following Java code: public static void main(String[] args) { String largeText =
The following code does not produce the expected output. Why? wchar_t* wchar_t_printf_return(wchar_t* formatstring, ...){
Why does the following code Graphics[Raster[{{Hue[1], Hue[1/3]}, {Hue[2/3], Hue[1/6]}}]] not produce any output? In
The following Common Lisp code does not produce the output I would expect it
Problem: The following shell script code does not produce the expected result: # MYSQL,
The following code does not set the comment: string userName = yrtre.etre.423369a9-3e57-42da-934d-dae91f87a1e4; MembershipUser user
Why does the following C# code not produce the equivalent of my Silverlight code?
Short and sweet: Why does the following block of Objective-C code not produce a
The following code does not produce an exception but instead passes the value 4
I've got the following code that does not produce an CA1804 warning (declared variable

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.