简体   繁体   English

某些功能不适用于Tomcat服务器

[英]Some functions are not working with Tomcat Server

I am doing a java web project using tomcat server. 我正在使用tomcat服务器进行Java Web项目。 So far I have used the tomcat server that is provided with Netbeans IDE. 到目前为止,我已经使用了Netbeans IDE随附的tomcat服务器。 I am using the following code to open a pdf file in my project. 我正在使用以下代码在我的项目中打开pdf文件。

public int printPDF(String filePath){
    try {
        if ((new File(filePath)).exists()) {

            Process p = Runtime
               .getRuntime()
               .exec("rundll32 url.dll,FileProtocolHandler " + filePath);
            p.waitFor();

            return 1;
        } 
        else {
            //System.out.println("File is not exists");
            return 0;
        }

        //System.out.println("Done");

  } catch (Exception ex) {
    ex.printStackTrace();

            return 2;
  }
}

Then I published my web site in another machine(client's). 然后,我将网站发布在另一台计算机(客户端)上。 I used a tomcat server installer to install tomcat serve in that machine. 我使用了tomcat服务器安装程序在该计算机上安装tomcat服务。 But when I host my web site there all the other functions except the above one is working perfectly. 但是,当我托管我的网站时,除上述功能外,所有其他功能均正常运行。 I have no idea where it goes wrong. 我不知道哪里出了问题。 Then I installed the same server in my machine and the exact thing happened. 然后,我在机器上安装了同一台服务器,然后发生了确切的事情。 Is there anything I should know when I install Tomcat server using a exe file rather than working with the server that is given by Netbeans IDE. 使用exe文件而不是使用Netbeans IDE提供的服务器安装Tomcat服务器时,我应该知道什么。 Thank you. 谢谢。

您的Java程序从操作系统中期望这是文件类型(pdf)与打开它的程序之间的连接(例如Acrobat Reader)-也许其他系统没有此连接或没有安装pdf阅读器?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM