Run from command line, Wrong Name error

后端 未结 6 1887
栀梦
栀梦 2020-12-22 07:58

I want to run a Java project from the command line which I start using a batch file, but I get the wrong name error.

The directory setup:

  • srcMVC
      <
6条回答
  •  Happy的楠姐
    2020-12-22 08:49

    you are wrongly exicuting java bin\main.main

    main() is your main method but you should supply java interpreter the Class Name which implements main()

    So if your class name is Test and file name is Test.java which has main() method

    java Test

    if your Test.java/Test class in is package my.test e.g - package com.my.test;

    than, java com.my.test.Test

    hope you got it !!

提交回复
热议问题