Making a Mac double-clickable application in NetBeans - macos

I have recently moved to a MacBook Pro, which has meant leaving my beloved JBuilder 2005 behind. Since there is no such thing any more (AFAIK) as a free JBuilder, I'm having to choose a new IDE.
I can't live with the code-formatting of Eclipse (yes, I know, it can be customised up the wazoo, but the fact that it will NOT respect my inserted returns means I can't live with it) so I'm seriously considering NetBeans.
However, I can't find any way of getting it to build a double-clickable Mac application! (I used to use XCode for this step, but it seems that XCode no longer wants to know about Java...) I cannot be the first person who's wanted to do this...can anyone help me with advice as to how to go about it?
Grateful thanks in advance

I had a similar issue and have moved to using Netbeans with the AppBuilder tool. Of course you need to make sure you install the latest version of the Java SDK.
http://docs.oracle.com/javase/7/docs/technotes/guides/jweb/packagingAppsForMac.html
I also did some tweaking to the Ant build.xml file so I never have to modify it and can just copy it between projects. A nice modification I added also auto builds the .app file from within the IDE during a clean compile.
<target depends="wine-version" name="-post-jar" description="Run OSX AppBundler.">
<bundleapp
name="${application.title}"
displayname="${application.title}"
identifier="net.sourceforge.darwine.x86"
icon="winehq.icns"
shortversion="WineApp-1.0 | ${wine.version}"
copyright="${wine.license}"
applicationCategory="public.app-category.utility"
outputdirectory="${dist.dir}"
mainclassname="${main.class}">
<classpath file="${dist.jar}" />
<option value="-Dapple.laf.useScreenMenuBar=true"/>
</bundleapp>
</target>

If what you want to do is create a java application that the user can launch by double clicking on a Mac, all you have to do is package the app in a jar and ensure that the jar's manifest (META-INF/MANIFEST.MF) includes a line like Main-Class: MyStartClass, giving the class of your app that contains the main method that launches the app.
For more details, see:
Bringing your Java Application to Mac OS X Part Three

Related

Xcode Source Compiling Order Issue

I am working on a fork of the Xbox HID project (to allow greater configuration of the controller) and came across a really strange issue.
The project is three projects, which I have grouped together under a workspace, which works well, it compiles them in order (kext, daemon and prefpane) and all works.
However, I decided to uncrustify the code (thanks Alcatraz!) and standardise the names and locations of source files. This required me to update the project as file paths changed.
Once this was all completed the PrefPane wouldn't load. For some reason it was instantiating and sending initWithBundle to an object that was NOT the File's Owner in the XIB.
After a lot of debugging and hair-pulling I discovered the object it was instantiating also happened to be the first file listed in the Compile Sources build phase. Once I moved the correct file to the top of that list the PrefPane once again launched and worked as expected.
That seems wrong, why does it need to compile this particular class first... better yet, why is it picking up only the first compiled class instead of the one specified in the XIB?
I am using Xcode Version 6.2 (6C131e) under OSX 10.9.5, however, I am using the OSX 10.6 SDK and have 10.6 as the deployment target.
I was having some other issues with the project in question, so I rebuilt all three projects and this issue went away.
I am guessing there was some sort of issue with the Xcode project itself as I believe it was probably upgraded from at least two previous major versions of Xcode.
Lesson here seems to be, rebuild the project files themselves and see if that fixes the issues!

JavaFx button not working on Mac

So I have created an application using javaFX in Eclipse. I packaged an executable jar using Maven, with the zenjava javafx-maven-plugin version 2.0. I package in the command line using mvn clean jfx:jar. This creates a javafx/app subfolder in my target, which includes a lib folder and the executable jar.
When I run this executable jar on my Ubuntu or Windows machine, everything seems to work fine. On Mac however, I am having trouble. I have a welcome page that shows up first. It has a small description of the application and a button for users to push to continue on to the application. For some reason the button doesnt do anything on Mac. It works fine on Windows and Ubuntu. Any ideas why this is happening? Do I have to include anything extra for Mac?
There was an issue on Jira (JavaFX Bugtracker) concerning Mouse events on buttons disapearing. It was not exactly your MAC version (in the issue they named 10.8.2) but the issue has been fixed for the JavaFX 8 release (codename lombard). You might want to try the JavaFX 8 beta and see whether your bug has been fixed.
In case you'd like to see the issue: https://javafx-jira.kenai.com/browse/RT-26395

Netbeans javafx mac bundle without JRE

I am having a hard time trying to build my javafx app into .app (for mac).
I found a legit way to do that, here is resource for that:
http://docs.oracle.com/javafx/2/deployment/deploy_quick_start.htm
However, it is far from what I'm looking for. By following that tutorial, I managed to build an app from my javafx project, however the size of file was just ridiculous and it is because the whole JRE is being bundled inside. I am now looking for a way to deploy .app file with dependencies (it's important) ONLY and without JRE. (JRE should be pre-installed by user). Is there a way to do that? I really tried to find one, but faild. Hope you, guys, help me.
Instructions for packaging a JavaFX application as a native installable app without including a JRE:
JavaFX packaging tools update - Self-Contained Applications: Create Package without Java Runtime.
The tools used are the same as from the deployment quick start you mention in your question. You just set the fx:platform basedir="".
I'll just quote the article here:
This may sound a bit puzzling at first glance. Package without embedded Java Runtime is not really self-contained and obviously will not help with:
Deployment on fresh systems. JRE need to be installed separately (and this step will require admin permissions).
Possible compatibility issues due to updates of system runtime.
However, these packages are much much smaller in size. If download size matters and you are confident that user have recommended system JRE installed then this may be good option to consider if you want to improve user experience for install and launch.
Technically, this is implemented as an extension of previous feature. Pass empty string as value for 'basedir' attribute and this will be treated as request to not bundle Java runtime, e.g.
<fx:platform basedir=""/>

Adding a Library to your build and link path in XCode

I am tryingo to build a GUI application using the JUCE framework on MAC OSX.
I have dowloaded all the API's and got a small hello World program running fine.
However, when I add files to my Xcode project I get compilation errors that say that the Juce library files don`t exist. I would like to know how to get the library API in the build and link path in XCode so that it finds the neccesary files for compilation.
What I would do on Visual Studio going to properties and adding aditional library dependencies, is what I need to do in XCode but I don't know how.
Any help greatly appreciated.
thanks.
Old question but maybe a useful answer in the future....
If you have the "Hello World" up and runnning, it should already be linked to the library. Are you using the introjucer? This should help get everything up and running for you. If you are, you need to add classes etc to the introjucer, as this sets up Xcode / VStudio for you. If not, (Presuming XCode 3 as you are using leopard) goto Xcode > Preferences. Scroll along to source trees, and add the path to the juce folder in there.

Problem in plug-in development: Eclipse 3.4 can't find a bundle that is definitively there!

Today I had a problem with my old Eclipse 3.4 installation and I had to re-download the entire package. However, I don't think that I got the exact package as before, and I'm having some problems.
The problem can be summarized as follows: when developing a plug-in, I cannot resolve dependencies towards 'org.eclipse.jdt.ui'. When trying to add the missing plugin, in the dialog the closest match is 'org.eclipse.jdt.ui**.source**'. A similar thing happens with other core plugins.
In order to test, I created a new plug-in using the wizard and I obtained a non-compiling plugin: one of the classes uses the class org.eclipse.jdt.ui.JavaUI and it cannot be resolved. Similarly, the MANIFEST.MF includes a dependency towards 'org.eclipse.jdt.ui', but the 'Bundle 'org.eclipse.jdt.ui' cannot be resolved'.
Now a summary of my platform:
I'm running Mac OS X 10.4 Tiger and Java 1.5.0_19-138
I'm running Eclipse Version: 3.4.1 Build id: M20080911-1700
I downloaded the modeling package, which comes in a file called 'eclipse-modeling-ganymede-SR1-incubation-macosx-carbon.tar.gz'
I've performed a fresh installation, in a new folder and using a new workspace.
If I look at the Plug-in Registry view, I can find the 'org.eclipse.jdt.ui' plugin in there, and it appears to be running. By the way, if it is disabled, then the workbench breaks and stops working.
I cannot understand what is happening. Is my installation broken? I wonder if the Eclipse package that I downloaded has an error and they included the sources instead of the compiled files. But in that case, the plug-in shouldn't be working in the workbench, isn't it?
In any case, why I cannot find the plug-in when I'm adding the dependencies, even if I see it in the Plug-in Registry?
Thanks for your help!
Problem solved: just restart the computer.
I don't restart my computer very frequently, so it took me a lot of time to find out that this was the solution. After I restarted it, everything started to work perfectly again. It seems that either Eclipse leaves something in the memory after running, or that some of my initial failures had left something nasty behind. In any case, I had checked and there were no Eclipse related processes running .... weird, but at least now it's fixed!

Resources