participate


Generics - Installing JSR014 on Mac OS X
<<   Back to Forum  |   Give us Feedback
10 Duke Stars rewarded for this thread
This topic has 11 replies on 1 page.
kentyman
Posts:9
Registered: 3/25/02
Installing JSR014 on Mac OS X   
Jun 22, 2003 3:13 PM

 
I'm trying to install the prototype for JSR014 in Mac OS X, but I am having trouble with the $J2SE14 environment variable I am supposed to setup for the scripts to work. I set it to point to /System/Library/Frameworks/JavaVM.framework/Home/, but that directory doesn't seem to be good enough. The javac script given does the following check:

if [ ! -x ${J2SE14}/bin/javac -o ! -r ${J2SE14}/jre/lib/rt.jar ];

${J2SE14}/bin/javac does exist when I set my environment variable as stated above, but sadly there is no ${J2SE14/jre directory. In fact, I cannot seem to find any instance of an rt.jar on my system. Is this a file that doesn't get installed with Apple's J2SDK 1.4.1_01?

Thanks for any insight,
Kent
 
YATArchivist
Posts:4,906
Registered: 23/07/02
Re: Installing JSR014 on Mac OS X      
Jun 22, 2003 4:07 PM (reply 1 of 11)  (In reply to original post )

 
Yes, Apple split it up into /System/Library/Frameworks/JavaVM.framework/Versions/1.4.1/Classes/classes.jar and /ui.jar IIRC. You're certainly looking for classes.jar and ui.jar somewhere inside the JavaVM.framework.
 
kentyman
Posts:9
Registered: 3/25/02
Re: Installing JSR014 on Mac OS X   
Jun 22, 2003 4:14 PM (reply 2 of 11)  (In reply to #1 )

 
So how can I make the scripts for JSR014 work with the Mac OS X setup? Does it really need an rt.jar? Should I combine classes.jar and ui.jar into an rt.jar somehow? Have you tried getting the JSR014 prototype working in OS X?

Thanks again,
Kent
 
YATArchivist
Posts:4,906
Registered: 23/07/02
Re: Installing JSR014 on Mac OS X      
Jun 23, 2003 5:13 AM (reply 3 of 11)  (In reply to #2 )

 
$cat /usr/bin/gjc
#!/bin/sh
JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/1.4.1/Classes
# I put the JSR14 stuff in here:
GJ_HOME=/System/Library/Frameworks/GJ.framework/Versions/2.0
javac -J-Xbootclasspath/p:${GJ_HOME}/gjc-rt.jar \
-bootclasspath ${GJ_HOME}/collect.jar:${JAVA_HOME}/classes.jar:${JAVA_HOME}/ui.jar \
-source 1.5 "$@"
 
kentyman
Posts:9
Registered: 3/25/02
Re: Installing JSR014 on Mac OS X   
Jun 23, 2003 6:42 PM (reply 4 of 11)  (In reply to #3 )

 
Should I be getting the below errors with that setup?

Test.java:1: > expected
public class Test<T implements Interface> {
                    ^
Test.java:3: '{' expected
^
2 errors


For some reason it doesn't seem to like the "implements" keyword in the middle of the angle brackets. Could the be a problem of my setup not quite matching yours, or am I missing something?

Thanks again for all your help!
Kent
 
lord_pixel
Posts:252
Registered: 10/21/97
Re: Installing JSR014 on Mac OS X      
Jun 24, 2003 6:55 AM (reply 5 of 11)  (In reply to #4 )

 
I believe you must always use 'extends' there.

The earlier whitepapers/specs had 'implements' but I'm not sure if that ever worked in any released versions of the compiler.

I guess they're too busy updating the software to update the docs.
 
kentyman
Posts:9
Registered: 3/25/02
Re: Installing JSR014 on Mac OS X   
Jun 24, 2003 2:29 PM (reply 6 of 11)  (In reply to #5 )

 
Wow, really? I'm not at home so I can't try it out, but it sure seems strange to say
<T extends Interface>
. The idea of "extending an interface" only makes sense to me if you are making a subinterface. Oh well, I'll try it out when I get home.

Thanks for the help,
Kent
 
kentyman
Posts:9
Registered: 3/25/02
Re: Installing JSR014 on Mac OS X   
Jun 24, 2003 6:03 PM (reply 7 of 11)  (In reply to #5 )

 
"T extends Interface" worked like a champ. Thanks!
 
rrrrrich
Posts:2
Registered: 8/11/97
Re: Installing JSR014 on Mac OS X   
Nov 19, 2003 9:20 PM (reply 8 of 11)  (In reply to #3 )

 
Hey, thanks for all the info in this thread; I'm trying to do the same thing (run the JSR014 stuff on OS X) but now I keep getting
  javac: invalid source release: 1.5

In fact, I get that if I just try to run
  javac -source 1.5
without any other command line arguments.

Is that because my current Java version is only up to 1.4.1_01?
Do I need 1.4.2 to compile with -source 1.5?
And if so, can I get 1.4.2 for Mac OS 10.2.6?

Thanks,
Richard
 
YATArchivist
Posts:4,906
Registered: 23/07/02
Re: Installing JSR014 on Mac OS X   
Nov 20, 2003 2:01 AM (reply 9 of 11)  (In reply to #8 )

 
The most likely explanation is that the javac you're running is the 1.4.1 javac rather than the JSR14 script. You can check this with the command
which javac
 
rrrrrich
Posts:2
Registered: 8/11/97
Re: Installing JSR014 on Mac OS X   
Nov 20, 2003 9:40 AM (reply 10 of 11)  (In reply to #9 )

 
Thanks for the quick reply. In fact I was running (an altered version of) the script, but I had misconfigured my environment variables.

I'm still fuzzy on the meaning of the command line arguments to javac inside the script. What's the distinction between -bootclasspath, which allows you to "cross-compile against the specified set of boot classes" and -J-Xbootclasspath, which passes "-Xbootclasspath" "to the java launcher called by javac"? (Actually I think I've sort of answered my own question there, but any clarification would still be appreciated.)

Thanks again,
Richard
 
lord_pixel
Posts:252
Registered: 10/21/97
Re: Installing JSR014 on Mac OS X   
Nov 21, 2003 7:14 AM (reply 11 of 11)  (In reply to #10 )

 
javac is written in Java, thus it needs a java process in which to run.

-Xbootclasspath is passed to the instance of java running javac to tell it which bootclasspath to use. This implies this version of javac is itself already using generics or other 1.5 features internally.

-bootclasspath is specifying the clases to compile YOUR code against. This allows you to use 1.5 features in your code.
 
This topic has 11 replies on 1 page.
Back to Forum
 
Read the Developer Forums Code of Conduct

Click to email this message Email this Topic

Edit this Topic
  
 
 
Forums Statistics
    Users Online : 25
  • Guests : 129

About Sun forums
  • Sun Forums is a large collection of user generated discussions. It is here to help you ask questions, find answers, and participate in discussions.

    Check out our guide on Getting started with Sun Forums for a full walkthrough of how to best leverage the benefits of this community.

Powered by Jive Forums