Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Conversion of .class to jar and .class to exe

How do I convert:

  • class file to jar file using cmd?
  • class file to exe file?
  • jar file to exe?

Can I convert exe file to jar file?

like image 898
Suhail Gupta Avatar asked Mar 13 '11 17:03

Suhail Gupta


People also ask

Can we convert JAR file to exe?

Launch4J is so far the best wrapper available for converting JAR files to windows executable. It is written in JAVA and is open source. Download latest version of Launch4J from http://launch4j.sourceforge.net/. Once You install and open it, you will get the following screen.

Is jar same as exe?

An Exe file is an executable file that can be executed in Microsoft OS environment. Jar file is container of Java Class files, including other resources related to the project. Jar file can be executed only if Java run time environment.


2 Answers

Class files to jar files

Usage: jar {ctxu}[vfm0M][jar-file]

[manifest-file] [-C dir] files ...

Options:

-c  create new archive

 -t  list table of contents for archive

 -x  extract named (or all) files from archive

 -u  update existing archive

 -v  generate verbose output on standard output

 -f  specify archive file name

 -m  include manifest information from specified manifest file

 -0  store only; use no ZIP compression

 -M  do not create a manifest file for the entries

 -i  generate index information for the specified jar files

 -C  change to the specified directory and include the following

file If any file is a directory then it is processed recursively. The manifest file name and the archive file name needs to be specified in the same order the 'm' and 'f' flags are specified.

Example 1: to archive two class files into an archive called classes.jar:

`jar cvf classes.jar Foo.class Bar.class` 

Example 2: use an existing manifest file 'mymanifest' and archive

all the files in the foo/ directory into 'classes.jar':

jar cvfm classes.jar mymanifest -C foo/ .

Convert jar files to .exe file

1)JSmooth .exe wrapper

2)JarToExe 1.8

3)Executor

4)Advanced Installer

Convert .class to .exe is discussed in length here

like image 190
ayush Avatar answered Sep 21 '22 23:09

ayush


You must have missed this. Please look into Java Archive (JAR) Files Guide.

And surely missed Real's How to for it Make a JAR executable There are multiple wrappers that do this work (converting Jar to exe, platform specific). You just need to search in StackOverflow for Jar exe

like image 42
Nishant Avatar answered Sep 21 '22 23:09

Nishant