`
helloJ
  • 浏览: 163789 次
  • 性别: Icon_minigender_1
  • 来自: 厦门
社区版块
存档分类
最新评论

设置System.setProperty(“line.separator", "") 问题

    博客分类:
  • java
阅读更多
java.net.URL urlfile = null;
HttpURLConnection httpUrl = null;
	
// 连接指定的网络资源,获取网络输入流
urlfile = new java.net.URL(basePath);
httpUrl = (HttpURLConnection) urlfile.openConnection();   
httpUrl.connect();
code = httpUrl.getResponseCode();

 

设 basePath = “http://www.google.cn”;  时

在 window 系统运行时,code(int 类型) 可以正常的获得值:200

 

而在 aix  系统运行时,

urlfile = new java.net.URL(basePath);
httpUrl = (HttpURLConnection) urlfile.openConnection();

抛出异常,原以为是在aix 下获得的basePath会不一样("http://www.google.cn" 是从页面获得绑定到后台的),

在网上找了些资料,在urlfile = new java.net.URL(basePath); 之前加上

 

System.setProperty(“line.separator", "") ;

 

对客户端进行硬编码,结果运行后,一直报脚本错误,但是js代码部分都没修改过啊!

去掉System.setProperty(“line.separator", "") ;从新编译,项目关掉,重新发布,再访问,还是报脚本错,叫其它人用自己的代码发布到aix上,仍报脚本错,而脚本查了几遍,确定都没修改过,真晕了!

 

后来想,好像问题是从我设置运行:System.setProperty(“line.separator", "") ;  这段代码开始的,于是从新加了代码:System.setProperty(“line.separator", "\r\n") ;

发布运行还原,哈 ! 好了,再把 System.setProperty去掉,回到原位

 

后来想下,应该是"http://www.google.cn"  在aix 上 被网关 截了,访问不了,所以抛异常


 

参考:http://www.ibm.com/developerworks/cn/aix/library/au-aix-javatraps/index.html

 

分享到:
评论

相关推荐

    使用System.getProperty(line.separator).md

    这是本人在进行使用递归替换HTML文件中的图片内容时,所遇到的问题解决方案,喜欢能够帮到大家,让自己懂得东西越来愈多,做更多的分享

    android java.lang.IllegalArgumentException contains a path separator

    NULL 博文链接:https://denghuijia1314521-gmail-com.iteye.com/blog/1341258

    Window系统无法调用OpenCV报错Directory separator should not appear in library name

    Window系统无法调用OpenCV代码报错:java.lang.UnsatisfiedLinkError: Directory separator should not appear in library name: C:\Windows\System32\opencv_java343.dll。出现该问题主要是安装的Windows系统缺乏...

    Android BufferedReader 测试网站是否连接.rar

     String NL = System.getProperty("line.separator");//为每行数据添加分隔符  while((line = in.readLine()) != null)  {  sb.append(line NL);//获取各行数据信息  }  in.close();//关闭流  String result ...

    PHP常量DIRECTORY_SEPARATOR原理及用法解析

    DIRECTORY_SEPARATOR在php是什么意思呢,在什么时候使用DIRECTORY_SEPARATOR最合理呢?下面来给各位介绍一下php DIRECTORY_SEPARATOR常量。 我们知道DIRECTORY_SEPARATOR是一个PHP常量,代表反斜杠,因为windows系统...

    C#编程实例代码集合

    System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(Form1)); this.button1 = new System.Windows.Forms.Button(); this.SuspendLayout(); // // button1 ...

    银行前置系统hs_pkg.rar

    (The bank front system 1. You can configure and parsing fixed-length message 2. You can configure the analytical separator and a message 3. Can be configured and parsing HSFIX message Message 4. Can ...

    java屏幕录像(包含鼠标轨迹)生成avi媒体文件

    new File(System.getProperty("user.home")+File.separator+"Videos"); 其它: new File(System.getProperty("user.home")+File.separator+"Movies"); 我的电脑是C:\Documents and Settings\hz001\Videos这个路径 ...

    Android获取手机配置信息具体实现代码

    phoneInfo.append(“Product: ” + android.os.Build.PRODUCT + System.getProperty(“line.separator”)); phoneInfo.append( “CPU_ABI: ” + android.os.Build.CPU_ABI + System.getProperty(“line.separator”...

    resources_cn安卓工作室android studio 2.3.3中文汉化包_韩梦飞沙.jar

    Can't find resource for bundle java.util.PropertyResourceBundle, key emmet.bem.class.name.element.separator.label 安卓工作室 android studio 版本 2.3.3。 还有美化,修改 定制 教程。作者:韩梦飞沙。邮箱...

    Visual_C++_6.0_MFC_入门

    ID_SEPARATOR, // status line indicatorON_WM_CREATE46 //修改OnCreate 函数,重新设置状态条第二部分ID 值47 5.1 使用资源编辑器编辑对话框51 5.2 创建有模式对话框52 5.3 创建无模式对话框54 END_MESSAGE_MAP() ...

    numpad-decimal-separator:从 code.google.compnumpad-decimal-separator 自动导出

    1.1.4 介绍 使用这个 jQuery 插件,您可以配置用于小键盘小数点分隔符的字符。 这个插件是用 jsTestDriver 和 jasmine 测试的。 依赖关系 jQuery ( ) jQuery 扩展函数 numpadDecSeparator 这个函数有三个选项: ...

    php接口数据加密、解密、验证签名

    include_once(dirname(dirname(__FILE__)).DIRECTORY_SEPARATOR.’phpsec’.DIRECTORY_SEPARATOR.’Math’.DIRECTORY_SEPARATOR.’BigInteger.php’); include_once(dirname(dirname(__FILE__)).DIRECTORY_SEPARATOR...

    [示例][PHP]PHP的轻量级通知库.zip

    与重量级框架相比,解决问题的侧重点是不同的。 采用轻量框架一方面因为尽可能的采用基于POJOs的方法进行开发,使应用不依赖于任何容器,这可以提高开发调试效率;另一方面轻量级框架多数是开源项目,开源社区提供...

    超详细的字符编码教程

    10 – LF – Line Feed 换行 2.1.2.1.2.11. 11 – VT – Vertical Tab 垂直制表符 2.1.2.1.2.12. 12 – FF – Form Feed 换页 2.1.2.1.2.13. 13 – CR – Carriage return 机器的滑动部分/底座 返回 -> 回车 2.1....

    EurekaLog_7.5.0.0_Enterprise

    32)..Changed: Descriptions of EurekaLog project options now list corresponding property names of TEurekaModuleOptions class. 33)..Changed: Default template of ...

    Java实现文件的压缩和解压

    System.out.println("创建目录:" + outputDirectory + File.separator + name); } else { String fileName = zipEntry.getName(); fileName = fileName.replace('\\', '/'); if (fileName.indexOf(...

    中文分词ChineseAnalyzer.rar

    long begin = System.DateTime.Now.Ticks; Token t = stream.Next(); while (t != null) { t1 = t.ToString(); //显示格式: (关键词,0,2) ,需要处理 t1 = t1.Replace("(",""); char[] separator = { ',' };...

    python3.6.5参考手册 chm

    The plistlib module: A Property-List Parser ctypes Enhancements Improved SSL Support Deprecations and Removals Build and C API Changes Port-Specific Changes: Windows Port-Specific Changes: Mac OS...

    lucene2.9.1完整DEMO及开发文档

    sb.append(str).append(System.getProperty("line.separator")); } //文件内容作为"content"域:分词,索引,保存 doc.add(new Field("contents", sb.toString(), Field.Store.YES, Field.Index.ANALYZED)); ...

Global site tag (gtag.js) - Google Analytics