C%2b%2b To Java Converter For Mac

Answer to Using TextPad, convert this C code into java GUI. #include #include using namespace std; int main float x1, y1, z1. Skip Navigation Chegg home.

Note: we recommend to have a proper knowledge of OSX and Java. We’re not going to explain how to do certain things, because the article would be too long.

  1. Convert binary data into java or c sourcecode for easy integration in your project, with the free sfk bin-to-src command for Windows, Mac OS X, Linux and Raspberry Pi. download the free Swiss File Knife Base from Sourceforge. open the Windows CMD command line, Mac OS X Terminal or Linux shell.
  2. C Java; Platform-independent: C is platform-dependent. Java is platform-independent. Mainly used for: C is mainly used for system programming. Java is mainly used for application programming. It is widely used in window, web-based, enterprise and mobile applications. Design Goal: C was designed for systems and applications programming.

One of the most difficult tasks while developing Crazy Belts has been setting the game to OSX. There is little information and very few tools to do it; in fact, only one tool available to pack a jar file into an app. This was a mandatory step to publish our game inside and outside OSX App Store. In Jemchicomac, we used two process for this:

  • Gatekeeper: to publish outside the store
  • Sandbox: to publish inside the store

Gatekeeper prevents third party apps to be run in the system without Apple’s signature and verification. It’s conceived for those apps that come from another stores or websites not related to the App Store. User can disable Gatekeeper, but we consider that’s fair to demonstrate you’re a valid partner of Apple and you app is trustworthy.

On the other hand, Sandbox is a tool that encapsulates you app and check it: if it’s harmful, then Sandbox aparts it from the rest of the operative system. This is an essential requirement to publish in the Mac Store and it has a different signature than Gatekeeper.

Before all of this, as you have imagined, it’s necessary to convert our jar in an app, whatever our commercial goal in OSX is. We need the following tools:

  • App Bundler: https://bitbucket.org/infinitekind/appbundler, that’s going to convert our jar to app. You have to download it, compile and pack it with ant. You must do it in Mac, not Windows.
  • JRE or JDK: you need Java in your computer. It doesn’t have to be Oracle’s Java Virtual Machine, but it’s the one we used.
  • Mac Developer account: essential to sign the app.

Given those ingredients, we can start creating our app. We need Java 7 (in our OSX system, we find only Java 6 as preinstalled). Once we install our JVM with Java 7, we must go to one of the jdk or jre installations. For instance: …/home/Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk. We click on the icon, and if the active version of Java is SE6 we have to disable it , and check SE7.

Now you have to configure Java Home: http://www.mkyong.com/java/how-to-set-java_home-environment-variable-on-mac-os-x/

Once all of this is done, we’re ready for the next step. We create a folder with all necessary thing to build our app (I called mine “build”).

  • A build.xml file with the information for Ant of Java to create our app
  • An empty info.plist file. We just create a file called this.
  • A folder containing appbundler -1.0ea.jar.
  • A dist folder with the jar file we want to convert.
  • Optionally, a icns file that we have previously worked in and contains a whole family of icons with different sizes, to embellish the app file.

Before going on, we have to warn you that all this work is made with the Terminal and we have to go to each directory when required. For instance, if my build folder is at the Desktop, in the Terminal I must go using

[bash]cd desktop/build.[/bash]

For me, build.xml is like this:

[xml]<?xml version='1.0' encoding='UTF-8'?>

<project name='CrazyBelts' default='default' basedir='.'>

<target name='bundle'>

<taskdef name='bundleapp'

classpath='lib/appbundler-1.0ea.jar'

classname='com.oracle.appbundler.AppBundlerTask'/>

<bundleapp

outputdirectory='dist'

name='Crazy Belts'

displayname='Crazy Belts'

identifier='com.company.crazybelts'

shortversion='1.3.0'

version='1.3.0'

icon='icon.icns'

mainclassname='org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader'

copyright='2014 Company'

applicationCategory='public.app-category.puzzle-games'>

<classpath file='dist/CrazyBelts12FINAL.jar'/>

