That article was focused on the windows os usage of it, so they used
cmd.exe or whatever it was. bash is the shell i use in unix os.
so for me to use the html2ps program on unix i had the following code
try {
String cmd1 = "bash html2ps -o "+tmp2+".ps "+tmp2+".html ";
//cmd1
Process p1 = Runtime.getRuntime().exec(cmd1);
//wait for end of process and get exit status
int status = p1.waitFor();
if (status != 0) {
System.out.println("cmd1's status "+status);
}
} catch (IOException e) {
System.out.println("ExecuteCmd.main() : " + e);
}
if you're doing it on windows you need to envoke cmd.exe instead and
for that you need to put cmd.exe instead of bash.
At the end of that article he mentioned that you cannot use Runtime.exec()
like a command line. that's what I was doing, so I had to envoke a command
line to make it work basically..
:)
On Tue, 27 Aug 2002, Raju Lokhande wrote:
> Can you share the code for initialization of 'bash' please?
> I accessed the URL you mentioned and could not find the word 'bash'? Did you mean
>something else?
> Thanks
> Raju Lokhande
>
>
> >>> [EMAIL PROTECTED] 08/23/02 10:21AM >>>
> problem solved, I lacked the initilization of 'bash' to actually run to
> command.. (for those interested..) the java list serv pointed me to this
> article
> http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps_p.html
>
> Thanks
> sohaila
>
> On Thu, 22 Aug 2002, Taylor, Kevin wrote:
>
> > One thing to do WRT:
> > Process p = rt.exec("/usr/local/bin/html2ps -o \""+tmp+".ps\"
> > \""+tmp+".html\" ");
> > p = rt.exec("lpr -Plp1 \""+tmp+".ps");
> >
> > is to System.out.println() these arguments to make sure you are passing in
> > the correct command lines.
> >
> > e.g.:
> > System.out.println("/usr/local/bin/html2ps -o \""+tmp+".ps\"\""+tmp+".html\"
> > ");
> >
> > System.out.println("lpr -Plp1 \""+tmp+".ps");
> >
> > --Kevin Taylor
> > Sr Web Developer
> >
> > > -----Original Message-----
> > > From: Sohaila Roberts [SMTP:[EMAIL PROTECTED]]
> > > Sent: Thursday, August 22, 2002 11:42 AM
> > > To: [EMAIL PROTECTED]
> > > Subject: another unix command question
> > >
> > > Hi,
> > > I have the following code in a servlet
> > > String tmp = "filename";
> > > prPrintout pr = new prPrintout();
> > > boolean hmm = pr.createFile(tmp +".html");
> > > try {
> > > Runtime rt = Runtime.getRuntime();
> > > Process p = rt.exec("/usr/local/bin/html2ps -o \""+tmp+".ps\"
> > > \""+tmp+".html\" ");
> > > p = rt.exec("lpr -Plp1 \""+tmp+".ps");
> > > System.out.println("printing");
> > > } catch(IOException e) { System.out.println(e);}
> > >
> > > and what its suppose to do is run html2ps on the html file i created with
> > > createFile, converting the html file to a ps file and then pringing the ps
> > > file.. but it doesnt do the converting nor the printing.. (when i do the
> > > commands via command promt it works fine, so its something in my code that
> > > i'm forgetting about..) tho it doesnt throw an exception and it does print
> > > my System.out.println("printing"); line.. Anyone know why?
> > >
> > > Thanks
> > > Sohaila
> > >
> > > __________________________________________________________________________
> > > _
> > > To unsubscribe, send email to [EMAIL PROTECTED] and include in the
> > > body
> > > of the message "signoff SERVLET-INTEREST".
> > >
> > > Archives: http://archives.java.sun.com/archives/servlet-interest.html
> > > Resources: http://java.sun.com/products/servlet/external-resources.html
> > > LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
> >
> > ___________________________________________________________________________
> > To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
> > of the message "signoff SERVLET-INTEREST".
> >
> > Archives: http://archives.java.sun.com/archives/servlet-interest.html
> > Resources: http://java.sun.com/products/servlet/external-resources.html
> > LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
> >
>
> ___________________________________________________________________________
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources: http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
>
>
>
>
> *************************************************************************
> This message, together with any attachments, is intended only
> for the use of the individual or entity to which it is addressed. It
> may contain information that is confidential and prohibited from
> disclosure. If you are not the intended recipient, you are
> hereby notified that any dissemination or copying of this
> message or any attachment is strictly prohibited. If you have
> received this message in error, please notify the original sender
> immediately by telephone or by return e-mail and delete this
> message along with any attachments, from your computer.
> Thank you.
> *************************************************************************
>
> ___________________________________________________________________________
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources: http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
>
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html