Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

java program & 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
 
Jim Yingst
Wanderer
Sheriff
Posts: 18671
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Run your bat from the DOS command prompt, and look at what exactly the error message says. If you can't figure it out, then report the message here. As a guess though, check your system variables. Does PATH include the directory for the java.exe file? Does CLASSPATH include the directory that has Transform1File.class? Backing up - does Transform1File.class even exist?
 
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
 
Renu, Vairagade
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you very much! You gave me clue to solve my problem. Actually I am using an application which allowes to run .bat files as Post-processing after a specific action. It required the CLASSPATH setting of system to modified to include the directory containin file Transform1.class. I was setting the classpath manually in only one session, when I was executing the .bat file from command line where it worked fine. But it didn't work when the application fired the execution of .bat, becoz CLASSPATH was not set. Now I changed the settings & my application is working fine. Than you again.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic