views:

187

answers:

2

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&lt;/downloadUrl&gt;
  <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  A: 

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

Clint
I did so. But still when I run it in cmd using: helloworld.exeNo output in console
Lily
Whoops, wrong console. This reference is for the tool not the exe that it generates.
Clint
A: 

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.

Lily
Lily