What's the correct parameter value of System.getenv("OUTPUT_PATH")?

what w
whats app
what does
whats the meaning of
how to pronounce what

I'm joining Hackerrank for the first time. Just for some practise purposes. Then, I found this line

BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter(System.getenv("OUTPUT_PATH")));

and pretty confused about what's the correct replacement for the "OUTPUT_PATH". Because the code was copied into my IDE (Eclipse) I read the documentation but none of the reserved values suited. They all throwed NPE.

What's the correct parameter value of the System.getenv("..") in my case?

In case you need the full code:

import java.io.*;
import java.math.*;
import java.text.*;
import java.util.*;
import java.util.regex.*;
import javax.swing.JOptionPane;
public class Solution {

     * Complete the simpleArraySum function below.
    static int simpleArraySum(int[] ar) {
        return 2;


    private static final Scanner scanner = new Scanner(System.in);

    public static void main(String[] args) throws IOException {
        //name − This is the name of the environment variable.
        BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter(System.getenv("OUTPUT_PATH")));

        int arCount = Integer.parseInt(scanner.nextLine().trim());

        int[] ar = new int[arCount];

        String[] arItems = scanner.nextLine().split(" ");

        for (int arItr = 0; arItr < arCount; arItr++) {
            int arItem = Integer.parseInt(arItems[arItr].trim());
            ar[arItr] = arItem;

        int result = simpleArraySum(ar);



As I said in the comments, you're not supposed to replace it. That's an environment variable in the shell that is used to run your solution.

Seeing as the value of the variable is passed to FileWriter, this means that it represents the name of a file.

You can replicate it in a terminal by running your program with the command:

env OUTPUT_PATH=/path/to/some/file java Solution

This will start a new shell which contains a variable called OUTPUT_PATH pointing to a file called /path/to/some/file and when the program starts, the file name will be used

What, a punishment or reprimand (esp in the phrase give (a person) what for) See full dictionary entry for what. Quickly send and receive WhatsApp messages right from your computer.

I know that this question is bit old, but maybe somebody will have benefits from this answer...

This line:

BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter(System.getenv("OUTPUT_PATH")));

reads the environment variable defined in Hackerrank runtime/testing environment to determine the place where results will be stored for further analysis.

In order to use exactly the same code, you have to create this variable on your system and use it, or change to store results on different place (as it is already explained in previous answers and comments).

But, ...

Since this is used for a Hackerrank solving, I think it is better to have all outputs redirected to system.out instead of file, because it is far more useful to see results at runtime (or debug) in the IDE console rather than places it in a file.

So, this line is better to change on this way:

BufferedWriter bufferedWriter = new BufferedWriter(new OutputStreamWriter(System.out));

which will stream your BufferedReader to System.out.

In that case You will have same output as it is on Hackerrank test cases, but in your IDE console instead in file.

What for definition and meaning, what as a pronoun, it can be the subject, object, or complement of a verb. It can also be the object of a preposition. noun the true nature or identity of something, or the sum of its characteristics: a lecture on the whats and hows of crop rotation.

That "OUTPUT_PATH" is an environmental variables. You have to declare that variable in your operating system to use it. Generally website like hackerrank do it because learning the path of there system is not good for security I guess. You can test your code in IDE but the environmental variables will be not there you need to declare. I hope it helped you for your confusion.

What, what also have various functions. It can be used as a adjective, an adverb, a pronoun, or an interjection. what definition: 1. used to ask for information about people or things: 2. used in questions that show you are…. Learn more.

The question is already answered with a proper explanation. I am just adding the steps that you can simply use if your IDE is IntelliJ IDEA.

Step 1: When you run any main class in IDE, you can see there will be an option called Edit Configurations like this

Step 2: Click on Edit Configurations. On click, you will see this.

Step 3: Click on 3 dots that are circled in the above image. On click, you will see this.

Step 4: Click on + symbol (as circled in the image) and add these environment variables as shown in the image. Once done click on the Apply button and you should be good to run your program.

This would be no different than the Hackerrank environment. Hope this helps.

What Part of Speech is “WHAT”, I will do what I can to help you. TranslationsEdit. show ▽what? (interrogative pronoun)  whatever: adverb at all , of any description , of any kind or sort , whatsoever , whichever

What's dictionary definition, Quickly send and receive WhatsApp messages right from your computer. WhatsApp Messenger: More than 2 billion people in over 180 countries use WhatsApp to stay in touch with friends and family, anytime and anywhere. WhatsApp is free and offers simple, secure, reliable messaging and calling, available on phones all over the world.

what, Coronavirus: Use WhatsApp to stay connected with your community and trusted sources of information. Learn More >. en. Select your language. azərbaycan  The ORIGINAL and OFFICIAL "What What (In the Butt)" video! Samwell will CALL your friends and family! Go here: http://officialsamwell.com/live-call/ This is

WhatsApp Web, what definition: 1. used to ask for information about people or things: 2. used in questions that show you are…. Learn more. See your real public IPv4 and IPv6 address. Make sure your VPN or Proxy are masking your IP address details. We provide IP address tools that allow users to perform an Internet Speed Test, IP address lookup, proxy detection, IP Whois Lookup, and more.

  • You're not supposed to replace it. That's an environment variable in the shell that is used to run your solution
  • Somewhere on the operating system, someone must define a variable called "OUTPUT_PATH". At runtime, your program looks at this value to decide where to write the file to.
  • Hi I understand. But, what if I want to try to run the code in my IDE instead? For example I can't figure it out some classes needed for particular questions, then I will need the help of my IDE.
  • Your code will still retrieve the environment variable from your system when run from an IDE.
  • What IDE do you use?
  • @Plain_Dude_Sleeping_Alone remember to compile the program first with javac Simple.java
  • Hi, I tried new BufferedWriter(new FileWriter(System.getenv("C:/JavaDevelopment/ujian/src/try.txt")));, I've created the file n for some reasons it still throws NPE. But let me figure it out first.
  • @Plain_Dude_Sleeping_Alone System.getenv("C:/JavaDevelopment/ujian/src/try.txt") will definitely fail unless you have defined an environment variable with the name C:/JavaDevelopment/ujian/src/try.txt
  • Ah, crab legs. I just modified it to BufferedWriter(new FileWriter(("src/try.txt"))) and it works. Thank you very much for the explanation.
  • @Plain_Dude_Sleeping_Alone, note that the name of the variable is different from it's value. The name is what System.getenv(...) wants as a parameter, but the value is what you want System.getenv(...) to return to your new FileWriter(...)