views:

11

answers:

0

hello all,

I am trying to use a software for converting one file format to another, and that I usually use on command line. The input for this software is a file with the content that I want to transform. I am trying to use this in my webservice. Can I use FileWriter and create a File into which I want to write the contents to be transformed ? Where will this file be created ?? (I actually created a Dynamic Web Project in Eclipse and am going about building the webservice) Will it at all be created. I don't see one being created. Can I make system calls (in this case I want to use the command to call that software) in the webservice ?

part of my code is here.

        FileWriter inchifile= new FileWriter(new File("inchifile.inchi"));
        Writer inchiwriter=new BufferedWriter(inchifile);
        inchiwriter.write(InChIstring);
        inchiwriter.close();

        Process p = Runtime.getRuntime().exec("babel --gen3D inchifile.inchi -ocml");


        BufferedReader reader=new BufferedReader(new InputStreamReader(p.getInputStream())); 
        String line=reader.readLine(); 
        while(line!=null) 
        { 
            //System.out.println(line); 
            output = output + line;
            line=reader.readLine(); 
        } 
        p.waitFor();
        System.exit(0);