Hello Jar2Exe

A "Hello World" program


Introduction

This is a "Hello World" program to test whether Jar2Exe does work.


1. Edit a java source file: "X:\demos\src\hello\HelloWorld.java"

package hello;
 
public class HelloWorld
{
    public static void main(String [] argv) // this is the entry point of program
    {
        System.out.println("Hello World!");
    }
}

2. Enter 'X:\demos' directory and compile it to a class file:

X:\>cd demos
X:\demos>javac src/hello/HelloWorld.java

3. Make a jar file:

X:\demos>jar cvf helloworld.jar -C src hello/HelloWorld.class

4. Use Jar2Exe to generate exe file for Windows and Linux separately:

X:\demos>j2ewiz helloworld.jar /m hello.HelloWorld
X:\demos>j2ewiz helloworld.jar /m hello.HelloWorld /platform linux

Now we have successfully generated our "helloworld.exe" for Windows and "helloworld" for Linux. You can run it at command line:

X:\demos>helloworld.exe
Hello World!

5. Download the program for reference