Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Jar Bundler Problems

Hi, I'm learning Java and I have my own application. It works perfectly when I open the jarfile, but when I use Jar Bundler to convert it to an app, it quits before it opens. The icon appears in the Dock and then disappears. Also, when I try to choose "Main class" the file never appears after I choose it. Does anyone know how to fix this or any other alternatives? Thanks.

Posted on Apr 28, 2013 2:38 AM

Reply
59 replies

May 19, 2013 11:08 PM in response to Arc676

P.S.: about JAVA:

When you have to dig deep into Microsoft's libraries, the choice is C#.

On almost any other platform JAVA is the choice of arms.

Example: last week one of my applications said POOF!

The log told me what happened and where: an unexpected null-pointer.

In C or C++ I could have tested for weeks to find the error,

because in C the error happens somewhere and the result happens somewhere else at an other time.

Happy go lucky! I suffered for decades because my employer wanted me to use it.

Now I'm retired and I can choose the tools I want.

Then again, after decades of UNIX and MSWindows, OSX seems tough to me,

let alone this bundler problem.


Another point: there seems to exist some ANT based bundler, but that would be my last resort.

;JOOP!

May 19, 2013 11:42 PM in response to Arc676

I found it at "/usr/share/java/Tools/Jar Bundler.app".

It seems unrelated to Xcode at all since the directory was created a year ago.

So, I tried it and the application bundle I created with it seems empty and does not start my .jar

Further investigation is needed, since I must create at least 2 of those bundles to start

all my applications (one of these 2 is a kind of program manager I wrote long ago).

As it is Whit Monday, I have to delay my 'work' a bit; see you later.

;JOOP!

May 20, 2013 7:28 AM in response to Arc676

The bundler should not bother with the contents of a .jar, however many classes and/or resources are in there.


Now I'm curious about the inputs to the Bundler.

I left everything blank/default except for the filenames and the main class name.

I made it create a .app in my Desktop with the main class name (only letters) but it created

a useless Desktop.app in there.

;JOOP!

May 21, 2013 7:50 AM in response to Arc676

1) May be this trick works: build an app like 'another' with just one (empty?) main class but

by the right name you want; install that app andd consequently replace the .jar inside by the right one.

I believe that the app launcher does no more than start JAVA on the .jar which contains a manifest

for the main class name.


2) Try: http://www.cplusplus.com/files/tutorial.pdf


;JOOP!

May 21, 2013 9:40 AM in response to Sciuriware

Sciuriware wrote:


2) Try: http://www.cplusplus.com/files/tutorial.pdf

That tutorial looks pretty good, but it is pretty basic. There is nothing wrong with that, but it would give one a false impression of the scope of the C++ language. The fundamental problem with C++ is that it doesn't scale well from a human perspective. As your develop C++ software of greater and greater complexity, the amount you must learn increases at an even greater rate. Eventually you stagnate when, after enough years, you realize you don't know enough C++ to continue. Then you switch to something like Objective-C.


If you want to get a taste of the rest of C++, I suggest Nikolai Josuttis' excellent C++ Standard Library book: http://www.cppstdlib.com


For some of the tips and tricks that most people never learn until after developing a few years of bad habits, see any of Scott Meyers' books.

May 22, 2013 10:50 PM in response to Arc676

Did you realise that the Jar Bundler chooses the JAVA release?

On my Mac I had to install Java 6 (APPLE) and JAVA 7 (ORACLE) side by side.

So I made all my applications tell me (a.o.) what JAVA they run on (A pop-up from F1), very useful.

Now I'm very curious about the .app that works for you: does it have JAVA7-only calls inside?


;JOOP! (Joop~John~Jean~Sean~Johan.......)

May 29, 2013 9:46 AM in response to Arc676

Hi, first of all I was very busy last week to find out why my JAVA programs did not run well on OSX.

I found several strange things, e.g. the jar command produces a .jar file with a group (wheel) that's not mine.

Another example: contrary to MSWindows I can (accidentally) overwrite a running .jar file.


Back to 'business': I tried to be smart and dragged a .jar that works well to the Dock.

From there I can fix it and run it when ever I want. I only get an extra icon in the Dock.

The problem is that all Dock .jar-s are treated as documents and receive the same icon (coffee cup).

So I downloaded 'PrefSetter' only to find that the icon reference is NOT in the Dock's plist.

I still must find a way to set the correct icon on a running .jar, but the API containing the right methods might

be part of APPLE's JAVA-6; so I postponed search for a solution.


Now, I would like to go on with Jar Bundler, but I don't seem to understand that program.

Finally I get an empty app in the wrong place.

If you succeeded to at least build an app with it, please give me some hints about what

to enter where. To begin with: what file does it want for the main class?

;JOOP!

Jun 11, 2013 4:08 AM in response to Sciuriware

I believe that for main-class you are supposed to select the jar that you exported from whatever IDE you were using. However, I think the main problem here is in the jar and its setup, because when I select a different jar, the name of the main class of the JAR file (ending in .class) appears in the text box. However, the name of the main class does NOT appear when I select the jar that I WANT to export.


Is :JOOP supposed to represent all the names that start in "J" or end in "ean" or am I missing something?

Jun 11, 2013 11:16 AM in response to Arc676

I recommend you open the faulty .jar and see if there is a top-level directory by the name "Meta-inf".

In there you should find a file by the name "Manifest.mf"; its contents could be:


Manifest-Version: 1.0

Class-Path: jcalendar-1.4.jar

Created-By: 1.7.0_21 (Sun Microsystems Inc.)

Main-Class: Collide


In this example it is a 5 (five!!!) line file, the 5th line must be empty;

the second line depends on referred other .jar's.

The 4th line in the example indicates the main class.


Please compare this for the .jar that works and the one that does not.


;JOOP! (my name is Joop; the other names I listed are more or less my name in other countries).

Jar Bundler Problems

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.