Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / December 2007

Tip: Looking for answers? Try searching our database.

JAR files not working on macs

Thread view: 
Justin - 10 Dec 2007 21:50 GMT
I have written a very simple client/server application that users use
to submit applicant evaluations to a centralized database.  I wrote
the form (client) and created in Java 1.6 and Netbeans 5.5.  Nothing
special, just swing components mostly.  I've packaged it up in a JAR
file using Netbeans to email the application to those people doing
evaluations.  Problem is, it doesn't run on any Macs.  Works perfectly
on Windows.  The best explanation I could get so far from our great
tech team is that, I quote, "Something is wrong with the Jar file".

So I guess I'm looking for a reason why it wouldn't run on a Mac and
what changes I have to make to my jar file to make it work on a mac.

Thanks
Owen Jacobson - 10 Dec 2007 21:52 GMT
> I have written a very simple client/server application that users use
> to submit applicant evaluations to a centralized database.  I wrote
[quoted text clipped - 9 lines]
>
> Thanks

What's your manifest look like?  Does the program show a GUI, or
interact solely with System.in and System.out (and files/sockets)?
Have you looked at Console.app to see if there are any error messages?

Is the JAR available somewhere, or the source for it?

-o
Daniel Dyer - 10 Dec 2007 22:26 GMT
> I have written a very simple client/server application that users use
> to submit applicant evaluations to a centralized database.  I wrote
> the form (client) and created in Java 1.6 and Netbeans 5.5.

Java 6 is not (yet) supported on Macs.  You'll need to restrict your  
application to Java 5 features and set the compiler target to 1.5.

> Nothing
> special, just swing components mostly.  I've packaged it up in a JAR
> file using Netbeans to email the application to those people doing
> evaluations.  Problem is, it doesn't run on any Macs.

Define "doesn't run".  Is there an error message?

Dan.

Signature

Daniel Dyer
http://www.uncommons.org

Justin - 11 Dec 2007 01:08 GMT
I compiled it using Java 1.5 and it now works on Macs.  However, I did
this the noob way (went to my old laptop that hasn't been updated in
about a year) and compiled it using Netbeans.  Do you know what I
would change in Netbeans to get it to compile correctly on my updated
comp?

Thanks again
Justin - 11 Dec 2007 01:12 GMT
Not sure if my post posted or not but I'll restate it again.

Compiling the program using Java 1.5 did the trick.  However, I am
unsure what settings to change in Netbeans to compile using 1.5 (I
have an old laptop that hasn't been updated in 6-12 months which I
used to compile the project).  What and how would I be able to compile
using 1.5 on the updated computer?

Thanks a lot
Lew - 11 Dec 2007 02:06 GMT
> Not sure if my post posted or not but I'll restate it again.
>
[quoted text clipped - 3 lines]
> used to compile the project).  What and how would I be able to compile
> using 1.5 on the updated computer?

On the dev machine that has Java 6, make sure there is also a Java 5 JDK.
Tell NetBeans about the Java 5 platform.
  menu: _T_ools / _J_ava Platforms

Tell the project to use Java 5 by setting the project properties'
  - "Sources" : "Source / _B_inary Format" to Java 5.
  - Libraries : "_J_ava Platform" to Java 5.
(I'm not 100% sure this step is necessary, but it sure makes certain of things.)

NetBeans itself can continue to run on Java 6.

Signature

Lew

Nigel Wade - 11 Dec 2007 14:58 GMT
>> Not sure if my post posted or not but I'll restate it again.
>>
[quoted text clipped - 10 lines]
> Tell the project to use Java 5 by setting the project properties'
>    - "Sources" : "Source / _B_inary Format" to Java 5.

In Netbeans 5 this was Sources, Source Level.

>    - Libraries : "_J_ava Platform" to Java 5.
> (I'm not 100% sure this step is necessary, but it sure makes certain of things.)
>
> NetBeans itself can continue to run on Java 6.

It may not be necessary to install a Java 5 platform. I have successfully built
applications/jars, using just the Java 6 platform, which run perfectly well in
a 1.5 JRE. I have also built some jars with the Libraries setting still on 1.6,
but with the Source Level set to 1.5 and these have caused me no problems.

Either NetBeans does the "right thing", or I've just been lucky so far...

Signature

Nigel Wade, System Administrator, Space Plasma Physics Group,
           University of Leicester, Leicester, LE1 7RH, UK
E-mail :    nmw@ion.le.ac.uk
Phone :     +44 (0)116 2523548, Fax : +44 (0)116 2523555

Lew - 11 Dec 2007 15:22 GMT
Justin wrote:
>>> Compiling the program using Java 1.5 did the trick.  However, I am
>>> unsure what settings to change in Netbeans to compile using 1.5 (I
>>> have an old laptop that hasn't been updated in 6-12 months which I
>>> used to compile the project).  What and how would I be able to compile
>>> using 1.5 on the updated computer?

> It may not be necessary to install a Java 5 platform. I have successfully built
> applications/jars, using just the Java 6 platform, which run perfectly well in
> a 1.5 JRE. I have also built some jars with the Libraries setting still on 1.6,
> but with the Source Level set to 1.5 and these have caused me no problems.
>
> Either NetBeans does the "right thing", or I've just been lucky so far...

I believe that Java 5 and 6 use the same class file format, don't they?  Not
sure.  The language itself didn't change between, either.  The only danger I
see would be using API calls that didn't exist in Java 5.

Signature

Lew

Andrew Thompson - 11 Dec 2007 15:43 GMT
...
>I believe that Java 5 and 6 use the same class file format, don't they?  Not
>sure.  The language itself didn't change between, either.  The only danger I
>see would be using API calls that didn't exist in Java 5.

Using methods (or attributes) of later versions internally
in the binary produced, was the actual reason I 1st heard,
that convinced me to use -bootclasspath for *ensuring*
compatibility with earlier runtime versions.

Anything else that works, is simply good luck (though
perhaps not 'buy a lottery ticket' good luck - the possibilities
of such mishaps are few and far between..).

Signature

Andrew Thompson
http://www.physci.org/



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.