• Post Reply Bookmark Topic Watch Topic
  • New Topic

running issue  RSS feed

 
vinaya namburi
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i want to run my java program at command line but i don't want to move that location
so how can i run my program

for example my class file is in D drive but my command line started at c:/users>

i want to run from c:/users> only

how can i do it please help me
 
vinaya namburi
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
vinaya namburi wrote:i want to run my java program at command line but i don't want to move that location
so how can i run my program

for example my class file is in D drive but my command line started at c:/users>

i want to run from c:/users> only

how can i do it please help me
 
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
When you run your program with the java command, make sure the classpath points to the base directory of the packages of your project. Use the -cp option on the command line. For example:

C:\users> java -cp D:\MyProject\classes com.mycompany.MyProgram
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!