Executing a Java Application in an End User System

The Java 2 Runtime Environment is the minimum standard Java computing environment for running applications written in the Java programming language. It contains the Java virtual machine, Java core classes, and supporting files. It does not contain any of the development tools (such as applet viewer or javac) or classes that pertain only to a development environment. By default, the installer puts copies of the java and javaw in the Windows directory.

To execute a Java program in a end user system which does not have JDK installed, you should pack the .class files and other resources (like icons) in a .jar file. While creating your .jar file, you have to specify your application’s starting point (i.e. main method). The manifest file takes care of it and should contain following code:

 Main-Class: 

The .jar file can be created by passing:

 Jar cfm   

Just by clicking the .jar file, the java program can be executed. The end user system should have JRE installed. If you want, the .jar file can be zipped to contain additional files, such as the readme file, by passing:

 Jar cfM  
Share the Post:
Share on facebook
Share on twitter
Share on linkedin

Overview

Recent Articles: