This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Mac OS and the fly likes Java 1.5 on mac Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » Mac OS
Bookmark "Java 1.5 on mac" Watch "Java 1.5 on mac" New topic
Author

Java 1.5 on mac

Cathy Song
Ranch Hand

Joined: Aug 24, 2003
Posts: 270
Hi All,

Could someone please point out how to install Java 1.5 (or 5.0)
on a Mac machine?

Thanks,
Cathy.
Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
Moving this to the Mac OS forum...


[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
Warren Dew
blacksmith
Ranch Hand

Joined: Mar 04, 2004
Posts: 1332
    
    2
Is Java 1.5/5 even final yet?

I'm just planning to wait until it shows up on Software Update.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60752
    
  65

The most recent version of Java for Mac OS X is 1.4.2. I am not aware of a firm date for the availability of 1.5.

Java for OS X
[ August 23, 2004: Message edited by: Bear Bibeault ]

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Simon Brown
sharp shooter, and author
Ranch Hand

Joined: May 10, 2000
Posts: 1913
    
    6
I'm fairly sure that JDK 1.5/5.0 will be out when OS X 10.4 goes final. Tiger on Tiger you could say.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60752
    
  65

How poetically appropriate.
Gaurav Mac Mathur
Ranch Hand

Joined: Feb 19, 2002
Posts: 47
I dont think there is any Official decleration of Java 1.5 coming with Tiger though.
Latest what u can get NOW is
Java 1.4.2_05
Cheers
Kathy Sierra
Cowgirl and Author
Ranch Hand

Joined: Oct 10, 2002
Posts: 1572
If you get the beta version of Mac OSX Tiger, it currently does come with Java 1.5 (Java 5), and people I know are using it. I'm getting ready to join the Apple Developer Network so that I can get the Mac Tiger beta, to start playing with it. The rumor is that both the OS Tiger and Java Tiger on the Mac are quite stable. One of our co-authors has permanently switched his Mac to the Tiger beta, and says it's been better for him than previous final releases of Jaguar, for example. Java 1.5 is DEFINITELY a part of the Max OSX Tiger, but I don't think Apple is planning to release Java 1.5 *before* they release the Tiger OS. So, far as I know, the only way to get 1.5 on the Mac is to get the beta of the OS.

cheers,
Kathy
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60752
    
  65

Any word on whether OS X Tiger will be necessary to use Java 1.5, or will it become available for Panther as well?
Warren Dew
blacksmith
Ranch Hand

Joined: Mar 04, 2004
Posts: 1332
    
    2
No official word that I know of, but Java 1.4 was released on OS 10.2 after 10.3 was current. My guess is that Java 1.5 will be available on older machines.
Stephen Bloch
Ranch Hand

Joined: Aug 19, 2003
Posts: 48
OK, so I have to wait for 10.4 before getting Java 1.5 on my Mac. What does the rumor mill say about when 10.4 will be out?


SCJP 1.4
Philip Herzer
Greenhorn

Joined: Oct 21, 2003
Posts: 21
Stephen, what I've heard is that it will be released first quarter of 2005, around March.


"Mejor morir de pie que vivir toda la vida arrodillas."<br /> Emilio Zapata
Kathy Sierra
Cowgirl and Author
Ranch Hand

Joined: Oct 10, 2002
Posts: 1572
OK, it *is* possible now to run Java 1.5 on Panther...

A little bird told me that if you simply copy the Java binaries from a 10.4 (Tiger) machine directly onto your 10.3 (Panther) machine, it'll work. So that means one would have to be able to access a machine with 10.4, in order to get the actual JDK files (the stuff that goes in /System/Library/Frameworks/JavaVM.Framework/Versions (I think that's the path...)

And let's just say that I have seen it work with my own two eyes

