• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Tim Cooke
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Frank Carver
  • Henry Wong
  • Ron McLeod
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Himai Minh

A beginners questions

 
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 1646
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
 
Every time you till, you lose 30% of your organic matter. But this tiny ad is durable:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic