Help coderanch get a
new server
by contributing to the fundraiser
  • 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Doubt about package compilation in another drive

 
Greenhorn
Posts: 25
Oracle Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I created Three Programs in three different directories like below:

1)In C Drive I saved below program

package pack1.pack2;
public class Cdrive
{
public void m1()
{
System.out.print(" you are in C drive");
}
}

2) In D drive I saved below program

package pack3.pack4;
import java.pack1.pack2.Cdrive;
public class Ddrive {
public void m2()
{
Cdrive cd = new Cdrive();
cd.m1();
System.out.println("D drive you are in");
}}

3)In E drive I saved like below program

import pack3.pack4.Ddrive;
public class Edrive
{
public static void main(String args[])
{
Ddrive dd = new Ddrive();
dd.m2();
System.out.println("you are in E drive");
}
}

Now my Question is How to Compile and run above programs from the Directory "E:"?
I tried in lot of ways but I didn't get.
please answer
 
Bartender
Posts: 4179
22
IntelliJ IDE Python Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You have to set the classpath to include all three locations where the packages are located.
 
Don't count your weasels before they've popped. And now for a mulberry bush related tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/t/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic