Entrada de arquivos com o args[]

3 respostas
T

Ola pessoal, estou com dúvida, quem puder me ajudar eu agradeço..

é o seguinte, eu preciso rodar um programa, que precisa entrar com 3 argumentos pelo args[], um é um arquivo .ini, outro um número inteiro e o outro um arquivo.txt , porém não estou conseguindo especificar estes argumentos, estou usando o netbeans 6.9.1

um pedaço do código:
public static void main(String[] args) throws Exception {

    // Prepare arguments
    if (args.length == 0 || Announce.isHelp(args[0])) {
      Announce.help("     sofie.parsing.Parser [<ini-file>] [<start>] <files>...\n", "Parses the files and stores the patterns in the database.",
          "<ini-file>    an initialization file that defines the database and other parameters.", "              Defaults to sofie.ini .",
          "<start>       the number of the file to start with if interrupted (defaults to 1)",
          "<files>       a list of files (possibly given with wildcards) that will be parsed.");
    }
    List<String> filenames = new ArrayList<String>(Arrays.asList(args));
    File iniFile = new File("sofie.ini");
    if (args[0].endsWith(".ini")) {
      iniFile = new File(filenames.get(0));
      filenames.remove(0);
    }
    int start = 1;
    if (NumberParser.isInt(filenames.get(0))) {
      start = NumberParser.getInt(filenames.get(0));
      filenames.remove(0);
    }
    Parser parser=new Parser(iniFile, start > 1);
    parser.parse(filenames, start);
    parser.close();

Eu coloco os argumentos clicando no projeto com botão direito, propriedades, executar e listo os argumentos, porém não dá certo
eu coloco: sofie.ini 1 testdoc.txt que são os argumentos que tenho que por

alguém poderia me dar uma ajuda?
valeu

3 Respostas

otaviojava

voce selecionou sua configuração de args conforme a figura ?
http://img831.imageshack.us/i/tempqj.png/

T

Sim
eu fiz isso:
http://img12.imageshack.us/i/argsn.jpg/

otaviojava

Estranho.
Por vida das dúvidas.
crie um novo com um novo nome e coloca as suas configurações vê se dar certo.

Criado 20 de fevereiro de 2011
Ultima resposta 20 de fev. de 2011
Respostas 3
Participantes 2