在執行org.apache.commons.lang3.text.WordUtils
類之後好了,我希望能夠使用WordUtils.wrap(String str, int width)
函數。但我達到了減速。Java Apache Commons WordUtils.wrap()在運行時拋出SecurityException
我能夠編譯這個程序(我應該提到的是一個小程序),沒有一個單一的問題。我只需設置一個CLASSPATH環境變量來引用apache jar文件,然後通過appletviewer讓程序運行。但是,當我到達使用WordUtils.wrap()
函數的代碼的一部分時,所有內容都變得很酸,並且在命令提示符處出現大約20行的運行時錯誤。
錯誤:
Caught a SecurityException reading the system property 'awt.toolkit'; the System
Utils property value will default to null.
Caught a SecurityException reading the system property 'file.encoding'; the Syst
emUtils property value will default to null.
Caught a SecurityException reading the system property 'java.awt.fonts'; the Sys
temUtils property value will default to null.
Caught a SecurityException reading the system property 'java.awt.graphicsenv'; t
he SystemUtils property value will default to null.
Caught a SecurityException reading the system property 'java.awt.headless'; the
SystemUtils property value will default to null.
Caught a SecurityException reading the system property 'java.awt.printerjob'; th
e SystemUtils property value will default to null.
Caught a SecurityException reading the system property 'java.class.path'; the Sy
stemUtils property value will default to null.
Caught a SecurityException reading the system property 'java.compiler'; the Syst
emUtils property value will default to null.
Caught a SecurityException reading the system property 'java.endorsed.dirs'; the
SystemUtils property value will default to null.
Caught a SecurityException reading the system property 'java.ext.dirs'; the Syst
emUtils property value will default to null.
Caught a SecurityException reading the system property 'java.home'; the SystemUt
ils property value will default to null.
Caught a SecurityException reading the system property 'java.io.tmpdir'; the Sys
temUtils property value will default to null.
Caught a SecurityException reading the system property 'java.library.path'; the
SystemUtils property value will default to null.
Caught a SecurityException reading the system property 'java.runtime.name'; the
SystemUtils property value will default to null.
Caught a SecurityException reading the system property 'java.runtime.version'; t
he SystemUtils property value will default to null.
Caught a SecurityException reading the system property 'java.util.prefs.Preferen
cesFactory'; the SystemUtils property value will default to null.
Caught a SecurityException reading the system property 'java.vm.info'; the Syste
mUtils property value will default to null.
Caught a SecurityException reading the system property 'user.country'; the Syste
mUtils property value will default to null.
Caught a SecurityException reading the system property 'user.region'; the System
Utils property value will default to null.
Caught a SecurityException reading the system property 'user.dir'; the SystemUti
ls property value will default to null.
Caught a SecurityException reading the system property 'user.home'; the SystemUt
ils property value will default to null.
Caught a SecurityException reading the system property 'user.language'; the Syst
emUtils property value will default to null.
Caught a SecurityException reading the system property 'user.name'; the SystemUt
ils property value will default to null.
Caught a SecurityException reading the system property 'user.timezone'; the Syst
emUtils property value will default to null.
這裏是代碼,使一切麻煩行:
String strWrap = WordUtils.wrap("A really really really really really long sentence.", 50);
這裏發生了什麼?
如何向我們展示更多代碼?你的代碼是否直接使用SystemUtils?由於瀏覽器中的安全限制,SystemUtils正試圖讀取applet可能不允許讀取的系統屬性。 – DNA
沒有在我的代碼(這是一個200行文件)在哪裏使用SystemUtils,只是WordUtils ...? – Nigh7Sh4de