• Post Reply Bookmark Topic Watch Topic
  • New Topic

can anybody tell me how to compile java file present d drive compile in c drive  RSS feed

 
Ramesh Kumar Koyya
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
public class A
{
pubic static void main(String args[])
{
System.out.println("Hello World");
}
}

this file present in d: drive in some folder x
how to compile java file in c: location
 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 16060
88
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why don't you just go to the D: drive and then 'cd' to the directory that contains the source file, and then compile it?

C:\Users\Ramesh> D:
D:\> cd MyProject
D:\MyProject> javac A.java
D:\MyProject> java A


If you absolutely want to compile it while you are not in the directory that contains the source file, just specify the complete path:

C:\Users\Ramesh> javac D:\MyProject\A.java
C:\Users\Ramesh> java -cp D:\MyProject A
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!