# Java argument help

**URL:** <https://community.unix.com/t/java-argument-help/306422>\
**Category:** Programming\
**Created:** [March 13, 2012, 12:03pm UTC](https://community.unix.com/t/java-argument-help/306422 "2012-03-13T12:03:31Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jacobs.smith](https://community.unix.com/letter_avatar/jacobs.smith/32/6_449c533f586939b6e5f246632a46421f.png) [@jacobs.smith](https://community.unix.com/u/jacobs.smith)\
**Post date:** [March 13, 2012, 12:03pm UTC](https://community.unix.com/t/java-argument-help/306422/1 "2012-03-13T12:03:31Z")

</div>

Hello All,

I have the following code,

```nohighlight
package com.java.tutorial.examples;

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;

public class Swapping {

        /**
         * @param args
         */

	public static void main(String[] args) throws FileNotFoundException, IOException {

                 BufferedReader file1 = new BufferedReader(new FileReader("/path/1.txt"));

                 BufferedReader file2 = new BufferedReader(new FileReader("/path/2.txt"));

                 BufferedWriter writer = new BufferedWriter(new FileWriter("/path/file1_file2_distance.txt"));

                 BufferedWriter writer2 = new BufferedWriter(new FileWriter("/path/file1_file2_d.txt"));

                 int arg1 = Integer.parseInt(args[0]);

                 String s1 = null;
                 String[] s2 = new String[1000];
                 String s3 = null;
                 String[] s4 = new String[1000];
                 String s5=null;
                 String[] s6 = new String[1000];
                 int length1 = 0;
                 int length2 =0;
                 int length3 =0;
                 int length4 =0;

                 while((s1=file1.readLine())!=null)
                 {
                         s2=s1.split("\t");
                         length1 = s2.length;

                         while((s3=file2.readLine())!=null)
                         {
                                 s4=s3.split("\t");
                                 length2 = s4.length;
                                 length3 = Integer.parseInt(s4[1])-Integer.parseInt(s2[1]);
                                 if(s2[0]!=null && s4[0]!=null && s2[0].equalsIgnoreCase(s4[0]))
                                 {
                                 for(int i=0; i< length1;i++)
                                 {
                                         writer.write(s2 + "\t" );
                                 }

                                 for(int j=1; j< length2;j++)
                                 {
                                         writer.write(s4[j] + "\t" );
                                 }
                                 writer.write(Integer.parseInt(s4[1])-Integer.parseInt(s2[1]) + "\t" );
                                 writer.newLine();

                                 }
                         }
file2 = new BufferedReader(new FileReader("/path/2.bed"));
                 }
                 writer.close();

                 BufferedReader file3 = new BufferedReader(new FileReader("/path/file1_file2_distance.txt"));

                 while((s5=file3.readLine())!=null)
                 {
                         s6 = s5.split("\t");

                         length4 = s6.length;

                         if(Integer.parseInt(s6[length4-1])>=-arg1 && Integer.parseInt(s6[length4-1])<=arg1)
                         {
                          	for(int k=0;k<length4;k++)
                                {
                                        writer2.write(s6[k]+ "\t");
                                }
                                 writer2.newLine();
                         }
                 }
                 writer2.close();
        }
}

```

I would like to pass an argument to filter the difference generated between two columns.

I am using

```nohighlight
javac -D 5000 prog.java

```

It is giving an error directory doesnot exist: -D

Can someone tell me how to pass that argument?

Thanks in advance.
