Tag: system

JOGL没有自动释放池

我试图将JOGL添加到我的项目中,经过很长一段时间搜索网络后,我找到了解决方案。 我将jar添加到我的构建路径中,Eclipse识别它们。 我想测试它,所以从这里获取代码: https : //sites.google.com/site/justinscsstuff/jogl-tutorial-2并编译。 AWT-way给了我这个结果: 2012-06-03 18:20:44.623 java[1481:903] [Java CocoaComponent compatibility mode]: Enabled 2012-06-03 18:20:44.626 java[1481:903] [Java CocoaComponent compatibility mode]: Setting timeout for SWT to 0.100000 2012-06-03 18:20:46.253 java[1481:903] *** __NSAutoreleaseNoPool(): Object 0x102034900 of class NSConcreteMapTableValueEnumerator autoreleased with no pool in place – just leaking 2012-06-03 18:20:46.259 java[1481:903] *** __NSAutoreleaseNoPool(): Object 0x10209e3f0 of […]

为什么\ n和(String)System.getProperty(“line.separator”); 行为不同?

我的程序接受一个文本文件的输入,其中每个单词都用换行符分隔,我的程序接受并处理数据,然后我需要在保持控制台输出的同时输出到新文件。 现在我想知道为什么当我将“\ n”附加到我的stringBuilder时,它将它打印出来,因为它在控制台中有一个新行,但是在文件输出中,它不会将它作为一个新行而只是将所有单词放在一行中。 当我使用newLine时,它只在我的控制台输出和输出文件中给出一个新行。 这是为什么? (String)System.getProperty(“line.separator”)做了什么导致这个? String newLine = (String)System.getProperty(“line.separator”); try{ BufferedReader fileIn = new BufferedReader(new FileReader(fileName)); stringBuilder.append(newLine); while((s = fileIn.readLine()) != null){ stringBuilder.append(s); stringBuilder.append(newLine);//using newLine, } String a = stringBuilder.toString(); if(s== null){ fileIn.close(); }