Mac OS java version problem for jar files - macos

I have already developed a setup.exe for windows, having features like autodetecting JRE version, autoinstalling required JRE version, autostart on windows start etc. I have made this exe from a jar file(jar file was not having the above mentioned features. Features are added later when transforming a JAR to EXE. Now I was wondering if I can somehow convert exe to DMG, APP or JAR or I can add the above mentioned features in my JAR file only.) By default Mac comes with Java version 5 and my application needs minimum Java version 6 to run

The normal way to distribute a Java application on a Mac is different than on Windows. You don't need a native binary to run a Java application on Mac because you can bundle it into an application (.app) file.
JarBundler, which is part of the Xcode Deveoper Tools, helps you insert your JAR file into a new .app file. You'll also specify your icon at this stage and the main class.
The app file is really just a folder. You can open the .app file as a folder by option-clicking on the application file and choosing "Show Package Contents" in the pop-up menu. Sometimes you may need to tweak the Info.plist file in the application, as there are a lot of options. There is complete documentation about the Info.plist file on the apple's developer website.
Once you have your application, you can bundle that up into a Package using PackageMaker, also part of the Xcode Developer Tools.
Further, you can bundle the package into a disk image (DMG) using DiskUtility, which you'll find in the Utilities folder.
Regarding Java versions, prior to Snow Leopard, Java 6 was only available for Intel Macs. If you require Java 6, you'll need to require that they have an Intel Mac with the latest updates or have Snow Leopard. Alternatively, you could package SoyLatte into your app to replace the native Java runtime. You'd basically be distributing a 32-bit version of Java 6 with your app.