<runtime/>

<!– Workaround since the icon parameter for bundleapp doesn’t work –>

<option value='-Xdock:icon=Contents/Resources/${bundle.icon}'/>

<arch name='x86_64'/>

<arch name='i386'/>

</bundleapp>

</target>

</project>[/xml]

Let’see each entry:

[xml]<project name='CrazyBelts' default='default' basedir='.'>[/xml]

We must change the name to our app name.

[xml]<target name='bundle'>[/xml]

This is the name of our Ant task, meaning this is the one we should use when calling for Ant. In our example, once we’re set in the directory we type:

[bash]ant bundle[/bash]

Taskdef must match the label of the task we want to run. In classpath we type the directory where the AppBundler is located. Finally, we leave classname without changes.

[xml]<bundleapp

outputdirectory='dist'

name='Crazy Belts'

displayname='Crazy Belts'

identifier='com.company.crazybelts'

shortversion='1.3.0'

version='1.3.0'

icon='icon.icns'

mainclassname='org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader'

copyright='2014 Company'

applicationCategory='public.app-category.puzzle-games'>[/xml]

The main block of build.xml:

  • Output directory: we can put here the jar to pack (in our case, we did this), and it’ll also contain the app when it’s created.
  • name: the name of the app
  • display name: the name as displayed
  • identifier: it must match an App ID registered in your Mac Developer account. This registration can be done afterwards, and it’s only necessary if you’re going to distribute in the Mac Store, not for third parties.
  • Shortversion: the game version
  • Icon: this is the icon we mentioned before, in the root of the build folder.
  • Mainclassname: this is a very important entry. We must indicate the class that runs the app. In our case, we used Eclipse and we did spend so much time setting the main class of the app, while this IDE actually used his own Leader class when creating the exe jar.
  • Copyright: our national copyright
  • applicationCategory: our app category code. Visit this link to know more about it: https://developer.apple.com/library/Mac/releasenotes/General/SubmittingToMacAppStore/#//apple_ref/doc/uid/TP40010572-CH16-SW8
[xml]<runtime/>

<!– Workaround since the icon parameter for bundleapp doesn’t work –>

Mac

<option value='-Xdock:icon=Contents/Resources/${bundle.icon}'/>

<arch name='x86_64'/>

<arch name='i386'/>[/xml]

Only runtime.dir is important for us, we don’t touch the rest. This entry is optional and if we don’t include it in our app it won’t have an embedded jdk. Good news are that doesn’t require much space; bad news are that if the user doesn’t have the correct jdk or jre, the app won’t run, so it’s poorly advisable. This includes the path where our jdk is located; if we don’t know it and we’re using Eclipse, we can go to Preferences and check the jre.

After that, we must go to the Terminal and type:

[bash]ant bundle.[/bash]

A package with .app extension will be created, and it will contain our .jar

The final part is signing the app. In our example, we must use another way apart from Xcode. Everything will be done using Terminal.

We’re going to start with the Gatekeeper version, the easier one. To sign an app and be accepted by this technology we must create a certificate with a Team Agent account. Be very careful with this: to publish outside the App Store you must create a Developer ID Application Certificate or Developer ID Installer Certificate, depending on whether we want to only sign the app as it is or to pack it into an installer (that also has to be signed).

C%2b%2b To Java Converter For Mac

To create a certificate, we always have to go to the development console in the section “Certificates, Identifiers & Profiles”. Once created and added to the Keychain (check carefully we have the private key associated to the public one), we just set into the app directory and type:

[bash]codesign -v -f -s 'Developer ID Application' 'myapp.app'[/bash]

If we get an error message, we type the following command: export CODESIGN_ALLOCATE=”/Applications/Xcode.app/Contents/Developer/usr/bin/codesign_allocate”

And if everything goes right, we must see this: signed bundle with Mach-O universal (i386 x86_64) [com.company.myapp]

xml:lang='en-US'>

These documentation pages are no longer current. They remain available for archival purposes. Please visit https://docs.oracle.com/javase for the most up-to-date documentation.

