aspose file tools*
The moose likes Java in General and the fly likes runnning a java program via a batch file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "runnning a java program via a batch file" Watch "runnning a java program via a batch file" New topic
Author

runnning a java program via a batch file

Venkat Suryadevara
Greenhorn

Joined: May 12, 2003
Posts: 9
I am unable to run a java program from a batch file that i created.spiderpackage.EntryPoint is a class file which I am trying to run with a -v option to output something.What should I do to get the output?

echo ^<html^>^<body^>
echo hello^<br^>
call java spiderpackage.EntryPoint -v
echo ^</body^>^</html^>
raimondas zemaitis
Ranch Hand

Joined: Feb 23, 2001
Posts: 104
try
java -cp <classpath here> <fully qualified class name>
Venkat Suryadevara
Greenhorn

Joined: May 12, 2003
Posts: 9
I am trying to run the same program from my webserver but I am unable to capture the output.
what should I do to get that?
echo ^<html^>^<body^>
echo hello^<br^>
setlocal
set JDK=C:\j2sdk1.4.1_01
PATH=%JDK%\bin;.;%PATH%
set CLASSPATH=%JDK%\jre\lib\*.jar;.;%JDK%\jre\lib\ext\*.jar;.;%CLASSPATH%
echo there goes the java file ^<BR^>
java -cp c:\j2sdk1.4.1_01\jre\lib*.jar;c:\j2sdk1.4.1_01\bin; spiderpackage.EntryPoint -v
echo passed it
endlocal
echo ^</body^>^</html^>
Venkat Suryadevara
Greenhorn

Joined: May 12, 2003
Posts: 9
thanks for a solution.but...
I am calling the batch file from my web server.The solution you gave is working when I run the same program from cmd prompt but It's not working when I try to run from my webserver.Please help
Cindy Glass
"The Hood"
Sheriff

Joined: Sep 29, 2000
Posts: 8521
Would this be a UNIX web server? Wouldn't you need a .sh file for that?


"JavaRanch, where the deer and the Certified play" - David O'Meara
Venkat Suryadevara
Greenhorn

Joined: May 12, 2003
Posts: 9
no..it's windows web server....
Doanh Nguyen
Ranch Hand

Joined: Dec 02, 2000
Posts: 45
Originally posted by Venkat Suryadevara:
I am unable to run a java program from a batch file that i created.spiderpackage.EntryPoint is a class file which I am trying to run with a -v option to output something.What should I do to get the output?

I think a web page, i.e., IE, runs in the windows operating system whereas a batch file runs in its dos-like address space, which accommodates JVM to run your java class. I am not sure if direct communication between these two address spaces is possible. You may want to modify your Java program to write to a file...
Cindy Glass
"The Hood"
Sheriff

Joined: Sep 29, 2000
Posts: 8521
I am a little confused here. Are you trying to run a client application (what I had in mind when I was talking to you), or a Servlet, or what?
Venkat Suryadevara
Greenhorn

Joined: May 12, 2003
Posts: 9
I am making the question very clear.
I have a batch file.It calls a java program
call java myprogram.java
I am running this batch file from CGI of the web server.I am unable to see the output
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: runnning a java program via a batch file