Java Forum / General / November 2007
Java 6 Mac
Ouabaine - 06 Nov 2007 17:06 GMT Hello,
Does anyone know if Java 6 is available on the Mac (even as a beta) ? Could you give me a link?
Other question :
My Netbeans project is compiled for Java 6. Is there a way to compile for Java 5? I do not use any fancy stuff so I see no reason why it woudl not work under Java 5. Is there a setting in the IDE somewhere? Do I have tio download the Java 5 SDK?
Thanks!
Lew - 06 Nov 2007 17:20 GMT > My Netbeans project is compiled for Java 6. Is there a way to compile for > Java 5? I do not use any fancy stuff so I see no reason why it woudl not > work under Java 5. Is there a setting in the IDE somewhere? Do I have tio > download the Java 5 SDK? Yes, there are settings.
In NB 6 beta2 it's in the project properties: (Category: option) - Sources: Source/Binary Format - Libraries: Java Platform - Build / Compiling: Additional Compiler Options -source -target -bootclasspath
 Signature Lew
Lew - 06 Nov 2007 17:53 GMT Ouabaine wrote:
>> My Netbeans project is compiled for Java 6. Is there a way to compile >> for Java 5? I do not use any fancy stuff so I see no reason why it >> woudl not work under Java 5. Is there a setting in the IDE somewhere? >> Do I have tio download the Java 5 SDK?
> Yes, there are settings. > [quoted text clipped - 4 lines] > - Build / Compiling: Additional Compiler Options > -source -target -bootclasspath <http://java.sun.com/javase/6/docs/technotes/tools/solaris/javac.html#crosscomp-e xample>
 Signature Lew
Daniel Dyer - 06 Nov 2007 17:29 GMT > Hello, > > Does anyone know if Java 6 is available on the Mac (even as a beta) ? No, it's not. There was a preview release available for download (subject to agreeing to an NDA) but that has since been removed from Apple's website.
Dan.
 Signature Daniel Dyer http://www.uncommons.org
Roedy Green - 06 Nov 2007 22:06 GMT >Does anyone know if Java 6 is available on the Mac (even as a beta) ? >Could you give me a link? from the moans I would suspect not. Presumable Leopard can run older OS X, which would include a Java 1.5.
I added mouse global position detecting to old Java for an Italian company that could not use Java 1.5. Perhaps you will have to do something analogous for the Java 1.6 features you need.
 Signature Roedy Green Canadian Mind Products The Java Glossary http://mindprod.com
Andrew Thompson - 07 Nov 2007 00:27 GMT >... Do I have tio > download the Java 5 SDK? Yes. To guarantee that the resulting bytecodes use no 1.6 methods internally, you must point the -bootclasspath to a 1.5 rt.jar.
See Lew's link for details.
Andrew T.
Nigel Wade - 07 Nov 2007 09:38 GMT > Hello, > > Does anyone know if Java 6 is available on the Mac (even as a beta) ? > Could you give me a link? I don't believe so at the moment.
> Other question : > > My Netbeans project is compiled for Java 6. Is there a way to compile for > Java 5? I do not use any fancy stuff so I see no reason why it woudl not > work under Java 5. Is there a setting in the IDE somewhere? Do I have tio > download the Java 5 SDK? There are several ways depending on what your desired goal is. If you want the IDE to continue to be a "1.6" IDE, and just build one project for 1.5 then you can set the properties for that project. In the project's Properties dialog, on the Sources page, there is a Source Level JList at the bottom. Select 1.5. This will ensure that your code is treated as 1.5 by the IDE editor, and an implicit -target 1.5 is added to the compilation so the bytecode can be run by a 1.5 JVM.
Alternatively, if you have both the 1.6 and 1.5 JDKs installed on your development platform you can add a 1.5 platform to the IDE. Select Tools->Java Platform Manager, and then the "Add Platform..." button. Point the file selector at the root of the 1.5 JDK installation. Now you can set the platform to use for each project, again in the project Properties dialog. This time, however, it's in the Libraries page. At the top of the page the Java Platform JList should now contain the 1.5 JDK. Select that. Your project should now be built using the 1.5 JDK.
The above assumes that your project is a standard project, not a free-form project. A free-form project has a custom build.xml, and you must manage the compiler platform from that manually.
 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
Andrew Thompson - 07 Nov 2007 10:18 GMT >... This >will ensure that your code is treated as 1.5 by the IDE editor, and an implicit >-target 1.5 is added to the compilation so the bytecode can be run by a 1.5 >JVM. That is not enough to ensure the bytecodes will run on a Java 1.5 VM.
 Signature Andrew Thompson http://www.athompson.info/andrew/
Nigel Wade - 07 Nov 2007 16:17 GMT >>... This >>will ensure that your code is treated as 1.5 by the IDE editor, and an implicit [quoted text clipped - 3 lines] > That is not enough to ensure the bytecodes will run on > a Java 1.5 VM. Ok, if you want to be explicit I expect it also adds the -bootclasspath and -extdirs. It might well do a whole load of other things as well. The upshot is that the resulting code will run on a 1.5 JVM, the mechanics of how it does so are probably of little concern to most users of an IDE.
 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
Andrew Thompson - 07 Nov 2007 22:44 GMT > >>... This > >>will ensure that your code is treated as 1.5 by the IDE editor, and an [quoted text clipped - 6 lines] > > Ok, if you want to be explicit I expect it also adds the -bootclasspath ... Really? I am surprised to hear that, since that option inherently requires an rt.jar from the target version, and I had not realised netbeans supplied a suitable jar for any earlier Java version.
What value does it insert for (random example) Java 1.3?
Andrew T.
Lew - 08 Nov 2007 01:46 GMT >>>> ... This >>>> will ensure that your code is treated as 1.5 by the IDE editor, and an [quoted text clipped - 12 lines] > What value does it insert for (random example) > Java 1.3? I don't think simply setting the target as Java 5 does do all the necessary changes. Telling NB to build against a Java 5 installation does do the trick.
You can have any number of Javas for NB to use - I have Java 5 (Sun, 32 bit), Java 6 (Sun, 32 bit), Java 6 (Sun, 64 bit) and an IBM Java 6 installed here. I can tell NB to use any of them for a project and it does the Right Thing.
(This is the "Java Platform" option Nigel described.)
 Signature Lew
Andrew Thompson - 08 Nov 2007 06:13 GMT ...
>You can have any number of Javas for NB to use - I have Java 5 (Sun, 32 bit), >Java 6 (Sun, 32 bit), Java 6 (Sun, 64 bit) and an IBM Java 6 installed here. >I can tell NB to use any of them for a project and it does the Right Thing. > >(This is the "Java Platform" option Nigel described.) Thanks for clarifying.
 Signature Andrew Thompson http://www.athompson.info/andrew/
Nigel Wade - 12 Nov 2007 16:04 GMT >> >>... This >> >>will ensure that your code is treated as 1.5 by the IDE editor, and an [quoted text clipped - 11 lines] > version, and I had not realised netbeans supplied > a suitable jar for any earlier Java version. Well, I was assuming that NetBeans does what is required based on what the documentation for javac says, in that -bootclasspath and -extdirs are required. Of course, as you point out it can only do this if it happens to know the location of the installation of the alternate JRE/SDK version, which might not even be installed...
So, my assumption was most likely wrong, and NetBeans only adds -target to the javac if you use the "Source Level:" option in the project settings. This is one reason why using an IDE is a problem, as all these details are hidden from you and you can only guess what the IDE is really doing.
However, I've not had any compatibility problems using this option in a 1.6 development environment to generate code to run in a 1.5 production environment. Of course I might just have been lucky so far.
> What value does it insert for (random example) > Java 1.3? Who knows?
 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
Ouabaine - 07 Nov 2007 10:33 GMT > Does anyone know if Java 6 is available on the Mac (even as a beta) ? > Could you give me a link? OK thank you. I have downloaded the Java 1.5 SDK, changed the project, and recompiled it. The problem comes from dialog boxes. I have a couple of dialog boxes that i created with the Netbeans GUI builder. They all use a GroupLayout manager, which is only available in Java 1.6. I have tried to redo the dialog boxes after setting the project to Java 1.5, and it still uses a GroupLayout. Have you got any idea on how I could force Netbeans to use a 1.5 layout manager?
Thanks, Francois
Sherman Pendley - 07 Nov 2007 11:58 GMT > Does anyone know if Java 6 is available on the Mac (even as a beta) ? There *was* a beta available, but it's no longer listed on the ADC site.
sherm--
 Signature WV News, Blogging, and Discussion: http://wv-www.com Cocoa programming in Perl: http://camelbones.sourceforge.net
Free MagazinesGet 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 ...
|
|
|