How to run a .class file that is part of a package from cmd?

后端 未结 12 1182
梦如初夏
梦如初夏 2020-12-01 07:11

I keep getting errors when I make my .class part of a package and try to run it from cmd.

Here\'s the code that works after using jav

12条回答
  •  [愿得一人]
    2020-12-01 08:01

    Try to use absolute directory or put your HelloWorld.class into ..\last_directory\com

    1. java -cp .......\last_directory com.HelloWorld
    2. java -cp .......\last_directory HelloWorld(with created com)
    

提交回复
热议问题