It's worth working out why your debugger doesn't work...it really should
and is very useful.

Anyway, it could be that your problem is that you don't call p.waitFor()
after starting the process - this is because when you call
Runtime.exec() it runs the command in a separate process, and your code
may complete before that process has finished its work.

HTH
Paul

Scientist wrote:
> I've written this code now:
>
>     public static void generateXLS()
>     {
>         try {
>         FileWriter schrijver = new FileWriter("c:\\test.txt");
>         String[] command = { "C://exports//convert.bat" };
>         Process p = Runtime.getRuntime().exec(command);
>            BufferedReader in = new BufferedReader(
>                                 new InputStreamReader(p.getInputStream
> ()));
>             String line = null;
>             while ((line = in.readLine()) != null) {
>                 schrijver.append(line);
>            }
>            schrijver.flush();
>              schrijver.close();
>         } catch (IOException e) {
>            e.printStackTrace();
>        }
> }
>
> When I use Netbeans, the textfile contains the batch commands. Trying
> the same code in Eclipse, the textfile remains empty. It really seems
> like the batch isn't triggered... Debugger doesn't work on my project,
> don't ask why :(
>
> On Apr 29, 3:59 pm, Ian Bambury <[email protected]> wrote:
>   
>> The thing is, you have to work out where the failure is happening.
>> If you know that the batch file isn't being called, then it must be failing
>> before that (by 'failing' I don't just mean error, but include logic errors
>> that mean things don't get called).
>>
>> Personally, I'd put an alert in the routine that does the RPC call just
>> before you make the call. If you see that, then you can start checking the
>> server-side code, if you don't then you can move the alert back from the RPC
>> until you find a place where it is actually executed and see what is going
>> wrong there.
>>
>> It *might* be a GWT problem, but you really need to determine what is going
>> wrong and where. A batch file not running on the server is more likely to be
>> a logic error (therefore a 'Java programming' problem rather than a GWT
>> problem.)
>>
>> Ian
>>
>> http://examples.roughian.com
>>
>> 2009/4/29 Scientist <[email protected]>
>>
>>
>>
>>
>>
>>     
>>> My experience is very little, my source for checking is the batch file
>>> self. In NetBeans, the batch gets executed perfectly. The batch is
>>> used to convert a .csv file into a .xls, and delete the .csv. I just
>>> can't imagine why the batch would be the problem if it runs well in
>>> another development enviroment.
>>>       
>>> On Apr 29, 1:36 pm, Ian Bambury <[email protected]> wrote:
>>>       
>>>> OK.
>>>>         
>>>> I don't know how much experience you have, but my first question would
>>>>         
>>> be:
>>>       
>>>> How do you know it hasn't run - i.e. where do you look for a result?
>>>>         
>>>> Ian
>>>>         
>>>> http://examples.roughian.com
>>>>         
>>>> 2009/4/29 Scientist <[email protected]>
>>>>         
>>>>> On Apr 29, 1:08 pm, Ian Bambury <[email protected]> wrote:
>>>>>           
>>>>>> Why do you think this is related to GWT?
>>>>>>             
>>>>>> Ian
>>>>>> Cause it's working perfectly in Netbeans, and the compile gives no
>>>>>>             
>>>>> errors.
>>>>>           
>>>>>> http://examples.roughian.com
>>>>>>             
>>>>>> 2009/4/29 Scientist <[email protected]>
>>>>>>             
>>>>>>> Hi guys,
>>>>>>>               
>>>>>>> I have a REALLY strange problem. This is the function I have:
>>>>>>>               
>>>>>>> public static void generateXLS() {
>>>>>>>        try {
>>>>>>>            String[] command = { "cmd.exe", "/C", "Start", "C://
>>>>>>> exports//convert.bat" };
>>>>>>>            Process p = Runtime.getRuntime().exec(command);
>>>>>>>            BufferedReader in = new BufferedReader(
>>>>>>>                                new
>>>>>>>               
>>> InputStreamReader(p.getInputStream
>>>       
>>>>>>> ()));
>>>>>>>            String line = null;
>>>>>>>            while ((line = in.readLine()) != null) {
>>>>>>>                System.out.println(line);
>>>>>>>           }
>>>>>>>        } catch (IOException e) {
>>>>>>>           e.printStackTrace();
>>>>>>>       }
>>>>>>> }
>>>>>>>               
>>>>>>> This is written on the serverside. The function is fired by a
>>>>>>>               
>>> previous
>>>       
>>>>>>> function, that works. The batch won't trigger for some reason,
>>>>>>>               
>>> though.
>>>       
>>>>>>> The strangest part is: when I copy/paste the same code in NetBeans,
>>>>>>>               
>>> it
>>>       
>>>>>>> works perfect. I've already tried this line instead of above:
>>>>>>>               
>>> String[]
>>>       
>>>>>>> command = { "cmd.exe", "/C", "Start", "C:\\exports\\convert.bat" };
>>>>>>> without any result. I'm not getting compiling errors, it just won't
>>>>>>> trigger the batch while executing the application. I'm using
>>>>>>>               
>>> Eclipse,
>>>       
>>>>>>> GWT and Maven.
>>>>>>>               
>>>>>>> Please help!!!- Hide quoted text -
>>>>>>>               
>>>>>> - Show quoted text -- Hide quoted text -
>>>>>>             
>>>> - Show quoted text -- Hide quoted text -
>>>>         
>> - Show quoted text -
>>     
> >
>
>   

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to