Creating java package on ubuntu?

Posted by Gaurav_Java on Programmers See other posts from Programmers or by Gaurav_Java
Published on 2013-06-30T18:36:03Z Indexed on 2013/06/30 22:27 UTC
Read the original article Hit count: 359

Filed under:
|
|
|

I am new to java. Here I am trying to create java package. And try to compile it from another directory . But there is an error like bash: /home/gaurav/Desktop/package2/B.java: Permission denied

Here is fy first code and directory is /home/Desktop/package/A.java

package package1;
public class A
{
interface A1
{ void show();
  void display();
}
}

class B extends A
{
 public void show()
{
System.out.println("This is show method()");
}
public void display()
{
System.out.println("this is Display metthod()");
}
}

For compilation I did this command it's works fine. pwd is /home/gaurav

javac /home/gaurav/Desktop/package/A.java

When I try to compile B.java which is in my Other drive

/media/gaurav/iPlay/package/B.java

package package2;
class B
{
public static void main(String args[])
{
    System.out.println("Reached in Main method of B");
    package1.A Object = new A();
}
}

I tired this vommand (grom previous working directory)

javac -cp /home/gaurav/Desktop/;/media/gaurav/iPlay/package/B.java 

Error Comes

javac -cp /home/gaurav/Desktop/;/media/gaurav/iPlay/package/B.java 
javac: no source files
Usage: javac <options> <source files>
use -help for a list of possible options
bash: /media/gaurav/iPlay/package/B.java: Permission denied

What i am doing wrong? Please it my assignment I am not able to move further without this. I changed permissions.

© Programmers or respective owner

Related posts about java

Related posts about linux