Java Application For Mac



  1. Java Application For Mac
  2. Java Application For Mac Operating System
  3. Java Application For Mac Shortcut

So I've build a java application and I have to send it to a client that is using mac. I know that you can run.jar on mac using java -jar app.jar from terminal, but I want a double-clickable icon that a client can only click on and start the program.

  1. 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.
  2. Java for macOS 2017-001 installs the legacy Java 6 runtime for macOS 10.13 High Sierra, macOS 10.12 Sierra, macOS 10.11 El Capitan, macOS 10.10 Yosemite, macOS 10.9 Mavericks, macOS 10.8 Mountain Lion, and macOS 10.7 Lion.
  3. This page shows you, step by step, how to convert a simple Java application to a version you can distribute on a Mac. To follow along, download the ButtonDemo (.zip) example from the Java Tutorial. This example was created using NetBeans which uses the Ant utility. You can run all necessary tools and make all necessary edits from the command line, without launching NetBeans.

I'm pretty sure my problem is about the same. Basically I cant install the Java 7 update cause I get an error message during download telling me I dont have mac os x 10.7 or higher....but I do. The Oracle Java update for Lion just isnt recognizing it! I have mac os x lion 10.7.5 on my laptop and for some reason, certain Pogo games wont load...it says its loading but never does and just closes. I went to the help page, did what it said, I scanned for current updates, installed them, rebooted then went back to Pogo and clicked on the java test link to see what version im running. I got the error 'missing plug in' so I clicked on it and was taken to Java's website for instructions, clicked 'Download Java for Mac OS X,' then hit sytem requirements and saw that I had to be running os x 10.7.3 or above and I have 10.7.5. I was good to go, hit download and now Im here! Annoyed and confused beause updates and upgrades are pretty basic and simple. You either meet the system requirements or you dont. I meet them but cant get them cause it says I dont....its a viscious cycle and Im rambling like a madwoman! Is there an easy yes or no answer to this, maybe a follow steps 1,2,3 A,B,C you can post for non computer savvy moms? LOL I just want the handful of Pogo games I used to be able to play, to play again...nothing complicated! And why is it only some games and not all of them? Dont answer that, my hair already hurts...haha


Im not much of a computer person, but Im sure thats more than obvious, so my apologies if my problem has nothing to do with this one....tell me where to go or what forum to read thru for help. I also want to pologize in advance for the help Im gonna need after I get this updated! lol I hear the update has something screwy with the plugins being enabled and that its another nightmare with this whole new oracle java deal. Hmmm, maybe I shouldnt even do this java update. 😕 😁

Nov 29, 2012 2:37 PM

In this tutorial, you will learn how to create, run, and package a simple Java application that prints Hello, World! to the system output. Along the way, you will get familiar with IntelliJ IDEA features for boosting your productivity as a developer: coding assistance and supplementary tools.

Watch the screencast and follow the step-by-step instructions below:

Prepare a project

Create a new Java project

In IntelliJ IDEA, a project helps you organize your source code, tests, libraries that you use, build instructions, and your personal settings in a single unit.

  1. Launch IntelliJ IDEA.

    If the Welcome screen opens, click Create New Project.

    Otherwise, from the main menu, select File | New | Project.

  2. In the New Project wizard, select Java from the list on the left.

  3. To develop Java applications in IntelliJ IDEA, you need the Java SDK ().

    If the necessary JDK is already defined in IntelliJ IDEA, select it from the Project SDK list.

    If the JDK is installed on your computer, but not defined in the IDE, select Add JDK and specify the path to the JDK home directory (for example, /Library/Java/JavaVirtualMachines/jdk-13.0.1.jdk).

    If you don't have the necessary JDK on your computer, select Download JDK. In the next dialog, specify the JDK vendor (for example, OpenJDK), version, change the installation path if required, and click Download.

  4. We're not going to use any additional libraries or frameworks for this tutorial, so click Next.

  5. Don't create a project from the template. In this tutorial, we're going to do everything from scratch, so click Next.

  6. Name the project, for example: HelloWorld.

  7. If necessary, change the default project location and click Finish.

Create a package and a class

Packages are used for grouping together classes that belong to the same category or provide similar functionality, for structuring and organizing large applications with hundreds of classes.

  1. In the Project tool window, select the src folder, press Alt+Insert, and select Java Class.

  2. In the Name field, type com.example.helloworld.HelloWorld and click OK.

    IntelliJ IDEA creates the com.example.helloworld package and the HelloWorld class.

Together with the file, IntelliJ IDEA has automatically generated some contents for your class. In this case, the IDE has inserted the package statement and the class declaration.

This is done by means of file templates. Depending on the type of the file that you create, the IDE inserts initial code and formatting that is expected to be in all files of that type. For more information on how to use and configure templates, refer to File templates.

Java Application For Mac

Java application for pc

The Project tool window Alt+1 displays the structure of your application and helps you browse the project.