C 2b 2b To Java Converter For Mac 64-bit

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. The Ant tool is required.

You have created a Java application and want to bundle it for deployment. This requires the following steps:

Create a JAR File

This step creates the ButtonDemo.jar file.

Execute ant jar in the high-level project directory to create the dist/ButtonDemo.jar file. This jar file is used to create the .app package.

Bundle the JAR File into an App Package

To create the ButtonDemo.app package, use the appbundler tool. The appbundler is not shipped with the 7u6 version of the Oracle JDK for the Mac. You can download it from the Java Application Bundler project on java.net. There is also AppBundler Documentation available.

As of this writing, the most recent version is appbundler-1.0.jar, which is used by this document. Download the latest version available and substitute the file name accordingly.

  1. Install the appbundler-1.0.jar file. In this case, create a lib directory in the high-level project directory and add the appbundler-1.0.jar file.
  2. Modify the build.xml file in the high-level project directory as follows. (The added code is shown in bold.)
  3. Invoke the appbundler by typing ant bundle-buttonDemo from the high-level project directory. This creates the ButtonDemo.app package in the dist directory.
  4. You should now be able to launch the application by double clicking ButtonDemo.app in the Finder, or by typing open ButtonDemo.app at the command line.
C%2b%2b To Java Converter For Mac

Bundle the JRE with the App Package

In order to distribute a Java application, you want to avoid dependencies on third party software. Your app package should include the Java Runtime Environment, or JRE. In fact, the Apple Store requires the use of an embedded JRE as a prerequisite for Mac App Store distribution. The runtime sub-element of the <bundleapp> task specifies the root of the JRE that will be included in the app package.

In this example, the location of the JRE is defined using the JAVA_HOME environment variable. However, you might choose to bundle a JRE that is not the same as the one you are using for development. For example you might be developing on 7u6, but you need to bundle the app with 7u4. You will define runtime accordingly.

Since this example defines the runtime sub-element using JAVA_HOME, make sure it is configured correctly for your environment. For example, in your .bashrc file, define JAVA_HOME as follows:

Use the following steps to modify the build.xml file at the top of the project directory:

  1. Specify an environment property, named env:
  2. In the target that creates the bundle, specify the location of the JRE on your system, using the env property:

The resulting build.xml file should look like the following. (The new lines are shown in bold.)

Create a fresh version of ButtonDemo.app, using the ant bundle-buttonDemo command. The resulting version includes the JRE in the app package. You can confirm this by examining the Contents/PlugIns directory inside of the app package.

Sign the App

The Gatekeeper feature, introduced in Mountain Lion (OS X 10.8), allows users to set the level of security for downloaded applications. By default, Gatekeeper is set to allow only OS X App Store and Developer ID signed applications. Unless your app is signed with a Developer ID certificate provided by Apple, your application will not launch on a system with Gatekeeper's default settings.

For information on the signing certificates available, see Code Signing Tasks on developer.apple.com.

The signing certificate contains a field called Common Name. Use the string from the Common Name field to sign your application.

Sign your app using the codesign(1) tool, as shown in the following example:

To verify that the app is signed, the following command provides information about the signing status of the app:

To check whether an application can be launched when Gatekeeper is enabled, use the spctl command:

If you leave off the --verbose tag, and it does not print any output, indicates 'success'.

For more information, see Distributing Outside the Mac App Store on developer.apple.com.

Submitting an App to the Mac App Store

C 2b 2b To Java Converter For Mac Download

Packaging an app for the Mac App Store is similar to packaging for regular distribution up until the step of signing the app. Signing the app for the Mac App Store requires a few more steps, and a different kind of certificate.

C 2b 2b To Java Converter For Macs

You will need to create an application ID and then obtain a distribution certificate for that application ID. Submit your app using Application Loader. For more information, see the following links (on developer.apple.com):

C 2b 2b To Java Converter For Mac Os

Copyright © 1993, 2020, Oracle and/or its affiliates. All rights reserved.

Comments are closed.