Yes, you can be happily compiling and running the Apple beta of Java 1.5/5.0 on Panther. [I'm pretty sure it doesn't have any graphics support at this point, but who cares... you're probably only interested in trying out the new language features.]

Of course this is extremely unofficial, and it's not like *I* would actually do anything like this.

But I did happen to *see* someone do this and it indeed worked

It is possible (although currently still unlikley) that Apple will make it available as an unofficial, unsupported download for Panther. People are talking about it, but I would not hold my breath on that.

Anyway, that's the latest...
eric mac
Greenhorn

Joined: May 23, 2005
Posts: 1
hey all. when attempting to implement the solution provided by kathy (big thanks for that=) a friend suggested this alternate. (you don't need access to tiger)


go here and get 'pacifist' it's a 'can opener' app that lets you extract individual files from .pkg installers.

http://www.charlessoft.com/Pacifist.dmg

then go here and get the java 2SE50 release for tiger... extract the versions folder and you're in business.=)

http://www.apple.com/support/downloads/java2se50release1.html
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17249
    
    6

"Eric"-
Welcome to the JavaRanch! Please adjust your displayed name to meet the

JavaRanch Naming Policy.

You can change it

here.

Thanks! and welcome to the JavaRanch!

Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
Gabe Herbert
Greenhorn

Joined: Apr 28, 2005
Posts: 10
Once the process had been completed, how would one enable the newer version?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60752
    
  65

I added the following to my .bash_profile:

John Davis
Ranch Hand

Joined: Aug 19, 2006
Posts: 73

Sorry, but im learning java. What's the .bash_profile?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60752
    
  65

.bash_profile is a shell script that is executed when a bash shell logs in (which happens every time you open a Terminal window). You can use it to set up aliases, environment varaibles, and other useful things.

It "lives" in your home folder.

Be aware that (by default) files beginning with a dot are considered hidden and will not show up in Finder.
John Davis
Ranch Hand

Joined: Aug 19, 2006
Posts: 73

how do I change it?
marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

When you open Terminal, its working folder should be your home folder, which is where your .bash_profile should be. But if you haven't already created a .bash_profile, then you might not have one. So first, to ensure the file exists, enter the following in Terminal...

This will create the file if it doesn't already exist. (If it does exist, this will just update the time-stamp.) Next, use the following command to open the file in TextEdit...

After you've modified and saved the file in TextEdit, then make sure the file has the proper permissions by entering the following in Terminal...

(See Wikipedia - touch and chmod.)
[ August 21, 2006: Message edited by: marc weber ]

"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
sscce.org
John Davis
Ranch Hand

Joined: Aug 19, 2006
Posts: 73

I use netbeans and scanner wont work so what's wrong?
marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

Remember, Java is case sensitive. So your import statement needs an uppercase 'S' in "Scanner."

If it still doesn't work after fixing this, then we should verify that you are actually compiling with Java 1.5. At the prompt in Terminal, type "javac -version" (without the quotes). You will get a long error message because you didn't specify a file to compile, but it should start by telling you the version...

...javac -version
javac 1.5.0_06
javac: no source files...
[ August 21, 2006: Message edited by: marc weber ]
John Davis
Ranch Hand

Joined: Aug 19, 2006
Posts: 73

I can't get your terminal command to work, but in Netbeans preference window it says I still have 1.4.2_9. I did everything above though?
marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

Are you running Java 1.5 on OS X 10.3.9 (per your previous post)? If so, I think you should first confirm that Java 1.5 is working under that OS before getting into any IDE configuration.

Have you modified your .bash_profile as indicated above?

What exactly do you get in Terminal when you type the following?
John Davis
Ranch Hand

Joined: Aug 19, 2006
Posts: 73

I got this

And yes im running 10.3.9 and tring to run Java 1.5
marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

I think the -version flag for javac is new with 1.5.

I'm at work on a Windows machine now. To go any further troubleshooting this, I need to be in front of a Mac. I'll post back tonight (unless it's resolved before then).
John Davis
Ranch Hand

Joined: Aug 19, 2006
Posts: 73

I put the versions folder in this path

/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home

was there any thing else I need to have?
marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

Did you update your .bash_profile as indicated above?

I'm not familiar with OS 10.3, so maybe you should wait for someone more Mac-savvy to confirm this. (Bear?) But if your Java Frameworks are set up like they are in 10.4, then there is a "CurrentJDK" alias under /System/Library/Frameworks/JavaVM.framework/Versions. This alias points to the folder of the "current" Java version. If have have this alias, then you should probably update it to point to the 1.5 folder as follows:
  • Open Terminal.
  • Identify yourself as the administrator by typing: sudo su root
  • Terminal will prompt for the admin password. Enter this.
  • Change the current directory by typing: cd /System/Library/Frameworks/JavaVM.framework/Versions
  • Within this directory, there is an alias called CurrentJDK pointing to the "current" version of Java. You need to remove this alias by typing: rm CurrentJDK
  • Now you need to replace it with a new alias pointing to the 1.5.0 directory instead. Do this by typing: ln �s 1.5.0 CurrentJDK
  • Finally, log out of the session as administrator by typing: exit

  • [ August 22, 2006: Message edited by: marc weber ]
    John Davis
    Ranch Hand

    Joined: Aug 19, 2006
    Posts: 73

    In Terminal can I compile java?
    marc weber
    Sheriff

    Joined: Aug 31, 2004
    Posts: 11343

    Originally posted by John Davis:
    In Terminal can I compile java?

    Absolutely! That's what the javac (java compiler) command is for. Use the cd command to change directories to the folder that contains your .java file, then compile with javac, and run with java (java runtime). Note that to compile a java file with the javac command, you include the ".java" extension -- but to run a class file with the java command, you do not include the ".class" extension. For example, if MyFile.java was under java/tests, then the Terminal commands would be...
    John Davis
    Ranch Hand

    Joined: Aug 19, 2006
    Posts: 73

    wow thats really good to know

    so should I be able to use 1.5.0 in the terminal now?

    and I cant use the IDE because I need to set them up to load 1.5.0?
    marc weber
    Sheriff

    Joined: Aug 31, 2004
    Posts: 11343

    If you followed the instructions for changing the CurrentJDK alias to point to the 1.5.0 folder, then you should be set for compiling and running in 1.5 via Terminal. Repeat the "javac -version" test above and see what you get now.

    NetBeans will probably still need some additional configuration to use 1.5. For that, you might have better luck in the IDE forum. However, because you're trying to run Java 1.5 on Mac OS X 10.3 (which reportedly works, but isn't "official"), I think you should make sure Java 1.5 is working okay through Terminal before trying to get an IDE to work with it.
    John Davis
    Ranch Hand

    Joined: Aug 19, 2006
    Posts: 73

    oopps I did all the above code and it didn't work, later I realized that the CurrentJDK alias was on my desktop (typo maybe?) anyway I used this code in terminal


    mv(move)<current location>(space)<new location>

    (nifty tip) in terminal you can drag files from the finder to the terminal window and the file path will appeare with a space after the path

    Thanks everyone who helped make Java 1.5.0_02 work on my 10.3.9 system
    John Davis
    Ranch Hand

    Joined: Aug 19, 2006
    Posts: 73

    ooops

    I mean

    then type your password in
    marc weber
    Sheriff

    Joined: Aug 31, 2004
    Posts: 11343

    Originally posted by John Davis:
    ...(nifty tip) in terminal you can drag files from the finder to the terminal window and the file path will appeare with a space after the path

    Thanks everyone who helped make Java 1.5.0_02 work on my 10.3.9 system

    That's a cool Terminal tip -- I wouldn't have suspected that would work.

    Congratulations on getting 1.5 working!
    John Davis
    Ranch Hand

    Joined: Aug 19, 2006
    Posts: 73

    where does the .bash_profile go, because nothing java works now
    Bear Bibeault
    Author and ninkuma
    Marshal

    Joined: Jan 10, 2002
    Posts: 60752
        
      65

    Your home folder. That'd be /Users/whatever, where whatever is your login name, in the Finder. Or ~ (yes, tilde) in a Terminal window -- that's where your current directory will be set upon opening a Terminal instance.

    Be aware that hidden files that begin with . are not visible in the Finder.
    John Davis
    Ranch Hand

    Joined: Aug 19, 2006
    Posts: 73

    hmmmmm... I've tried every thing and still nothing works
     
    I agree. Here's the link: http://aspose.com/file-tools
     
    subject: Java 1.5 on mac
     
    Similar Threads
    Code errors
    Is Java really used by anyone for Commercial games for PCs?
    Ironing out the last few issues before going Mac...
    Can't play Rules Roundup
    When will Java 5 be a standard software update?