Twitter 机器人,java,Heroku。 "State changed from up to crashed"

Twitter bot, java, Heroku. "State changed from up to crashed"

我有一个使用 twitter4j 构建的简单 Java Twitter 机器人。我只需要一个 Java class 运行 不间断,应该一切都好。它 运行 在本地很好,但由于某些原因无法 运行 在 Heroku 上。

以下是尝试 运行:

时显示的内容
2019-05-07T18:54:50.555626+00:00 heroku[worker.1]: Starting process with command `java -cp src/BotLottery.java`

2019-05-07T18:54:51.243272+00:00 heroku[worker.1]: State changed from starting to up

2019-05-07T18:54:52.269893+00:00 heroku[worker.1]: Process exited with status 1

2019-05-07T18:54:52.294324+00:00 heroku[worker.1]: State changed from up to crashed

2019-05-07T18:54:52.116218+00:00 app[worker.1]: Picked up JAVA_TOOL_OPTIONS: -Xmx300m -Xss512k -XX:CICompilerCount=2 -Dfile.encoding=UTF-8 

2019-05-07T18:54:52.217204+00:00 app[worker.1]: Usage: java [-options] class [args...]

2019-05-07T18:54:52.217208+00:00 app[worker.1]:            (to execute a class)

2019-05-07T18:54:52.217210+00:00 app[worker.1]:    or  java [-options] -jar jarfile [args...]

2019-05-07T18:54:52.217212+00:00 app[worker.1]:            (to execute a jar file)

2019-05-07T18:54:52.217213+00:00 app[worker.1]: where options include:

2019-05-07T18:54:52.217215+00:00 app[worker.1]:     -d32      use a 32-bit data model if available

2019-05-07T18:54:52.217216+00:00 app[worker.1]:     -d64      use a 64-bit 
data model if available

2019-05-07T18:54:52.217218+00:00 app[worker.1]:     -server   to select the "server" VM

2019-05-07T18:54:52.217220+00:00 app[worker.1]:                   The default VM is server,

2019-05-07T18:54:52.217224+00:00 app[worker.1]:                   because you are running on a server-class machine.

2019-05-07T18:54:52.217226+00:00 app[worker.1]: 

2019-05-07T18:54:52.217227+00:00 app[worker.1]: 

2019-05-07T18:54:52.217229+00:00 app[worker.1]:     -cp <class search path of directories and zip/jar files>

2019-05-07T18:54:52.217230+00:00 app[worker.1]:     -classpath <class search path of directories and zip/jar files>

2019-05-07T18:54:52.217232+00:00 app[worker.1]:                   A : separated list of directories, JAR archives,

2019-05-07T18:54:52.217233+00:00 app[worker.1]:                   and ZIP archives to search for class files.

2019-05-07T18:54:52.217235+00:00 app[worker.1]:     -D<name>=<value>

2019-05-07T18:54:52.217237+00:00 app[worker.1]:                   set a system property

2019-05-07T18:54:52.217239+00:00 app[worker.1]:     -verbose:[class|gc|jni]

2019-05-07T18:54:52.217240+00:00 app[worker.1]:                   enable verbose output

2019-05-07T18:54:52.217242+00:00 app[worker.1]:     -version      print 
product version and exit

2019-05-07T18:54:52.217244+00:00 app[worker.1]:     -version:<value>

2019-05-07T18:54:52.217245+00:00 app[worker.1]:                   Warning: 
this feature is deprecated and will be removed

2019-05-07T18:54:52.217247+00:00 app[worker.1]:                   in a future release.

2019-05-07T18:54:52.217249+00:00 app[worker.1]:                   require the specified version to run

2019-05-07T18:54:52.217250+00:00 app[worker.1]:     -showversion  print product version and continue

2019-05-07T18:54:52.217252+00:00 app[worker.1]:     -jre-restrict-search | -no-jre-restrict-search

2019-05-07T18:54:52.217253+00:00 app[worker.1]:                   Warning: this feature is deprecated and will be removed

2019-05-07T18:54:52.217255+00:00 app[worker.1]:                   in a future release.

2019-05-07T18:54:52.217256+00:00 app[worker.1]:                   include/exclude user private JREs in the version search

2019-05-07T18:54:52.217258+00:00 app[worker.1]:     -? -help      print this help message

2019-05-07T18:54:52.217259+00:00 app[worker.1]:     -X            print help on non-standard options

2019-05-07T18:54:52.217261+00:00 app[worker.1]:     -ea[:<packagename>...|:
<classname>]

2019-05-07T18:54:52.217263+00:00 app[worker.1]:     -enableassertions[:
<packagename>...|:<classname>]

2019-05-07T18:54:52.217265+00:00 app[worker.1]:                   enable 
assertions with specified granularity

2019-05-07T18:54:52.217266+00:00 app[worker.1]:     -da[:<packagename>...|:
<classname>]

2019-05-07T18:54:52.217268+00:00 app[worker.1]:     -disableassertions[:
<packagename>...|:<classname>]

2019-05-07T18:54:52.217269+00:00 app[worker.1]:                   disable 
assertions with specified granularity

2019-05-07T18:54:52.217271+00:00 app[worker.1]:     -esa | -
enablesystemassertions

2019-05-07T18:54:52.217273+00:00 app[worker.1]:                   enable 
system assertions

2019-05-07T18:54:52.217274+00:00 app[worker.1]:     -dsa | -
disablesystemassertions

2019-05-07T18:54:52.217276+00:00 app[worker.1]:                   disable 
system assertions

2019-05-07T18:54:52.217277+00:00 app[worker.1]:     -agentlib:<libname>[=
<options>]

2019-05-07T18:54:52.217279+00:00 app[worker.1]:                   load native 
agent library <libname>, e.g. -agentlib:hprof

2019-05-07T18:54:52.217281+00:00 app[worker.1]:                   see also, -
agentlib:jdwp=help and -agentlib:hprof=help
2019-05-07T18:54:52.217282+00:00 app[worker.1]:     -agentpath:<pathname>[=

<options>]

2019-05-07T18:54:52.217284+00:00 app[worker.1]:                   load native 
agent library by full pathname

2019-05-07T18:54:52.217285+00:00 app[worker.1]:     -javaagent:<jarpath>[=
<options>]

2019-05-07T18:54:52.217287+00:00 app[worker.1]:                   load Java 
programming language agent, see java.lang.instrument

2019-05-07T18:54:52.217289+00:00 app[worker.1]:     -splash:<imagepath>

2019-05-07T18:54:52.217291+00:00 app[worker.1]:                   show splash 
screen with specified image

2019-05-07T18:54:52.217298+00:00 app[worker.1]: See http://www.oracle.com/technetwork/java/javase/documentation/index.html for more details.

Starting process with command java -cp src/BotLottery.java

我觉得这不对。类路径为空。它应该是 .jar.class 文件。不是 .java 文件。