比如写个了helloworld,在idea内部build了,然后cd切换到class文件所在目录,直接java运行,报错找不到主类
这种一般怎么解决的?
java文件有“com.xx.xx”这种package声明
PHP中文网2017-04-18 10:57:21
Look at the name of your com.xx.xx, create xx in the folder com in the current path, create xx in xx, copy the class file into it, and then return to the current path java com.xx.xx. Just name it and it’s ready to run
黄舟2017-04-18 10:57:21
1.idea has been compiled, similar to
2. Switch the directory to the upper-level folder of the top-level directory of your package (my top-level is cn, to the upper-level directory of cn, I am < code>E:workspacejavapackageDemooutproductionpackageDemo), add this directory to CLASSPATHE:workspacejavapackageDemooutproductionpackageDemo
),将这个目录添加到CLASSPATH
3.在目录下打开cmd
4.执行java [package].className
3. Open cmd in the directory 4. Execute java [package].className