Results 1 to 11 of 11
Thread: Running batch files in java
- 12-04-2008, 12:17 PM #1
Member
- Join Date
- Dec 2008
- Posts
- 4
- Rep Power
- 0
- 12-04-2008, 12:23 PM #2
Senior Member
- Join Date
- Jun 2008
- Posts
- 2,366
- Rep Power
- 7
Runtime.exec and java.util.Timer
- 12-04-2008, 12:25 PM #3
Member
- Join Date
- Dec 2008
- Posts
- 4
- Rep Power
- 0
Can u please explain?
import java.io.*;
class RunBat{
public static void main(String arg[]){
try{
String command = "cmd /C start C:/google.bat ";
Runtime rt = Runtime.getRuntime();
rt.exec(command);
}catch (IOException e) {
e.printStackTrace();
}
}
}
I have code for running only one batch file, but i need to run two batch files in an interval of one hour.
- 12-04-2008, 12:40 PM #4
Senior Member
- Join Date
- Jun 2008
- Posts
- 2,366
- Rep Power
- 7
Read the API docs for java.util.Timer. If you see a Class name that you don't recognise, that should be the first thing you do.
- 12-04-2008, 01:58 PM #5
Links...
- Java tutorial:
- Java API link:
- Specific Timer API link:
Luck,
CJSLChris S.
Difficult? This is Mission Impossible, not Mission Difficult. Difficult should be easy.
- Java tutorial:
- 12-04-2008, 02:09 PM #6
Senior Member
- Join Date
- Jun 2008
- Posts
- 2,366
- Rep Power
- 7
Someone at the Sun Forums has already given him some code.
- 12-04-2008, 02:23 PM #7
Dang...
Cross poster...
New To Java - Running batch files using java
That really angers me ... too bad
Thank masijade for letting me know about the cross post.
CJSLChris S.
Difficult? This is Mission Impossible, not Mission Difficult. Difficult should be easy.
- 12-04-2008, 07:16 PM #8
Senior Member
- Join Date
- Jun 2008
- Posts
- 2,366
- Rep Power
- 7
Well, to tell you the truth, I don't really see anything wrong with posting on multiple sites (but I do for posting in multiple forums on the same site), as long as the OP keeps all threads "up-to-date". Which this one, did not.
- 12-04-2008, 07:23 PM #9
hhhmmm...
Not so sure I agree...
- If everything & everybody were perfect/responsible, yeah I would probably agree, but....
- Since history has taught that we are just beings (notice the missing "human" part), and are VERY imperfect, I don't agree, therefore...
- My vision would be to stick to one forum until a solution is obtained. If a satisfactory answer/solution is not obtained, then go to another forum.
Thanks anyway...
CJSLChris S.
Difficult? This is Mission Impossible, not Mission Difficult. Difficult should be easy.
- 12-04-2008, 08:48 PM #10
Senior Member
- Join Date
- Jun 2008
- Posts
- 2,366
- Rep Power
- 7
Which, of course, is why I said as long as they keep all others "up-to-date" (which many, many, many people won't).
Now, for something simple, like this, I wouldn't do it either. But for something much more complicated, it makes sense, as, although many users are members of many forums, each forum will have a few good posters that are not members of other forum, and on something complicated I would want the widest possible audience (of course, that would mean I start on Sun's forums and stay there alone, for a while, and then, if I am not satisfied post on multiple other platforms, but with all info gleaned to that point and periodic updates on all of them).
P.S. Members, don't get me wrong, I am not saying this forum is not good, but I would trust the vendors own forum site for a product to have more knowledgeable members than most others. No insult intended. ;-)
Edit: And hopefully none taken. ;-)
- 12-04-2008, 09:26 PM #11
Interesting...
... and yes I guess that I would go first to Sun's forum (it does has more traffic), but the issue is the cross posting. Posters probably don't realize the effects of cross posting... they're only thinking about their java problem.
On a positive side, the volunteer responses here on the Java forums is much nicer than the Sun forums (they tend to be more demanding and less forgiving).
I suggested to the mods a sticky post with recommendations about the forum use and among those recommendations was to avoid cross posting. For some reason, which I never understood, the suggestion didn't stick (the admins didn't like it... go figure).
CJSLChris S.
Difficult? This is Mission Impossible, not Mission Difficult. Difficult should be easy.
Similar Threads
-
Batch Files in java
By coco in forum New To JavaReplies: 3Last Post: 12-05-2008, 01:30 PM -
Batch file to Run Java application
By nitishlnt in forum EclipseReplies: 1Last Post: 10-24-2008, 07:46 PM -
running java
By Winarto in forum New To JavaReplies: 1Last Post: 08-22-2008, 06:40 AM -
running .class files on a website
By jklsemicolon in forum NetworkingReplies: 10Last Post: 08-08-2008, 06:21 AM -
conversion of java .class files to .java files
By kotturupraveen in forum New To JavaReplies: 2Last Post: 06-09-2008, 12:58 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks