- Make A Java Based App Work On Mac Computer
- Run Java On Mac
- Make A Java Based App Work On Mac Download
- Install Java On A Mac
- How To Update Java On Mac
Good news everyone!
- When prompted with Web App option, accept the defaut option create by pressing enter or select an existing app. When prompted with OS option, select Linux by pressing enter. When prompted with Pricing Tier option, select B2 by entering 2. Use the default Java version, Java 8, by pressing enter. Use the default web container, Tomcat 8.5, by pressing enter.
- I'm trying to make a Mac app (specifically a GUI) in Java. However, I'm not having much success. Here's what I've tried so far: Double-clicking the executable JAR file produced by Eclipse. RESULT: Exception thrown because the Display that I create for my app must be created on the main thread.
The Mac is a great platform for Java developers with a wide array of commercial, free, and open source development tools available. Whether or not you develop on a Mac, take the time to make a small number of changes to your application so that you provide a Mac-like experience for the millions of potential customers who already use Mac OS X. How to create a macOS installer for a Java application (.jar) (Updated for macOS Mojave 10.14) This information is for an older version of macOS. For more current information, visit: Mac Java! It's simple to turn your Java Swing program (.jar) into a proper macOS application with a native installer.
You can now put your Java 8 applications onto the mac app store. How do I know? Because I put a little hackathon app I wrote on the Mac App Store. The better news is that Oracle is working on making this very simple with the JavaFX packager. You can get some of the early bits in the open source repo for OpenJFX here (building and using open source code is left as an exercise for the reader).
If you don’t want to wait for the code to get an official release and you are comfortable doing stuff by hand then here are the steps you will need to follow.
Prepare your Environment
First you will need to be signed up as part of the Mac Develoer program at [developer.apple.com]. For this tutorial I will presume your name is
Alice Duke
, that your Team ID is JJJJJJJJJJ
and that the app you are shipping is titled AwesomeJavaApp
. You will of course need to change these to real values.https://raaoddk.weebly.com/open-wine-app-mac.html. Download your signing keys if you haven’t done so already (here’s how). You will need both the Mac App Distribution and Mac Installer Distribution, and they should automatically be placed in your keychain under the names
3rd Party Mac Developer Application: Alice Duke (JJJJJJJJJJ)
and 3rd Party Mac Developer Installer: Alice Duke (JJJJJJJJJJ)
.You will also need an entitlements file. Read all about them at the Mac Developer Library. You will have to turn on the app-sandbox entitlement as well as any of the other entitlements you will be using. Be sure to keep track of what entitlements you grand and why they are needed. Apple will be asking you to justify every one of them.
Next, create your Mac
.app
bundle the normal way you are doing with the javafxpackager, Ant, Maven, or Gradle build. Make sure this app works as it is what we will be bundling up.Next, you will need to copy the info.plist from the existing JDK or JRE into the embedded JRE in your app. It should be either at
/Library/Java/JavaVirtualMachines/jdk1.8.0.jdk/Contents/Info.plist
or /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Info.plist
, but it is likely to be the first one. Copy this file to AwesomeJavaApp.app/Contents/PlugIns/jdk1.8.0.jdk/Contents/Info.plist
.Now we need to strip a library. The Mac App Store doesn’t accept apps that even mention the deprecated Quicktime API, so we will need to remove the media capabilities tom JavaFX. If your app uses the JavaFX media apis you are out of luck for the time being. There is a bug to fix this in a future release.
The good news is that the Java 8 license lets us fix the problem, at least when it comes to JavaFX. Remove the file
libjfxmedia.dylib
.Signing the app (in may different places) is next. Apple loves their cryptographic hashes.
First, you may need to make the JDK in the app bundle writeable. The
codesign
program won’t sign read-only binaries. chmod -R +w AwesomeJavaApp.app/Contents/PlugIns/jdk1.8.0.jdk
should do the trick.You need to sign all jars, dylibs, and executable files in the bundle (with one exception). Enumerating them is left as an exercise to the reader. Any decent build tool can do it for you. You will need to sign it with both the identity you have and the entitlements you want
There is one caveat. Don’t sign the main excitable of the app bundle. It is in
Contents/MacOS
and has the name of your application, for example it would be AwesomeJavaApp.app/Contents/MacOS/AwesomeJavaApp
. We will get that signed another way.Another quirk is that you can give different entitlements to each file. In the javafxpackger we sign with an entitlements file that contains only the
app-sandbox
andinherit
entitlements, so they inherit all the entitlements from the main application.Next, you will want to sign the Java directory itself. Actually you need to sign all plugins and frameworks in your app, but the overwhelming majority of java apps will only have one plugin: Java.
Finally, we can sign the application itself. Yes, we can actually shave the yak at this point.
You may or may not need all of the flags I’ve show with
codesign
, as I have not exhaustively tested them in all the possibly combinations. You may not need the --deep
flag, but adding it will not get you out of signing all the interior jars and libraries. You may not need the -f
flag but it insures that your signature will be the only one. Finally, you may want to add a --verbose=4
flag to see all the gory details. Or not.I bet you thought you were done? Now we need to create an installer package to send to the app store. Use the
productbuld
too to generate the need fileNote that you are signing this with the second key you downloaded: the one for installers.
If you feel the need you can test the install:
Now you can load it into the Mac App store using the Application Loader tool. You will first need to go to iTunes Connect and set things up. But we have now left the Java specific part of the assembly so there are many other blog posts out there by more qualified and experienced Mac App Store developers.
There are many other potholes that you could run into. Two I hit were not having a 512x512@2x icon, and another was a dispute about copyright on an icon. I changed the icon rather than wade through the appeals process to prove that the icon was in the public domain.
I plan on keeping this post up to date with any changes or corrections, so feel free to bookmark this page.
Before You Begin
Purpose
In this tutorial, you create and build a Java Platform, Standard Edition (Java SE) application using Maven. You install, configure, build, and create an executable Java Archive (JAR) file with Maven.
Time to Complete
Approximately 90 minutes
Background
Maven is a build management tool that is central to project build tasks such as compilation, packaging, and artifact management. Maven uses a strict XML-based rule set to promote consistency while maintaining flexibility. Because most Java-centric continuous integration systems integrate well with Maven, it's a good choice for an underlying build system.The primary goal of Maven is to provide:
- A project model that is reusable, maintainable, and easier to comprehend
- Plug-ins or tools that interact with the declarative model
pom.xml
file. The Project Object Model (POM) is the fundamental unit of the entire Maven system.Maven contains three types of repositories for storing JARs, plug-ins, and other project-related artifacts:
- Local Repository: The location created on your machine when you run your first instance of a Maven command in your machine
- Central Repository: The Maven community-owned repository that contains commonly used libraries
- Friendly streaming mac app hulu not working. Remote Repository: A developer-owned custom repository that contains project-related libraries and JARs
What Do You Need?
- Download and install the latest Java SE Development Kit. For this tutorial, the available version is Java SE 8.
- Download the Apache Maven. For this tutorial, the available version is 3.2.2.
Setting Up the Maven Environment
In this section, you extract the downloaded archive and install the latest Maven version to a directory of your choice. You verify the Java installation, set the Maven environment, and verify the Maven installation.
- Verify the Java installation:
java -version
The output displays the Java version that you installed. - Extract the downloaded Maven x.x.x archive to a local directory.The archive names are:
- Windows OS: apache-maven-3.2.2-bin.zip
- Linux OS: apache-maven-3.2.2-bin.tar.gz
- Mac OS: apache-maven-3.2.2-bin.tar.gz
Note: This OBE shows you how to install and create a Java SE application using Maven in a Windows operating system. - Click Start, right-click Computer, and select Properties.
- On the Control Panel home page, click Advanced system settings.
- In the System Properties dialog box, click the Advanced tab, and then click Environment Variables.The Environment Variables dialog box is displayed.
- Click New, add
M2, M2_HOME,
andMAVEN_OPTS
to the environment variables, and click OK. - Under System variables, click New, enter the following values in the Edit System variable dialog box, and click OK:
- Variable name:
Path
- Variable value:
%M2%
(Enter the value afterbin
in the system path)
- Gradekeeper for mac catalina. Verify the Maven installation:
mvn -version
The output displays the installed Maven version, the Java version, the Java home, the Default locale, and the OS name.
Creating a Java SE Project from a Maven Template
- Open the command prompt, navigate to the directory where you installed Maven, and create
Maven_app,
a Maven-based Java application folder:mvn archetype:generate -DgroupId=com.example.bank
-DartifactId=OracleBanking
-DarchetypeArtifactId=maven-archetype-quickstart
-DinteractiveMode=falseAn archetype is an original pattern/model for creating similar projects. In Maven, an archetype is a template of a project that is combined with user input to produce a working Maven project. The following table describes what the template does:Archetype ArtifactIds Description mvn archetype:generate
Creates a project -DgroupId=com.example.bank
Creates the com.example.bank
dependency package structuremaven-archetype-quickstart
Creates a Java project -DinteractiveMode=false
Sets interactive mode to false
The Java project namedOracleBanking
is created. The following table presents the project details:Project Structure Description OracleBanking
Contains src
folder andpom.xml
src/main/java
Contains Java code files under the package structure
(com.example/bank
)src/test
Contains test code files under the package structure
(com.example/bank
)pom.xml
Contains information about the project and details of various configurations used by Maven to build the project - Open the
OracleBanking
project and verify the Java source file: - Verify Java test file:
AppTest.java
By default, Maven adds theApp.java
source file and theAppTest.java
test file to the default directory structure. - Open the
pom.xml
file and review the code.Each project has a singlepom.xml
file, and eachpom.xml
file has a project element and three mandatory fields:groupId, artifactId,
andversion.
Notice that Maven has already added JUnit as the test framework. The following table describes what each node does:Node Description project
Top-level element in all Maven pom.xml
filesmodelVersion
Object model version that this POM is using groupId
Project groupId (for example, com.example.bank
)artifactId
Project ID (for example, OracleBanking
)packaging
Project files converted into a JAR file version
Project version used in the artifact's repository to separate each version (for example, 1.0-SNAPSHOT
)name
Project display name url
Location of the project site
App.java
Creating and Modifying Java Source Files
In this section, you calculate simple interest by creating the
SimpleInterest.java
source file and modifying the App.java
source file.- Navigate to the directory where you created your Maven project, and then open the specified location:
**Maven_appOracleBankingsrcmainjavacomexamplebank
- Create a Java source file named
SimpleInterest.java.
- Edit the
SimpleInterest.java
file with the following code:ThecalculateSimpleInterest
method calculates the interest rate on the loan amount, the tenure of the loan, and the rate of interest per annum. - Press Ctrl+S and close the file.
- Modify
App.java
with the following code: - Review the code. It should look like the following:
- Press Ctrl+S and close the file.
Creating a Manifest with Maven
In this section, you learn how to use
The manifest file performs the following tasks:maven-jar-plugin
to create a manifest file and package it by adding it to the JAR file.- Defines the entry point of the project and creates an executable JAR file.
- Adds the class path of the project dependencies.
- Edit the
pom.xml
file:You definedmaven-jar-plugin
inpom.xml,
and configured it within the configuration tag. - Review the code. It should look like the following:In the Maven project, you specify the main class details by updating the
pom.xml
file. Thecom.example.bank.App
class in the project is the main class that will be executed when you execute the JAR file. - Press Ctrl+S and close the file.
You successfully updated your
pom.xml
file.Testing, Building, and Running the Application Using Maven
Testing the Application
In this section, you learn how to test your application with
AppTest.java
using the Maven command-line interface (CLI).- Import the package into
AppTest.java:
- How to make a serial key generator. Edit the
AppTest
method: - Review the code. It should look like the following:You modified the simple interest value, and then verified the value by using assert statements in the JUnit test case.
- Press Ctrl+S and then run the test cases in
AppTest.java
inside theOracleBanking
project.mvn test
- Review the output.The test case failed and the assert failed message is displayed.
- Modify
AppTest.java:
You modified the simple interest value, and then verified the value by using assert statements in the JUnit test case. - Press Ctrl+S and then run the test cases in
AppTest.java:
mvn test
The test case executed successfully, and a build success message is displayed.
import junit.framework.Assert;
Building the Application
In this section, you learn how to clean and build your application using the Maven CLI.
Make A Java Based App Work On Mac Computer
- Clean and build your Maven project, and review the output:
mvn clean package
You successfully built theOracleBanking
Java SE application using Maven. - Navigate to the directory where you created
OracleBanking
and notice that atarget
folder was created. - Open the
target
folder, and review the folder structure.Folder name Description classes
Contains .class
files of Java source filestest-classes
Contains .class
files of Java test filesmaven-archiver
Contains the pom.properties
filesurefire-reports
Contains the report of the application when mvn
command is executed.java
Empty Java file OracleBanking-1.0-SNAPSHOT.jar
Contains all the project related details in a single zip file. This is the executable JAR file used to run the application
Packaging and Running the Application
In this section, you learn how to package and run the Java SE project using the Maven CLI.
Run Java On Mac
- Navigate to the directory where you installed Maven, and open the
settings.xml
file.The<localRepository>
tag specifies the local repository location on your machine. By default, the local repository is created in the%USER_HOME%
directory. You can specify another location by updating it in thesettings.xml
file. If you need to set proxy details for the application, then update it in thesettings.xml
file. - Clean and package the files, plug-ins, and libraries before running the application:
mvn clean package
- Use the Maven Local repository to run your Java SE Maven application:
mvn exec:java -Dexec.mainClass='com.example.bank.App' -s '*****location of settings.xml file.********'
- Review the output.You successfully executed the Java SE application named
OracleBanking
using Maven. The simple interest is calculated and displayed in the Maven CLI. - Virtual dj skins free download for windows 7. Execute the JAR file with following commands:
cd target
java -jar OracleBanking-1.0-SNAPSHOT.jar
- Setting default apps mac. Review the output.You successfully executed the
OracleBanking
Java SE application by using Maven. The simple interest is calculated and displayed in the Maven CLI.
Want to Learn More?
- Installing and Configuring Maven for Build Automation and Dependency Management in Oracle Fusion Middleware Developing Applications Using Continuous Integration
Make A Java Based App Work On Mac Download
Credits
Install Java On A Mac
To navigate this Oracle by Example tutorial, note the following:
- Topic List:
- Click a topic to navigate to that section.
- Expand All Topics:
- Click the button to show or hide the details for the sections. By default, all topics are collapsed.
- Hide All Images:
- Click the button to show or hide the screenshots. By default, all images are displayed.
- Print:
- Click the button to print the content. The content that is currently displayed or hidden is printed.
How To Update Java On Mac
To navigate to a particular section in this tutorial, select the topic from the list.