Launch4J launch fails as expected

Tools: Win 7, Launch4J 3.5, Simple Hello world Java Console Application (bundled with JAR file)

Hello to all,

I have a main JAVA console application that doesn't ask for any inputs, just a simple application that opens a console window and displays the Hello World text.

I built it so easy to experiment with Launch4J 3.5 and create an executable from a jar file.

Everything looks fine, the exe runs successfully, but when I run it nothing happens, I get a watch glass for a few seconds, then nothing. I check Task Manager and there is no process there.

See my settings in Launch4J, I just completed the basics, I tried with and without writing to the Wrapper manifest field:

Output File: C: \ Development \ SFDC \ ProjectX \ out \ exe \ ProjectX.exe

Jar: C: \ Development \ SFDC \ ProjectX \ out \ artifacts \ ProjectX_jar \ ProjectX.jar

Wrapper exponent: C: \ Launch4j \ manifest \ uac.exe.manifest (also tried to leave this gap)

The rest remains by default.

0


source to share


3 answers


If at startup you mean double-click, no - nothing you can see will happen; you need to "tell" Java to run the application using the appropriate console. To do this, you can create a new .bat file: just open a text editor and paste the following line:

java -jar NAME.jar

      



where "NAME" is the name of your application. Save the text file in .bat format, not .txt, and place it in the same directory as your application. You can launch the application by double clicking this file.

The reason it doesn't appear in your task manager is because probably (I don't know) your application only prints out a simple message and does nothing. In non-console mode, it will just call your print method (println or any other console) without any visual effect, since there is no console to print the message. In both cases, however, if you are just typing and not doing other "last" operations, such as listening for input, your program will exit when it reaches the end of the main method.

+1


source


Maybe you need to use start4j in console mode, see this answer: lauch4j hello world program



0


source


Yes. You need to use console mode. You also need to have some way of opening the console window because it closes the console when the program exits. Use scan.nextLine();

or Thread.sleep(i)

if you really need to.

0


source







All Articles