Terminal values for a program

0

I'm experiencing the following problem by running the following commands on the terminal, java -jar logisim-filename.jar adder-test.circ -tty table I get a table in the terminal, tab delimited, as follows:

00 00 000

01 00 001

10 00 010 etc…

In my program I need these values, but I do not know how from the terminal (what command to run) pick them up and transfer to my program so that I do what is necessary, if someone can tell me if they have how to do it.

Edition:

My program takes a .txt file and removes this data as if it were data from a true table, except that the .txt reading is done like this:

public class tt2vcd {

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


       //Leitura do arquivo gerado pelo logisim
       String fileName = args[0];           
       FileReader entrada = new FileReader(fileName);
       BufferedReader entradaFormatada = new BufferedReader(entrada);
    //Denominada uma String arquivo para manipular o nome do Arquivo do logisim
    String arquivo = fileName;

    //Trocado o tipo de arquivo, não sendo mais .txt, e sim .vcd
    arquivo = arquivo.replace("txt","vcd");

    //definida a leitura do arquivo caractere por caractere
            int c =  entradaFormatada.read();
 //realiza o processo de gravação...
}}

So what I want to do is from the terminal, get this double treatment, using a tag, so when the guy generates the truth table in the terminal, I extract the information through the terminal, and when the guy wants to use the .txt I extract from .txt.

I'm using Windows but I have access to linux too.

    
asked by anonymous 02.05.2018 / 01:22

1 answer

1

Only with this information is it difficult to be 100% assertive, but come on:

To pass arguments via the command line (terminal), you can pass them separated by space. Something like:

java -jar sua-app.jar 00 00 000 01 00 001

These values are received as parameters in the main method through the String array (in this case, called args ). To read this information, just iterate through the array:

public static void main(String[] args) {
    for(final String arg : args) {
        System.out.println(arg);
    }
}

For Java to find your main class you need to tell what this class is through file MANIFEST.MF .

    
03.05.2018 / 14:23