• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

java programs & Windows batch files

 
Renu, Vairagade
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
I want to write a Window .bat file (batch file) that executes a java program. I've written one batch file(see below), but it does not execute java program. What's wrong?
reporting.bat
---------------------------------------------------
copy C:\Report_Input.TXT C:\back_up_reports
java TransformFile1
copy Output_file.TXT C:\back_up_reports

------------------
V Renu
 
Mirko Froehlich
Ranch Hand
Posts: 114
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There could be many reasons. Do you get any error messages?
Is the "java" executable in your path, i.e. does your system find it when you open a command prompt and type in "java"?
What happens when you start the Java application from the command line without using a batch file? It should either work or give you an error message. Maybe you aren't calling it from the right directory, the Java class might be packaged but you don't specify the package on the command line, some required packages might be missing from the classpath, etc. Post your error message and I'll try to help you.
-Mirko
 
Renu, Vairagade
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My batch file works finely, when executed from command line, executes the java program properly, gives no error message. But that's doesn't solve my problem. Actually, I am using an application called WebTrends log Analyzer(webtrends.com), which generates certain statical reports on websites. It gives one option called Post-processing, which allows to excute a specified .exe or .bat file just after report-generation. I am using it & want the java program TransformFile1 to be executed through the .bat file. But that doesn't happen with WebTrends Log Analyzer.
------------------
V Renu
 
Carl Trusiak
Sheriff
Posts: 3341
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The BAT file should change directory to the location of th class file. Even if the bat is in the same diectory, if you double click on it from explorer, the working directory is the first directory that your cmd shell opens in.
The other thing you could do is place the directory (or jar file) where that class exists in your classpath.
------------------
Hope This Helps
Carl Trusiak
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic