• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • Devaka Cooray
Saloon Keepers:
  • Ganesh Patekar
  • Tim Moores
  • Carey Brown
  • Stephan van Hulst
  • salvin francis
Bartenders:
  • Ron McLeod
  • Frits Walraven
  • Pete Letkeman

Java SDK on a Mac  RSS feed

 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I read in the book Head First Java that a Java 2 SDK compiler is included in Mac OSX. Where do I find it and how do I launch it? Or am I the only one who dares to use Java on a Mac?
 
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Java on Mac OS X is great. I use my macs to develope java everyday. You will find your SDK binaries in /Library/Java/Home/bin. Just set your $JAVA_HOME variable to /Library/Java/Home and off you go.
 
Jared Knowlton
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I went to the library and java was not in the list. I then did a search for java and this is what it came up with:
com.apple.java.util.prefs.plist
DMJava (Folder)
DMJavawebstart (Folder)
Java Applets (Folder)
Java Web Start (Folder)
java.plist
javaws.cfg
Do I need to install it somehow?
 
Sloan Bowman
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That is rather strange. What version of OX X are you using 10.0? 10.1.x? The /Library/Java is actually a sys link the actual location of the Java Home path. I am not at my mac right now so I can't tell you the exact location but I will later. Just let me know what version of OS X you are using and we can figure this out.
 
Author and ninkuma
Marshal
Posts: 66826
168
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Or am I the only one who dares to use Java on a Mac?


Hardly, some other notable Java/Macheads are James Gosling (Java) and James Duncan Davidson (Tomcat). And of course, me! (OK, not so famous).
By the way, there's a Mac/Java forum on this site here.
bear
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66826
168
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And I'm not completely sure, but it may be that the Java run-time is included in the base system, but you may need to install the (free) Dev Tools to get the JDK???
I'm not sure if this is the case since I routinely install the Dev Tools along with the base OS so I'm not sure where the distinction lies. Something to check out though...
hth,
bear
 
Sheriff
Posts: 6450
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm going to move this to the Mac OS forum. Please post any followups there.
[ September 24, 2003: Message edited by: Jason Menard ]
 
sharp shooter, and author
Ranch Hand
Posts: 1913
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try just opening a terminal window and typing java or javac - what happens? I don't remember having to set anything up and, AFAIK, Java is preinstalled.
 
Jared Knowlton
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm on Mac OSX 10.2.6. I did try javac from the terminal window and it seems to work but I didn't have anything to compile. I'll write a program and I'll try compiling it.
 
Jared Knowlton
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I can compile a program but I can't get it to run.
There error it comes up with is as follows:
Exception in thread "main" java.lang.NoClassDefFoundError: mortgage (wrong name: Mortgage)
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66826
168
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sounds like you have a casing problem. Be sure to specify the class name as Mortgage everywhere. "mortgage" will not do.
bear
 
Jared Knowlton
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by Bear Bibeault:
Sounds like you have a casing problem. Be sure to specify the class name as Mortgage everywhere. "mortgage" will not do.
bear


I'm not quite sure what you mean by that, are you saying that I need to change the class name to Mortgage everywhere.java ?
javac mortgage.java
java mortgage everywhere
Please give me an example of how I run and compile
 
Sheriff
Posts: 4012
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think what Bear meant by casing problem is simply writing the first letter of the class name with an uppercase or lowercase letter: Mortgage as opposed to mortgage. The two spellings are not interchangeable.
Most class names start with an uppercase letter, kind of a style convention. So for your class you'd usually use Mortgage to name it. In your .java file you'd write
public static void main Mortgage{
// class stuff

}
and you'd save the file as Mortgage.java
To compile it and then run it:
javac Mortgage.java
java Mortgage

maybe this helps?
Pauline
[ September 25, 2003: Message edited by: Pauline McNamara ]
 
Jared Knowlton
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes Pauline that worked - I was able to run the program. I can't believe I overlooked something as simple as that. Thanks for your help all.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!