This week's book giveaway is in the General Computing forum.
We're giving away four copies of Learning Regular Expressions and have Ben Forta on-line!
See this thread for details.
Win a copy of Learning Regular Expressions this week in the General Computing forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

runnning a java program via a batch file  RSS feed

 
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^>
 
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
 
"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....
 
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
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!