命令行如何来识别这个java命令? [英] How come command line isn't recognizing this java command?
本文介绍了命令行如何来识别这个java命令?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我输入 java -classpath C:\blahblahblah\software_engineering\cs2.jar
作为建议的一部分:为什么我的IDE找到JAR,但我的命令行不'
I enter java -classpath C:\blahblahblah\software_engineering\cs2.jar
as part of a suggestion here: Why does my IDE find the JAR but my command line doesn't? .
我确定这是一个有效的命令,但我收到这个累了的列表:
I'm pretty sure this is a valid command, but I instead receive this tired list:
Usage: java [-options] class [args...]
(to execute a class)
or java [-options] -jar jarfile [args...]
(to execute a jar file)
where options include:
-server to select the "server" VM
-hotspot is a synonym for the "server" VM [deprecated]
The default VM is server.
-cp <class search path of directories and zip/jar files>
-classpath <class search path of directories and zip/jar files>
A ; separated list of directories, JAR archives,
and ZIP archives to search for class files.
-D<name>=<value>
set a system property
-verbose[:class|gc|jni]
enable verbose output
-version print product version and exit
-version:<value>
require the specified version to run
-showversion print product version and continue
-jre-restrict-search | -jre-no-restrict-search
include/exclude user private JREs in the version search
-? -help print this help message
-X print help on non-standard options
-ea[:<packagename>...|:<classname>]
-enableassertions[:<packagename>...|:<classname>]
enable assertions
-da[:<packagename>...|:<classname>]
-disableassertions[:<packagename>...|:<classname>]
disable assertions
-esa | -enablesystemassertions
enable system assertions
-dsa | -disablesystemassertions
disable system assertions
-agentlib:<libname>[=<options>]
load native agent library <libname>, e.g. -agentlib:hprof
see also, -agentlib:jdwp=help and -agentlib:hprof=help
-agentpath:<pathname>[=<options>]
load native agent library by full pathname
-javaagent:<jarpath>[=<options>]
load Java programming language agent, see java.lang.instrument
-splash:<imagepath>
show splash screen with specified image
如何做?
推荐答案
你给它一个类路径,但不是要执行的类的名称。您也只有 ,包括类路径上的jar文件,而不是包含类文件的目录。
You're giving it a classpath, but not the name of the class to execute. You're also only including the jar file on your classpath - not the directory containing your class file.
其他问题:
java -cp .;cs2.jar CB
(从包含 CB.class
和 cs2.jar
。)
(Run from the directory containing both CB.class
and cs2.jar
.)
这篇关于命令行如何来识别这个java命令?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文