lauch4j hello world program

泪湿孤枕 提交于 2019-12-08 03:05:54

问题


I created a "hello world" java program and use lauch4j to convert executable jar to .exe file. When I tried to run it in cmd, but nothing printed out. I also tried to run it in launch4j. Log indicates: Executing: C:\Documents and Settings\cnbq84\Desktop\helloworld.exe. But still no "hello world" is displayed.

How to display the "Hello World" msg?

Thanks

Here is my config file:

<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>

回答1:


You may not be in console mode.

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

To wrap a jar in console mode use launch4jc.exe and specify the configuration file. launch4jc.exe config.xml




回答2:


It turns out I finally spot the issue through trial and error...

When I add those lines: hello.HelloWorld hello.HelloWorld Everything works. It seems Launch4j can't find the main() if you do not specify it explicitly.

Thanks.



来源:https://stackoverflow.com/questions/1060530/lauch4j-hello-world-program

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!