classpath does not default to current directory

前端 未结 1 1351
情歌与酒
情歌与酒 2021-01-17 01:10

I wrote and compiled a simple Hello World program in Java but when I tried to run it I was greeted with the error message Error: Could not find or load main class Hell

相关标签:
1条回答
  • 2021-01-17 02:07

    I expect that a CLASSPATH environment variable has been set. Run echo $CLASSPATH to see what it is set to.

    If you don't use the -jar option then:

    • If there is a -cp, that specifies the classpath
    • Else if CLASSPATH is set in the environment, that specifies the classpath
    • Else a default classpath of "." is used.
    0 讨论(0)
提交回复
热议问题