aspose file tools*
The moose likes Mac OS and the fly likes Classpaths in the OS X terminal Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Engineering » Mac OS
Bookmark "Classpaths in the OS X terminal" Watch "Classpaths in the OS X terminal" New topic
Author

Classpaths in the OS X terminal

Patrique Williams
Greenhorn

Joined: Jun 21, 2008
Posts: 2
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

Joined: Aug 31, 2004
Posts: 11343

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 ]

"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
Patrique Williams
Greenhorn

Joined: Jun 21, 2008
Posts: 2
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

Joined: Aug 31, 2004
Posts: 11343



(Note that you can name your folders anything you like. There's no requirement to call it "classes.")
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Classpaths in the OS X terminal
 
Similar Threads
[Mac] Can't run class files through terminal but NetBeans works fine
New to Java
Launching Terminal.app
Starting wth Java on Mac
MAC OS X Set-Up