Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Deploy Java application on MacOSX (from a Windows system)

Here's the deal. I'm just starting with Java programming, I've made a simple application that uses SWT graphic library and I want to deploy it on a Mac (running the latest version of MacOS X). I did all the programming in my Windows 7 machine, so here are my questions:

Q1) Can I make an executable file for MacOS X from my Windows machine? How? (I saw that it's possible to create .exe files on Windows, instead of using .jar; I want to do the same for the Mac, of course it won't be an .exe)

Q2) If I export my project in Eclipse and I choose Runnable JAR File and then on Library Handling I pick Extract required libraries into generated JAR or Package required libraries into generated JAR I end up with a huge .JAR (about 15MB of size, my application consist in just a button on a Window and a tiny method that doesn't do much). Is that considered normal? Here's the list of libraries that my project appears to be using:

alt text

Thanks in advance.

like image 364
Tute Avatar asked Sep 11 '26 22:09

Tute


2 Answers

Q1: You have to bundle the jar inside an application bundle, there is this tutorial directly from Apple..

Q2: Yes, it's 15mb because all the referenced libraries that does not reside inside the JRE System Library are included inside the final jar. There are different approaches:

  • bundle all together like you are doing
  • bring other .jars together with yours without packing them
  • install the jar separately, they must be copied once into $JAVA_HOME/lib/ext and then every application on the same JRE will have them
like image 195
Jack Avatar answered Sep 13 '26 12:09

Jack


In order to export an application to multiple platforms, install the Eclipse Delta pack on you development machine. Here's a tutorial. After you install it, you can export your eclipse application to any target (Windows, Linux, OSX, etc).

EDIT: Here's another tutorial.

like image 45
drstupid Avatar answered Sep 13 '26 13:09

drstupid



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!