Win a copy of liveProject: Protecting User Data with Spring Security and OAuth2 this week in the Spring 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • paul wheaton
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Liutauras Vilda
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Piet Souris
Bartenders:
  • salvin francis
  • Mikalai Zaikin
  • Himai Minh

runnning a java program via a batch file

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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"
Posts: 8521
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
no..it's windows web server....
 
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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"
Posts: 8521
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic