开发者

Please help me get the java command to work

I'm learning how to make and run Java programs in Windows with Notepad and the command line. Right now I'm getting a well-known error when I try to run any sort of variant of java Main, Main being the starting class of the program, and I've done some research on it. The error is java.lang.NoClassDefFoundError, but any of the normal solutions for this error don't seem to be helping.

The program is in <root>\com\zork, and the classes are Main, Dungeon, and DungeonMaster, each in the package com.zork. They've all compiled just fine with the javac command, but attempting to run the program with java Main in either <root>\com\zork or just <root> keeps giving me the error above. I've tried many things with -cp, -classpath, and where I'm running java from. The current classpath is <this directory doesn't matter>;.;"C:\Users\intprof\Desktop\ZORK in Java", although the last entry has also been C:\Users\intprof\Desktop\ZORK in Java\com\zork, nonexistent, and a couple of other things.

What am I开发者_JAVA技巧 doing wrong? Thanks!


You need to run java com.zork.Main.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