Close sidebar

can i compile a java file using classpath and that java file is present in some other directory

I had a java file which need to be compiled and it was present in some other directory, i can compile it simply by specifying the full path where the java file is located but my problem is can i compile it by mentioning path to that java file in classpath

  • Venkata
  • 1385 Views
  • 16 Answers
  • Yes, You just need to setup the environment in order to java on your system and check it. If it is installed then you can compile the java file.


  • Yes but u want to need first set-up the global environment path for Java & then it will be compile successfully


  • Yes you can compile it


  • Yes, you can compile it


  • yes


  • yes , why not.. but you have to create environmental variable of classpath first.. then you can run your java program anywhere


  • Yes, you can try it.


  • yes you can compile it


  • Yes, you can compile a java file using classpath to compile a file that is present in some other location. Even I will suggest you java training if you are fresher in this field. Here you can join Cetpa Infotech which gives you a rel='nofollow' target="_blank" href="http://cetpainfotech.com/technology/java-training"Best Java Training in Noida/a.


  • yes you can


  • yes u can compile it.


  • Yes


  • Yes u can


  • Yes you can compile a java file using classpath to compile a file that is present in some other location. From cmd, you first need to set the directory where your java file is located , for e.g.: if my file is in D directory then my cmd command prompt should be D:/ and the you can set path to your bin folder of java.


  • yes you can compile a java file present in some other directory then jdk you just need to assign the path of your directory then its folder and then just "javac ABC.java" and your filed will be compiled. you just need to provide a path in cmd and rest will be same like compiling and executing normal java filebr / 


Dicussion/Forum
core java
Ask New Question
Community Moderator
Only Youth and Educator can become Moderator.