Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Convert .jar to an application for Windows, Linux & Mac

I made a Java application with Eclipse (exported in *.jar), and I want to export it for Windows (.exe), Linux (.?) and MAC (.?). I don't own any Linux or MAC machine, so I don't know what extension file is required for each one. So I have several questions :

  • For Windows, I used Launch4j to create my *.exe file, but is there any equivalent for MAC and Linux ?

  • My application saves options into the Windows registry (I used the "JavaRegisrtyWrapper" library). Is there any "registry" equivalent for MAC and Linux (and how can I read/write informations there) ?

  • Is it possible to avoid the Windows alert "Unknown publisher" for users when they try to launch the *.exe file after the download ? (And will I have the same problem on MAC and Linux ?). I tried to create my own certificate, and to sign the file with "signtool.exe" but it didn't work.

Thanks !

EDIT : Before converting the *.jar file into any other format, I have to modify my code to get user's OS, and the "documents" folder for each case. I think os.name can satisfy the first request, but can I use user.home + "Documents" for Windows, Linux & Mac (if this folder exists...) ?

like image 360
Deaudouce Avatar asked Jun 30 '16 13:06

Deaudouce


1 Answers

Script which runs JAR application

On Linux and Mac OS you can create a bash script which runs .jar file :

#!/bin/bash java -jar application.jar

Windows registry equivalent on Unix-based systems

There is no Windows registy equivalent on Linux and Mac Os. You can store your configuration in i.e. text files. Machine specific configs are typically stored in the /etc directory tree.

Here is a similar superuser question: https://superuser.com/questions/295635/linux-equivalent-of-windows-registry

Signing a Windows EXE files

For signing Windows exe files you can try using Microsoft's Sign Tool.

Here is a similar stackoverflow question: Signing a Windows EXE file

like image 80
mariuszs80 Avatar answered Sep 21 '22 13:09

mariuszs80