2009-06-29 129 views
2

我创建了一个“hello world”java程序并使用lauch4j将可执行文件转换为.exe文件。当我试图用cmd运行它,但没有打印出来。我也尝试在launch4j中运行它。日志表示:执行:C:\ Documents and Settings \ cnbq84 \ Desktop \ helloworld.exe。但是仍然没有显示“hello world”。lauch4j hello world program

如何显示“Hello World”味精?

感谢

这里是我的配置文件:

<launch4jConfig> 
    <dontWrapJar>false</dontWrapJar> 
    <headerType>gui|console</headerType> 
    <jar>C:\Documents and Settings\cnbq84\Desktop\helloworld.jar</jar> 
    <outfile>C:\Documents and Settings\cnbq84\Desktop\helloworld.exe</outfile> 
    <errTitle></errTitle> 
    <cmdLine></cmdLine> 
    <chdir></chdir> 
    <priority>normal</priority> 
    <downloadUrl>http://java.com/download</downloadUrl> 
    <supportUrl></supportUrl> 
    <customProcName>false</customProcName> 
    <stayAlive>false</stayAlive> 
    <manifest></manifest> 
    <icon></icon> 
    <jre> 
    <path>PATH</path> 
    <minVersion>1.4.0</minVersion> 
    <maxVersion></maxVersion> 
    <jdkPreference>preferJre</jdkPreference> 
    </jre> 
</launch4jConfig> 

回答

2

您可能无法在控制台模式。

http://launch4j.sourceforge.net/docs.html

为了总结在控制台模式下的罐子使用 launch4jc.exe并指定 配置文件。 launch4jc.exe config.xml中

+0

我这样做了。但仍然当我运行它在cmd中使用:helloworld.exe 控制台中没有输出 – Lily 2009-06-29 21:14:16

+0

哎呀,错误的控制台。该引用是针对该工具而非其生成的exe。 – Clint 2009-06-29 21:19:17

0

原来我终于通过反复试验发现问题...

当我添加这些行: hello.HelloWorld hello.HelloWorld 一切作品。看来Launch4j无法找到main()如果你没有明确指定它。

谢谢。