Skip to content
coobbi edited this page Apr 15, 2026 · 5 revisions

Jre4Android Help

Jre4Android lets you run Java JAR files and Java class files on Android.

Before running a file, please check the supported Java version and choose the correct run type.


0. Supported Java Versions

Free Version

The free version supports:

  • Java 17 or earlier — fully supported, no ad required
  • Java 21 — supported after watching an ad

Java 22 or higher is not supported and may cause the app to crash or fail to run.

Pro Version

The Pro version supports:

  • Java 25 or earlier — fully supported, no ad required

Java 26 or higher is not supported and may cause the app to crash or fail to run.


1. Before You Start

Jre4Android supports different kinds of Java applications.

After selecting a JAR file, you may need to choose a run type such as:

  • J2ME type
  • Swing type
  • Terminal type

This is important because different Java programs need different runtime modes.

If you choose the wrong type, the app may fail to run correctly.


2. Run a .jar File

You can use Jre4Android to run a Java JAR file.

This is similar to the following desktop command:

java -jar xxx.jar

How to use

  1. Open Jre4Android
  2. Choose Run .jar
  3. Select the JAR file you want to run
  4. Choose the correct run type
  5. Start the program

3. Choose the Correct Run Type

After selecting a JAR file, choose the type that matches your Java application.

J2ME Type

Choose J2ME type if the JAR file is a Java ME / MIDlet application or game.

Use this type for:

  • old mobile Java games
  • J2ME apps
  • MIDlet-based applications

If your JAR was originally made for older feature phones, this is usually the correct choice.


Swing Type

Choose Swing type if the JAR file is a desktop Java GUI application that uses Swing.

Use this type for:

  • Java desktop applications with windows and buttons
  • Swing-based GUI tools
  • Java programs that open a graphical interface

If the program is supposed to show a desktop-style GUI, use this type.


Terminal Type

Choose Terminal type if the JAR file is a console / command-line Java program.

Use this type for:

  • command-line tools
  • text-based Java programs
  • server JAR files
  • programs that print output in a terminal

If the program normally runs like this on desktop:

java -jar xxx.jar

and shows text output instead of a graphical window, choose Terminal type.

This is usually the correct type for:

  • console apps
  • utility tools
  • Minecraft server JAR files
  • Spring Boot JARs
  • command-line Java programs

4. How to Decide Which Type to Use

Use J2ME type if:

  • the app is a Java ME / MIDlet app
  • it was designed for old mobile phones
  • it is a J2ME game

Use Swing type if:

  • the app should open a graphical desktop-style window
  • it uses Swing UI components

Use Terminal type if:

  • the app runs in command-line mode
  • it prints text output
  • it is a server or console application

If you are not sure, try to identify what kind of Java program it is before running it.


5. Run a .class File

Jre4Android can also run Java class files.

This is useful if you want to run a compiled Java class directly instead of packaging it into a JAR.


Case 1: Run a class file without external JAR dependencies

If the class file does not depend on any other JAR files, you can run it directly.

This is similar to the following desktop command:

java Hello

Here, Hello refers to Hello.class.

How to use

  1. Open Jre4Android
  2. Choose Run .class
  3. Select the .class file you want to run
  4. Start the program

Example

If you want to run:

Hello.class

Jre4Android will run it like:

java Hello


Case 2: Run a class file that depends on other JAR files

If the class you want to run depends on one or more external JAR files, you must add those JAR files to the classpath first.

For example, if:

  • A.class is the class you want to run
  • B.jar is required by A.class

then you need to add B.jar through the app settings before running A.class.

This is similar to the following desktop command:

java -cp B.jar A

How to use

  1. Open Settings
  2. Find Add jars to classpath
  3. Add the required JAR file(s), such as B.jar
  4. Go back and choose Run .class
  5. Select the class file you want to run, such as A.class

6. Classpath Support

If your Java program needs additional library JAR files, you must add them to the classpath.

This is commonly needed when:

  • a .class file depends on external libraries
  • your Java code uses third-party JAR files
  • the program cannot find required classes at runtime

To do this:

  1. Open Settings
  2. Tap Add jars to classpath
  3. Select the required JAR dependency files
  4. Run your main .class file again

7. Important Notes

  • Make sure your JAR or class file was compiled with a supported Java version
  • Choose the correct run type after selecting a JAR file
  • If your program requires external libraries, add them to the classpath before running
  • Unsupported Java versions may cause crashes or startup failures
  • Some desktop Java programs may not work correctly on Android, depending on their design and required environment

8. Quick Summary

To run a JAR file

  1. Select Run .jar
  2. Choose your .jar file
  3. Select the correct run type:
    • J2ME type for Java ME / MIDlet apps
    • Swing type for desktop GUI apps
    • Terminal type for console and server apps

To run a simple class file

  1. Select Run .class
  2. Choose your .class file

To run a class file with dependencies

  1. Open Settings > Add jars to classpath
  2. Add required JAR files
  3. Run the .class file

9. Tips

  • If a JAR file does not run, first check its Java version
  • If a JAR opens in the wrong mode, try a different run type
  • If a class file fails to start, check whether it needs extra JAR files in the classpath
  • If you are unsure which type to use:
    • choose J2ME type for Java ME apps and games
    • choose Swing type for graphical desktop Java apps
    • choose Terminal type for console apps and servers

Test and verify the supported jar

Supported JAR Test Cases

Below are some sample JAR files that have been tested successfully in Jre4Android.
They demonstrate support for terminal programs, interactive input/output, local networking, and Swing GUI applications.


Console Applications

1. Hello World

A simple program that prints Hello jdk!!! in the terminal.

Download:
Hello.jar

Expected result:

Hello jdk!!!

18631776213940_ pic


2. HttpServerDemo

A simple HTTP server example.

After running the JAR, open the following address in your phone browser:

http://localhost:8080

Download:
HttpServerDemo.jar

Expected result:
The local web server starts successfully, and the browser can access the demo page.

18651776213945_ pic


3. PrintTriangle

A simple console program that prints a triangle pattern in the terminal.

Download:
PrintTriangle.jar

Expected result:
Prints a triangle made of * characters.

18661776213948_ pic


4. IpAndHostName

Displays the local host address and host name in the terminal.

Download:
IpAndHostName.jar

Expected result:

Local HostAddress: 127.0.0.1
Local host name: localhost

18671776213951_ pic


5. PrintGoogleHeader

Fetches and prints the HTTP response headers from https://www.google.com.

Download:
PrintGoogleHeader.jar

Expected result:
Prints HTTP header information in the terminal.

18681776213955_ pic


6. BufferedReaderExample

A simple interactive console example that reads user input and prints it back.

Download:
BufferedReaderExample.jar

Expected result:
The app accepts typed input and echoes it in the terminal.

18691776213958_ pic


Swing GUI Applications

7. HelloWorldSwing

A minimal Swing desktop GUI example.

Download:
HelloWorldSwing.jar

Expected result:
A small Swing window opens successfully on Android.

18641776213942_ pic


8. Logisim Evolution

A more advanced Swing application used for digital logic design and simulation.

Download:
logisim-evolution-3.8.0-all.jar

Expected result:
The full desktop-style Swing UI runs on Android, including menus, toolbars, panels, and interactive editing.

18701776213962_ pic