Total beginner here - Mac based Java - how do I find it/run scripts?
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
So I have decided to jump in to Java. I have one problem though....I understand that Mac has Java already installed into OS X 10.4.11
However, I can't find it. Or at least, I can't find the JVM to test some scripts. I bought Head First Java, and I want to plug in one of their examples scripts....but where? I also don't see any Java folders in the Library.
I know there are no stupid questions, but I have been trying to figure this out for 3 days....and I feel stupid. Is it possible that it is not installed on my computer? I am about to move over to my desktop PC....but I'd rather have the portability of my Macbook.
Thanks so much for any help!
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
I know nothing about Macs, but I always assumed that when they said java was already installed on them, they meant the JRE, not the JDK.
the JRE is what lets you RUN a java program. I.e. it's been compiled and you have the class files.
if you want to write and compile your own java, you may still have to install the JDK (Java Development Kit). But I can't address how you do that.
There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
http://blog.adsdevshop.com/2009/03/17/installing-the-jdk-16-on-mac-os-x-the-video/
Hope that helps,
Janeice
When you do things right, people won't be sure you've done anything at all.
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
People will be keener to answer if you tell them what the question is about in the thread title.
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
Campbell Ritchie wrote:Welcome to the Ranch
![]()
People will be keener to answer if you tell them what the question is about in the thread title.
right you are....thanks Campbell...
-
-
Number of slices to send:Optional 'thank-you' note:
-
-

-
-
Number of slices to send:Optional 'thank-you' note:
-
-
If you get "command not found", the JDK is not installed.
If you get a usage message, you are good to go.
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
Bear Bibeault wrote:Bring up a Terminal window, and enter javac at the command line.
If you get "command not found", the JDK is not installed.
If you get a usage message, you are good to go.
Thanks Bear...
Looks like it is installed....so can you then tell me how I would test a script....I think I need to enter the script in a compiler? Where do I find that? Thanks for helping....I swear I'm not an idiot....I just gotta learn once....thanks so much.
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
Essentially:
The devil is in the details. So pay attention to what the book is telling you.
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
mkdir javawork
cd javawork
That will create a nice directory called javawork (you can obviously give it any name you like) and you can keep all your Java safe in it; the line starting cd will take you directly to it.
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
Bear Bibeault wrote:Once you are at the command line, you can just follow any tutorial on writing Java programs. There's nothing Mac-specific you need to worry about.
Essentially:
Write Java program in .java files using a text editor Compile .java files using javac; creates .class files Run program using java command
The devil is in the details. So pay attention to what the book is telling you.
Yea, I get the gist of steps 1, 2 and 3....I guess I just haven't grasped how one compiles .java files using javac......what program is used to compile?
Anyway, I'll figure it out one way or another...thanks for the help!
-Let me rephrase that....I thought I compiled in the JVM....and that's what I can't find...
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
The Java Virtual Machine is what most people have on their computers. It's used, most notably, to run Java based applications as well as view Java content on web pages.
The Java Developer Kit (JDK) is a bunch of stuff used by developers (like us) to compile programs. The programs are written in a text editor (if you're using the HeadFirst book I recommend NotePad++), or you can use a development environment like Eclipse.
"javac" is the compiler you need to get the files you write in your text editor to turn into useful Java class files. In windows, there's a way to add the file to the known paths of the operating system. I think that video I linked to might have information on that for Macs.
So you write a file, say "HelloWorld.java". How do you compile it?
Type:
... at the command prompt while you're in the folder that has the file in it. If you're lucky and there are no errors
, you get a class file. So now you have 2 files with different extentions (one java that you wrote, the other class... the compiled version). The JVM runs the class files. If you set your system properties correctly, you should then be able to type And your application will run.
Hello World!! :-)
Is this getting clearer? I remember it took me about a week to understand this whole thing when I started....
-Janeice
When you do things right, people won't be sure you've done anything at all.
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
R Arthur wrote:I guess I just haven't grasped how one compiles .java files using javac......what program is used to compile?
The program that you use to compile Java source files to Java class files is javac, the Java compiler. It doesn't have a graphical user interface, it's a program that you use on the command line of the terminal window.
The page About the Java Technology from Sun's tutorials explains it in detail, with pictures:

-
-
Number of slices to send:Optional 'thank-you' note:
-
-
Janeice DelVecchio wrote:Okay.... here's another way to say this. I'm used to PC, but I think Macs are pretty much the same when it comes to this.....
The Java Virtual Machine is what most people have on their computers. It's used, most notably, to run Java based applications as well as view Java content on web pages.
The Java Developer Kit (JDK) is a bunch of stuff used by developers (like us) to compile programs. The programs are written in a text editor (if you're using the HeadFirst book I recommend NotePad++), or you can use a development environment like Eclipse.
"javac" is the compiler you need to get the files you write in your text editor to turn into useful Java class files. In windows, there's a way to add the file to the known paths of the operating system. I think that video I linked to might have information on that for Macs.
So you write a file, say "HelloWorld.java". How do you compile it?
Type:
... at the command prompt while you're in the folder that has the file in it. If you're lucky and there are no errors, you get a class file. So now you have 2 files with different extentions (one java that you wrote, the other class... the compiled version). The JVM runs the class files. If you set your system properties correctly, you should then be able to type
And your application will run.
Hello World!! :-)
Is this getting clearer? I remember it took me about a week to understand this whole thing when I started....
-Janeice
Thank you so much Janeice...it is becoming much clearer....that was very helpful!
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
Jesper Young wrote:
R Arthur wrote:I guess I just haven't grasped how one compiles .java files using javac......what program is used to compile?
The program that you use to compile Java source files to Java class files is javac, the Java compiler. It doesn't have a graphical user interface, it's a program that you use on the command line of the terminal window.
The page About the Java Technology from Sun's tutorials explains it in detail, with pictures:
![]()
Thanks Jesper....that helped me visualize it....this is a great forum....I hope I can repay someday....
| a wee bit from the empire Paul Wheaton's 16th Kickstarter: Gardening playing cards for gardeners and homesteaders https://coderanch.com/t/889615/Paul-Wheaton-Kickstarter-Gardening-playing |












