Griwes
Griwes

Reputation: 9029

Embedding executable in Java application

How can I embed binary file (executable, to be exact) in Java application? Is there a way to read a file during compile time, or do I have to copy hexadecimal dump into source code of the application ?

Upvotes: 1

Views: 2329

Answers (1)

Jar files are zip files with extra meta-data. You can easily embed an exe-file in your jarfile directly.

You cannot easily have Windows execute the EXE-file inside your zip-file, but you can read it from your classpath resource and write it to a temporary file with an ".exe"-suffix, and then execute that.

Upvotes: 5

Related Questions