In Java, there's a naming convention that you should follow when you name packages and classes.

Write the code

Add the main() method using live templates

  1. Place the caret at the class declaration string after the opening bracket { and press Shift+Enter.

    In contrast to Enter, Shift+Enter starts a new line without breaking the current one.

  2. Type main and select the template that inserts the main() method declaration.

    As you type, IntelliJ IDEA suggests various constructs that can be used in the current context. You can see the list of available live templates using Ctrl+J.

Live templates are code snippets that you can insert into your code. main is one of such snippets. Usually, live templates contain blocks of code that you use most often. Using them can save you some time as you don't have to type the same code over and over again.

For more information on where to find predefined live templates and how to create your own, refer to Live templates.

You can also add the statement using the sout live template.

Call the println() method using code completion

After the main() method declaration, IntelliJ IDEA automatically places the caret at the next line. Let's call a method that prints some text to the standard system output.

  1. Type Sy and select the System class from the list of code completion suggestions (it's from the standard java.lang package).

    Press Ctrl+. to insert the selection with a trailing comma.

  2. Type o, select out, and press Ctrl+. again.

  3. Type p, select the println(String x) method, and press Enter.

    IntelliJ IDEA shows you the types of parameters that can be used in the current context. This information is for your reference.

  4. Type '. The second quotation mark is inserted automatically, and the caret is placed between the quotation marks. Type Hello, World!

Basic code completion analyses the context around the current caret position and and provides suggestions as you type. You can open the completion list manually by pressing Ctrl+Space.

For information on different completion modes, refer to Code completion.

Build and run the application

Valid Java classes can be compiled into bytecode. You can compile and run classes with the main() method right from the editor using the green arrow icon in the gutter.

  1. Click in the gutter and select Run 'HelloWorld.main()' in the popup. The IDE starts compiling your code.

  2. When the compilation is complete, the Run tool window opens at the bottom of the screen.

    The first line shows the command that IntelliJ IDEA used to run the compiled class. The second line shows the program output: Hello, World!. And the last line shows the exit code 0, which indicates that it exited successfully.

    If your code is not correct, and the IDE can't compile it, the Run tool window will display the corresponding exit code.

When you click Run, IntelliJ IDEA creates a special run configuration that performs a series of actions. First, it builds your application. On this stage, compiles your source code into JVM bytecode.

Once javac finishes compilation, it places the compiled bytecode to the out directory, which is highlighted with yellow in the Project tool window.

After that, the runs the bytecode.

Java Application For Mac Operating System

Automatically created run configurations are temporary, but you can modify and save them.

If you want to reopen the Run tool window, press Alt+4.

IntelliJ IDEA automatically analyzes the file that is currently opened in the editor and searches for different types of problems: from syntax errors to typos. The Inspections widget at the top-right corner of the editor allows you to quickly see all the detected problems and look at each problem in detail. For more information, refer to Instant analysis of the current file.

Java Application For Mac Shortcut

Package the application in a JAR

When the code is ready, you can package your application in a Java archive (JAR) so that you can share it with other developers. A built Java archive is called an artifact.

Create an artifact configuration for the JAR

  1. From the main menu, select File | Project StructureCtrl+Alt+Shift+S and click Artifacts.

  2. Click , point to JAR and select From modules with dependencies.

  3. To the right of the Main Class field, click and select HelloWorld (com.example.helloworld) in the dialog that opens.

    IntelliJ IDEA creates the artifact configuration and shows its settings in the right-hand part of the Project Structure dialog.

  4. Apply the changes and close the dialog.

Build the JAR artifact

  1. From the main menu, select Build | Build Artifacts.

  2. Point to HelloWorld:jar and select Build.

    If you now look at the out/artifacts folder, you'll find your JAR there.

Run the packaged application

To make sure that the JAR artifact is created correctly, you can run it.

Use Find ActionCtrl+Shift+A to search for actions and settings across the entire IDE.

Create a run configuration for the packaged application

To run a Java application packaged in a JAR, IntelliJ IDEA allows you to create a dedicated run configuration.

  1. Press Ctrl+Shift+A, find and run the Edit Configurations action.

  2. In the Run/Debug Configurations dialog, click and select JAR Application.

  3. Name the new configuration: HelloWorldJar.

  4. In the Path to JAR field, click and specify the path to the JAR file on your computer.

  5. Under Before launch, click , select Build Artifacts | HelloWorld:jar in the dialog that opens.

    Doing this means that the HelloWorld.jar is built automatically every time you execute this run configuration.

Run configurations allow you to define how you want to run your application, with which arguments and options. You can have multiple run configurations for the same application, each with its own settings.

Execute the run configuration

  • On the toolbar, select the HelloWorldJar configuration and click to the right of the run configuration selector. Alternatively, press Shift+F10 if you prefer shortcuts.

    As before, the Run tool window opens and shows you the application output.

The process has exited successfully, which means that the application is packaged correctly.

Last modified: 19 August 2020