How To Make a Mac Application/Installer (Java) Properly on Windows? - java

I simply want to make a JAR file or APP file from my Windows machine that mac users can run and see a more professional application.
Most importantly, I want the menu bar title to say the program's NAME not the launcher package! I find this really annoying since, when programming for Windows, you don't have to worry about that kind of crap. Windows just shows the user whatever you name your JFrame when you create it. Mac puts the full Launcher package name in the upper left-hand corner:
i.e. com.blah.initial.Launcher
I've learned some from a Java Tutorial that covered bringing Java applications to Mac, but it didn't talk very much about how to do it from a Windows machine.
I am aware that an XML file is needed to tell the Mac program information.... but I'm not sure how to create and package all of it on Windows.
Any help would be appreciated.

As seen in this example, a Mac application bundle is just a directory tree with a name ending in .app. Once everything is laid out, just build your JAR and copy it to the destination directory, as shown in the build target of the project's build.xml.
Do JWS applications show the application title in the task bar?
Mac OS X has both menu bar and dock; the latter is similar to the task bar. In both,
When double clicking an unadorned JAR, the fully qualified Main-Class name appears.
When launched via java-web-start, the name is taken from the the title property.
For an application bundle, the name is taken from the -Xdock:name property.

Related

How to export my program into a runnable desktop file?

first time posting here, java beginner.
I made a basic calculator that receives user input. Is there a way to export my program to make a runnable desktop file?
My IDE is IntelliJ.
Thanks in advance!!
Assuming you are building a JavaFX app:
The easiest way to deploy your app is to go to File>Project Structure>Artifacts.
Add your available elements (if you have any extra images etc) into your output root, and click on your jar file. At the bottom of the window you'll see options to either create a manifest file or modify an existing one.
The manifest file describes the first class to load in your program (the starting point) as well as the locations of any third party libraries you may have included in your program.
You will also have a JavaFX tab that you can use to set some initial parameters for your app, such as the title, version, and whether you want to deploy any native bundles (eg: .exe for Windows, .deb for Ubuntu etc)
Once you have configured the important parameters you want, save your settings (or just select any field and click enter) and go to Build>Build Artifacts>Action: Build
IntelliJ should generate an executable .jar file and any native bundles you selected. The native bundles can just be double clicked, and the jar file can be run using a JRE.
On blog.jetbrains.com they show the steps with some screenshots.
Note that this entire process is called deploying your app and there are a variety of tools and methods to do it. I just described what I believe is the simplest way.

RCP exported EXE shows java console

I've created a very simple RCP application (essentially just a default view).
I then created a product file and Exported the product (as many online guides have demonstrated). However when I run the .exe file a java console is shown alongside my application splash screen. Is this normal behaviour? (I wasn't expecting a console to show as it's been exported/deployed).
Current research suggests I should:
run with javaw.exe
use another installer
Any further insight or advice would be appreciated.
Look in the .product file at the 'Program Arguments' (on the 'Launching' tab in the editor). Remove the '-consoleLog' argument.

Eclipse product export wizard produces an exe that requires administrator rights to run

I am creating an RCP app that i want to build using the eclipse product export wizard however every time i do the export it builds fine but the exe within the build requires admin rights to run.
I thought it was something to do with the configuration on the product so i added:
osgi.configuration.area
#user.home/Updater/configuration
osgi.instance.area
#user.home/Updater/workspace
This however dose not make any difference.
I am quite confused with this as i basically copied a product from the last app we made and it is basically identical but that export produced an exe that did not require admin.
Could it be a particular plugin i have in the dependencies that specifies admin?
It turned out to be the Launcher Name field in the Launching tab on the product.
If you put "updater" anywhere in the name of the launcher it will produce an exe that requires admin rights to run...
I am unsure why this happens maybe it is an eclipse thing when they compile the exe?
I just changed the name to something without Updater as the name and all went back to normal :D

How do I package a Java program for Ubuntu?

I have an application that currently a user downloads and runs an install script. I want to be able to take the JAR file and such that is generated by NetBeans and make it into a package that a user can download through a package manager. It needs to have menus implemented as well (the entries in the Debian menu that the user can click on).
Currently I am following through this tutorial: http://packaging.ubuntu.com/html/packaging-new-software.html
However, I am worried that I am going down some kind of rabbit hole in the wrong direction. Surely this must be something that is common?
What is the standard procedure for getting your JAR file to other people through packages?
I needed to:
Install dpkg.
Create a directory structure similar to how I would like it unpacked.
Create a shell script that would copy it there.
Run dpkg.

Installing and Running Java application on Macs

I have a java desktop application for which I am trying to create a Mac application package. The application is composed of two runnable jar files and several folders of text and images. The first jar acts as an updater and launcher for the second jar which is the bulk of the application. The application uses a variety of data files and images that are referenced in the application by relative path name (e.g. ./images/bits/xyz.jpg).
On Macs, however, I am having trouble getting the relative pathnames to work after creating a Application Bundle with Jar Bundler. I have no personal experience with Macs and need help understanding the standard way to laying out an application on them. I have noticed that other applications that I have installed come as a disk image file that opens with instructions to drag the app into the applications folder. I am trying to create a similar install package. Thank you in advance for your advice.
Drag and drop instruction in a disk image is a complete red herring. Once the app bundle is correctly made, it does not matter whether it's in the disk image or it's just zipped.
Note that on Macs, executables (whether native Cocoa or Java) don't have its current directory set to the path of the executable. So, you first need to get the current absolute path of the jar file, say. For that, there are already Q&As on Stack Overflow. See e.g. here.
You might need a Mac in order to create a proper Java Bundle and a DMG file.
Here is a simple example:
http://www.centerkey.com/mac/java/
And here is a tutorial on how to make use of Mac-specific Swing features:
http://java.sun.com/developer/technicalArticles/JavaLP/JavaToMac3/
As a developer with Pyxis Software, I would like to add that we have developed an application that solves this issue. The application named Pyxis Bundler will automatically bundle your jar file and optional libraries into a standard Mac application.
You can optionally embed the JRE from your JAVAHOME directory or select a specific JRE. While this will clearly enlarge the size of your application, the user does not need to have JAVA pre-installed on their machine to run your application.
There is also an option to create a modern Apple Icon image (multi size ICNS file).
We designed this as a replacement for the Jar Bundler application that used to be shipped with Xcode up to a number of years ago.
Pyxis Bundler saves each unique application settings to a preferences file, so if or when you update your Mac application, you only need to select the application name from a drop-down list to load all previously used data for that application. Then simply increment your version number and click the Create button.
I should add that with Pyxis Bundler you must use proper package names.
More information is available here:
https://explorepyxis.com/shop
http://www.pyxis.ie/explore/index.php/software/pyxis-jar-bundler
You can check-out how to name packages here: https://docs.oracle.com/javase/tutorial/java/package/namingpkgs.html

Categories

Resources