Java 1.6 is not released for all macs. Mine for one does not have it there is nothing you do about it.
As for creating a dmg. In the mac os x install cd is a package called developer tools. Which includes an application called Jar Bundler that allows you to wrap jar's in to apple's .app files(exe's for mac). As for a dmg image you can create it from command line or from ant target.

Related

Macdeployqt doesn't include Phonon in the .app bundle

Hello fellow programmers!
I have written a video player using Qt. Everything works fine on my Mac, but when I use macdeployqt to deploy my application and I open the result, I am getting the following message:
WARNING: bool Phonon::FactoryPrivate::createBackend() phonon backend plugin could not be loaded
WARNING: Phonon::createPath: Cannot connect Phonon::MediaObject ( no objectName ) to Phonon::AudioOutput ( no objectName ).
WARNING: bool Phonon::FactoryPrivate::createBackend() phonon backend plugin could not be loaded
...
And of course it doesn't play audio (in my machine or in another). Maqcdeployqt does include the other parts of Qt and the 3 party libs wo problems. Its just the damm Phonon.
I feel that i'm making a dumb mistake but i just cant find it.
The otool log of my app shows:
#executable_path/../Frameworks/phonon.framework/Versions/4/phonon (compatibility version 4.4.0, current version 4.4.0)
As the only reference of phonon.
I read in the documentation of qt the following:
"The Mac deployment tool can be found in QTDIR/bin/macdeployqt. It is designed to automate the process of creating a deployable application bundle that contains the Qt libraries as private frameworks.
The mac deployment tool also deploys the Qt plugins, according to the following rules:
-Debug versions of the plugins are not deployed.
-The designer plugins are not deployed.
-The Image format plugins are always deployed.
-SQL driver plugins are deployed if the application uses the QtSql module.
-Script plugins are deployed if the application uses the QtScript module.
-The svg icon plugin is deployed if the application uses the QtSvg module.
-The accessibility plugin is always deployed. "
Maybe i have a debug version of phonon? I don't know, i have tried to deploy the debug and the release versions and none have worked.
Also i founded a related problem in this page:
http://www.justinfx.com/tag/phonon/
So i included a folder named 'PlugIns' in my bundle with the phonon_backened folder from my system inside of it after the deploy: it played audio on my machine (but it didn't play it on another) and my app crashed at the end so that cant be the way.
I'm using c++, Qt 4.8.5, the phonon from the SDK (i didn't install any version of phonon, i just installed Qt), and Mac OS X (10.6.8)
I would love to hear any idea or suggestion.
Thanks in advance.
I didn't find the source of the error, but I bypassed it by macdeploying the phonon example from the qt examples folder on another Mac (i.e. Lion). It included the folder 'Plugins' inside the bundle with all the phonon stuff, so I include now that folder into the bundles macdeployed in my Snow Leopard manually. It is ugly but it works from now.
If anyone knows the way to really fix the issue I will be happy to hear it.
I used py2app (neither pyinstaller nor cx_freeze worked) and it created the app distribution folder almost perfectly, except it did not copy the phonon backends. Running macdeplpyqt did not help.
The location of your plugins in your app structure is MyApp.app/Contents/PlugIns so I copied over the folder from Qt install (/Developer/Applications/Qt/plugins/phonon_backend/ ) into the PlugIns folder. That still gave the same error.
Digging in further I saw that MyApp.app/Contents/Resource/qt.conf file is expecting the plugins to be in the Resource/qt_plugins folder so I made a symbolic link from from PlugIns MyApp.app/Contents/PlugIns to MyApp.app/Contents/Resource/qt_plugins and everything works now.

Deployment- Java Application

I have created a Java application. And its ready for deployment.
I have made jar file from my code. wrapped it using launch4j and bundled jre with it and accessing my exe file(generated by launch4j).
So,No need to install JRE and Everything works fine.
But one small problem is that my Exe file has to be at some predefined relative path to the Bundled JRE.
For example let say user has installed it in E:/(My Soft) where My soft contains JRE files an my Exe file. Now if user copies the exe file to his desktop then he will not be able to execute it.
So, I want to is there any way i can bundle jre within my exe or any other tweek so that user can Execute the exe file from anywhere on his pc ?
Try use jnlp starter for your programms. Read more in official oracle documentation JNLP
There's one option to bundle JRE with exe is to create a Portable Edition app with for example jPortable. So you can execute exe anywhere on the PC without installing JRE. But the better option is to create a custom installer which will check current installation of JRE in the client PC and install it as an required option if no other compatible JRE found.

Missing file when deploying Qt app on Mac OSX

I'm trying to deploy a Qt application on Mac OSX so I'm running this command:
macdeployqt Example.app
It mostly seems to work as the executable grows in size so I assume the relevant plugins and libraries are being added. However, in the end macdeployqt outputs this error message:
ERROR: no file at "/usr/local/pgsql/lib/libpq.5.dylib"
Does anybody know what this file is? Do I need to install something to make it work?
The documentation states: SQL driver plugins are deployed if the application uses the QtSql module. The macdeployqt tool does not know which plugins your application uses, and tries to deploy all of them. Your application does not link directly with any of the plugins, so there's no way to tell what it uses merely by looking at the executable. The macdeployqt tool would need to parse the code of your application, or use potentially breakable heuristics to scan for sql driver name strings. It's a shortcoming of the macdeployqt tool.
A temporary workaround would be to move the unused plugins out of the plugins/sqldrivers folder in QtSdk.
Note: The Example.app is not an executable. It is an application bundle -- a folder with stuff in it and you can inspect its contents in the usual way: from the shell, or via Finder by right-clicking on the application bundle.

Static linking wxHaskell on Mac OS X

I want to distribute a wxHaskell application on Mac OS X. How do I go about creating a Mac OS X app which can be used standalone without the user having to install any extra libraries?
I noticed the cabal-macosx project which makes .app bundles for Mac OS X. When I built the example wxHello application, the app bundle worked fine on my machine (after adding extra-lib-dirs: /usr/lib to the .cabal file). But when I tried it on another machine, I got the error: Dyld Error Message: Library not loaded: /Users/binil/.cabal/lib/wxc-0.90.0.3/ghc-7.0.4/libwxc.dylib.
You can place the required dylibs in the Contents/Resources folder within your app bundle, as that is part of the search path for dylibs. You can automate this using the project's copy files build phase.
Technically (though this does not always work for all dylibs), you should be able to pull it off "correctly" by converting the dylib to a Framework, then linking against it in your XCode project. There is a conversion script available [note: download].

packaging air application with air runtime in one installer - windows .exe

I've been approved to distribute the adobe air run time. I've been able to a packaged .dmg file without any problems, now I'm trying to create a package of my application with the runtime for windows.
I've followed the same instructions and the windows installer (MyApp 2.0 Installer.exe) is working properly when I double click it form the installer directory that I created.
Now I'm trying to package everything from that directory into one .exe file. I've tried using the standard windows Iexpress, but it doesn't seem to work properly.
I'm just wondering how I should go about creating the final .exe file.
It's easy enough, but you need a license from Adobe to be able to distribute Air with your application. Personally, I'm not a fan of distributing Air in the installer because of the extra filesize it adds.
Here's how you can create a native .exe installer:
Install the SDK:
If you haven't already done so, download the AIR SDK and extract it to C:\AIR
Hit Win+R, and type control.exe sysdm.cpl,System,3 - press OK
Click Environment Variables...
In the lower pane (System variables), find Path and click Edit...
On the end, add ;C:\AIR and hit OK all the way out
Compile:
Open a Command Prompt window, and cd to the location of your .air file
Run this command:
adt -package -target native "Output file.exe" "Input file.air"
N.B.:
You must use ADT on the same operating system as that of the native installer file you want to generate. So, to create an EXE file for Windows, run ADT on Windows. To create a DMG file for Mac OS, run ADT on Mac OS. To create a DEB or RPG file for Linux, run ADT from the AIR 2.6 SDK on Linux.
Just as your .air file can be signed, your .exe file can be signed too
For more information, see the Packaging a desktop native installer article on Adobe's website

Resources