0

In my ANJI (http://anji.sourceforge.net/) java project, I have two java file in package com.anji.neat.

One file names evolver.java which needs one program argument. The output champ-id from evolver.java is to be added as args[1] along with the previous argument fed to evolver.java

How can I add this output to Program Arguments without manually adding it? Plus is it possible that I execute these two java files in one run?

I know the question is complex, but someone kindlu help. I am new to java, so do not get things.

2 Answers 2

2

I would suggest that you have main method only in one file, lets say in evolver.java. Add a normal method in your second file which takes two arguments, first argument is the command line argument received in evlover.java and second argument is the champ-id. Run your program by calling the main method of evolver.java. Process the command line argument and generate the champ-id. And after that call the method of your second class by passing both the arguments.

Sign up to request clarification or add additional context in comments.

Comments

0

It would become something "ugly" like:

public static void main(String[] args) {
    if (args.length == 1) {
       String extraArg;
       ...;
       args = new Strinng[] { args[0], nextArg };
       // main(args); return;
    }
    ...
}

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.