Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

ClassPath question

 
Rachel Glenn
Ranch Hand
Posts: 95
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Suppose I have the following:

/mp/classes/player/musicplayer.class

and the current directory is set to /mp.

Why isn't the following invocation a valid way to run musicplayer.class ??

>> java -cp /mp/classes/player musicplayer


 
Himai Minh
Ranch Hand
Posts: 1316
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try this
>> java /mp/classes/player/musicplayer

If your main method is in musicplayer.java, java will look for it through the path you provide.

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic