我正在为我的项目的更新功能,它的工作的伟大,直到我希望它重新启动,基本上我下载新的文件,并与旧的替换它,然后我想再次运行它,现在由于某种原因,不会运行,我没有任何错误...
这是完整的更新类:http: //dl.dropbox.com/u/38414202/Update.txt
这是我用来运行.jar文件的方法:
String currDir = new File("(CoN).jar").getAbsolutePath();
Process runManager = Runtime.getRuntime().exec("java -jar " + currDir);
Run Code Online (Sandbox Code Playgroud) 有时,或者好吧,我经常需要查看String是否为null,所以我使用这样的条件:
if(str != null) {
}
Run Code Online (Sandbox Code Playgroud)
它工作正常,直到今天,现在甚至是因为某种原因而无法通过的字符串.有谁知道解释?还是解决方案?
编辑:好的,所以由于某种原因,字符串似乎不是null,这是非常奇怪的,因为我从未定义它是什么,只是明确它存在.所以相反,字符串是单词"null"的字符串.我完全不知道它为什么会这样?当我做以下时:
String str;
Run Code Online (Sandbox Code Playgroud)
然后它会自动为空,对吗?无论哪种方式,如果不是为什么它会变成字符串"null"?
嘿,我想用java读取和编写xml代码,所以我google'd怎么做,但我发现只有引擎的谁可以阅读真正简单的xml代码,如
<?xml version="1.0"?>
<company>
<staff>
<firstname>yong</firstname>
<lastname>mook kim</lastname>
<nickname>mkyong</nickname>
<salary>100000</salary>
</staff>
<staff>
<firstname>low</firstname>
<lastname>yin fong</lastname>
<nickname>fong fong</nickname>
<salary>200000</salary>
</staff>
</company>
Run Code Online (Sandbox Code Playgroud)
但我想阅读更多的进展,例如:
<?xml version="1.0" encoding="UTF-8"?>
<package>
<template name="store_avatars">
<!-- UI validation for this file -->
<panel noclick="1" onload="CreateBool('ui_avatars_package_loaded', true);"/>
<!-- Female Pyromancer -->
<instance name="altAvatarPreviewPanel"
heroEntryID="1"
id="15"
product="Hero_Pyromancer.Female"
definition="/heroes/pyromancer"
heroName="Hero_Pyromancer"
hero_icon_path="/heroes/pyromancer/icon.tga"
hasvoice="true"
hasmodel="true"
hastexture="true"
hassounds="true"
hasanimations="true"
haseffects="false"
/>
<!-- Sexy Moon Queen -->
<instance name="altAvatarPreviewPanel"
heroEntryID="2"
id="16"
product="Hero_Krixi.Sexy"
definition="/heroes/krixi"
heroName="Hero_Krixi"
hero_icon_path="/heroes/krixi/icons/hero.tga"
hasvoice="false"
hasmodel="true"
hastexture="true"
hasanimations="true"
haseffects="false"
/>
</template>
</package>
Run Code Online (Sandbox Code Playgroud)
所以我继续为此做了自己的课程,
package …
Run Code Online (Sandbox Code Playgroud)