H5开发中遇到的问题及解决办法

记不得什么时候进行H5开发的学习了,只知道是从2016年8月1日开始修复Bug,计划每天把学到的东西以及遇到问题时候的解决方案都记录下来,希望自己能够坚持下去,每天积累一点,希望有所进步吧。

1、The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path
2、 正则表达式:
ua.match(/MicroMessenger/i) == "micromessenger"  //其中的i代表不区分大小写,g的话则代表全部匹配
 
3、Eclipse里项目名有红叉,但是底下的每一个文件都没有红叉;下面每个单独的文件都没有红叉报错,整个项目上显示个红叉;
解决方法类似:如果是因为java compiler level does not match the version of the installed java,那么我们打开项目的properties,有一个选项为project facets,点击打开,在右边选择Java版本为最新的,然后apply,应该就ok了。 对于导入的外来项目,在project facets中,点击右侧Java,右侧的Runtimes,这里修改成正确的tomcat,不用原来自带的运行环境 
当然也有可能是因为引用的jar包无效而导致的,根据指出的哪个jar删除进行重新引用即可。
 
4、  Eclipse下BASE64Decoder提示错误的解决办法,错误提示信息:Access restriction: The type 'BASE64Decoder' is not API。。。。:
 
解决方案:
解决方案1(推荐): 
只需要在project build path中先移除JRE System Library,再添加库JRE System Library,重新编译后就一切正常了。 
解决方案2: 
Windows -> Preferences -> Java -> Compiler -> Errors/Warnings -> 
Deprecated and trstricted API -> Forbidden reference (access rules): -> change to warning 
解决方案3:
Access restriction: The type 'BASE64Encoder' is not API (restriction on required library 'D:Javajdk1.6.0_43jrelib t.jar')
eclipse引入import sun.misc.BASE64Encoder; 是红叉,怎么解决?
Access restriction: The type 'BASE64Encoder'
 
 
 
  • eclipse

方法/步骤

 
  1. 右键项目,点属性(Properties);
    Access restriction: The type 'BASE64Encoder'
  2. java bulid path-->Libraries-->jre System Library;
    Access restriction: The type 'BASE64Encoder'
  3. Access Rules-->Edit;
    Access restriction: The type 'BASE64Encoder'
  4. Add,resolution选择accessible,下面填上** 点击确定即可!
    Access restriction: The type 'BASE64Encoder'
  5. 5
    这时项目就不再报错了;
    Access restriction: The type 'BASE64Encoder'
原文地址:https://www.cnblogs.com/smilehuanxiao/p/5776269.html