This week's book giveaway is in the Design forum.
We're giving away four copies of Design for the Mind and have Victor S. Yocco on-line!
See this thread for details.
Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

runnning a java program via a batch file

 
Venkat Suryadevara
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 104
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
try
java -cp <classpath here> <fully qualified class name>
 
Venkat Suryadevara
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 8521
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Would this be a UNIX web server? Wouldn't you need a .sh file for that?
 
Venkat Suryadevara
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
no..it's windows web server....
 
Doanh Nguyen
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 8521
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic