• 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
  • Tim Cooke
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • paul wheaton
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Tim Holloway
  • Carey Brown
  • salvin francis

Classpaths in the OS X terminal

 
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
 
Sheriff
Posts: 11343
Mac Safari Java
  • 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
Mac Safari Java
  • 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.")
 
The world's cheapest jedi mind trick: "Aw c'mon, why not read this tiny ad?"
Enterprise-grade Excel API for Java
https://products.aspose.com/cells/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!