how to open a pdf file from java?

前端 未结 2 828
小鲜肉
小鲜肉 2021-01-24 21:26

I want to open a PDF file from a jsp. The jsp and the PDF are in the same directory. I am using the following piece of code:

if (Desktop.isSupported()) {
    try         


        
2条回答
  •  鱼传尺愫
    2021-01-24 22:04

    Have you tried this? I just got this from google, so I dunno if it will work.

    Process p = Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler c:\\Java-    Interview.pdf");
            p.waitFor();
    

提交回复
热议问题