• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Classpaths in the OS X terminal

 
Patrique Williams
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've been teaching myself Java for about a month now, using books at online sources. This has been done entirely within NetBeans and I'd like to start using the terminal. For the life of me, I cannot figure out how to set the classpath variable. In fact, I am completely confused by this concept. I am using a MacBook with the latest version of OS X, along with Java build 1.5.

It seems like I am supposed to create a "classes" folder and then point my terminal to that folder, but I get errors when I try to do this and I'm not quite sure where the best place to put this folder is, if this is what I am even supposed to do. I am also not sure if the Mac OS comes with all the Javadocs, or if these can only be accessed by NetBeans.

Please help,

-PW
 
marc weber
Sheriff
Posts: 11343
Java Mac Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Patrique Williams:
... It seems like I am supposed to create a "classes" folder and then point my terminal to that folder, but I get errors when I try to do this...

Welcome to JavaRanch!

Can you provide more details about how exactly you are doing this? And what errors you are getting?

It's likely that you will not need to set a system classpath.

(Meanwhile, for some basics on command line Java, see this thread.)
[ June 22, 2008: Message edited by: marc weber ]
 
Patrique Williams
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the link. Right after I posted this I figured out what I needed to do, thanks to a Google search and help from a friend.

I created a folder named "classes" in which I created a "HelloWorld" folder, in which I enclosed the "HelloWorld.java" file. Then I typed: cd classes/helloworld, which pointed me where I wanted to go. Afterward I used the Javac command to compile the .class file, followed by the java command to run the file and everything worked beautifully.

Thank you again,

PW
 
marc weber
Sheriff
Posts: 11343
Java Mac Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


(Note that you can name your folders anything you like. There's no requirement to call it "classes.")
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic