This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes A beginners questions Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "A beginners questions" Watch "A beginners questions" New topic
Author

A beginners questions

Lucky Singh
Ranch Hand

Joined: Jan 19, 2004
Posts: 125
Hi,
I know these are rather silly questions but have no one else to ask.

1. I am working on a UNIX machine which has the following directory structure
//student/lucky>
I type my Java programs at the prompt >

2. When I type in the command
mkdir -p $HOME/mysrc/country/city
is this the dierctory structure I get,
//student/amrita/mysrc/country/city

3. I type in a Java file Hello.java in the city subfolder
package country.city;
public class Hello
{---}

Where do I type in the following command to compile, i mean i should be
in which directory?
javac -d $HOME/lucky/myclasses Hello.java
I want my class files to be in lucky/myclasses

4. What should the class path be set as for all the above?
sandip mense
Greenhorn

Joined: Oct 14, 2003
Posts: 28
Lucky,

You need to be in the directory //student/amrita/mysrc
on which u give the command,

> javac /country/city/Hello.java
if teh classpath has been set properly , else u can set the classpath while compiling to the current directory and compile

> javac -classpath . /country/city/Hello.java


Sandip
David Harkness
Ranch Hand

Joined: Aug 07, 2003
Posts: 1646
Originally posted by sandip mense:
> javac /country/city/Hello.java

> javac -classpath . /country/city/Hello.java
Remove the leading / from these two paths or it will not look relative to the current directory.To run it when it compiles successfully, use
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: A beginners questions
 
Similar Threads
javac: no classpath found
bad class file error, compiling with packages
Java beginning
Use cmd and not an IDE.
Problem compiling java class