Linux(Ubuntu)下给firefox安装jre插件

来源:互联网 发布:有算法工程师培训吗 编辑:程序博客网 时间:2024/05/16 01:47

做法
     下载jre,并解压到某个文件夹!
     cd <firefox的安装目录>/plugins
     sudo ln -s <jre的安装目录>/lib/i386/libnpjp2.so      cd <mozilla>/plugins
     sudo ln -s <jre的安装目录>/lib/i386/libnpjp2.so
     重启 firefox 。     和你之前查的不同? 有疑问的请往下看!!
 
     今天打开一个含有 Applet 小程序的网页,发现少了传说中的 plugin,去查找发现是: java runtime environment (jre)。 于是点击安装插件,提示失败,要求手动安装,并给你个jre下载地址。
       好吧,我还不会手动安装呢!Google之。
       结论是再firefox安装目录里创建一个符号链接即可,那么:       cd <firefox的安装目录>/plugins
       sudo ln -s <jre的安装目录>/plugin/i386/ns7/libjavaplugin_oji.so       好吧,满怀希望地重启firefox,但是java的插件没有。
       是不是操作错了?于是 try again and again 。但是结果没变。
       但是,我发现再 firefox 的 about:plugins 的页面内展示的插件中有好多文件我再 <firefox>/plugins里没有见过。于是       cd /usr/lib
       ls -a | grep mozilla       发现再 mozilla里也有个 plugins的目录,接着按照上面的方法创建符号链接。
       重启,失败!!!
       纠结中…………
       怎么回事呢?上官网。上面写着Java Runtime EnvironmentVersion: 1.4.2 or later Supported Supported Java FAQ

  • Install Java Runtime Environment.
  • Make a symbolic link to libjavaplugin_oji.so in your Mozilla Plugins directory. Use the copy located in the plugin/i386/ns7 directory of JRE 5.0 or later, or plugin/i386/ns610-gcc32 if you are using JRE 1.4.2.
  • Do not copy the plugin to your plugins directory. If you do, Mozilla will crash any time you attempt to view a page containing a Java applet.
    The instructions listed here are for the Sun Java Runtime Environment. OtherJava Runtime Environments, such as those available from IBM and the Blackdown project, can also be used.
     
           既然官网都这么说了,可能是哪儿操作错了!于是又  try again and again, 于是在一次次的打击中我想……       但是希望来了。
           我偶然得知这么一个事实:MozillaFirefox 3.6 系列将不再支持以前 OJI (Open Java Virtual Machine Integration)架构 Java 浏览器插件,需要使用 Java 6 Updates 10 及以后提供的符合 NPAPI 标准的新版本浏览器插件。我们创建的符号链接应该是一个叫做 libnpjp2.so的库,在jre/lib/i386里。而不是之前的libjavaplugin_oji.so。好吧,官网把我忽悠了!     最终解决方案:
         cd <firefox的安装目录>/plugins
         sudo ln -s <jre的安装目录>/lib/i386/libnpjp2.so
         为保险
         cd <mozilla>/plugins
         sudo ln -s <jre的安装目录>/lib/i386/libnpjp2.so
         重启 firefox 。成功了!
        
          可能有些同志不知道怎么操作:
          我的firefox安装目录是:/usr/lib/firefox (可以 whereis firefox),mozilla目录是:/usr/lib/mozilla,jre安装目录在:/opt/jre1.6.0_22
          操作过程:
          cd /usr/lib/firefox/plugins
          ln -s /opt/jre1.6.0_22/lib/i386/libnpjp2.so
          cd ..
          cd ..
          cd mozilla/plugins
          ln -s  /opt/jre1.6.0_22/lib/i386/libnpjp2.so      重启firefox!!!
          地址栏 about:plugins      图片为证:

    http://www.huomo.cn/developer/article-15a76.html

    http://www.oracle.com/technetwork/java/javase/manual-plugin-install-linux-136395.html

    http://download.oracle.com/javase/6/docs/technotes/guides/jweb/applet/browser_support.html

    http://jvarun.wordpress.com/2008/10/02/making-jre-work-in-firefox-suse-102-64-bit/