我试图让我的电脑上安装java,并且遇到问题。我相信这些问题与正确配置路径有关。Java路径设置
目前,如果我在CMD线运行java,我得到如下:
用法:JAVA [-options]类[参数...] (执行类) 或Java [-options ] -jar jarfile [args ...] (执行jar文件) 其中选项包括: -d32使用32位数据模型(如果可用) -d64使用64位数据模型(如果可用) -client选择“客户端”VM -server以选择“服务器”VM 默认VM是客户端。
-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>
Warning: this feature is deprecated and will be removed
in a future release.
require the specified version to run
-showversion print product version and continue
-jre-restrict-search | -no-jre-restrict-search
Warning: this feature is deprecated and will be removed
in a future release.
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 with specified granularity
-da[:<packagename>...|:<classname>]
-disableassertions[:<packagename>...|:<classname>]
disable assertions with specified granularity
-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
查看http://www.oracle.com/technetwork/java/javase/documentation/index.html了解更多详情。
然而,当我尝试运行javac,我得到如下:
的bash:javac的:命令未找到
我试图通过以下YouTube上的视频设置的路径,但它确实似乎没有帮助。
任何意见将不胜感激。
预先感谢您。
你安装了JDK还是只安装了JRE? – MadProgrammer
你不需要使用git bash来运行Java –
您需要JDK用于'javac'。除此之外,'java'的输出看起来很好。您需要指定类的名称(例如'java --classpath =/path/to/.class/files MyClass')或JAR(例如java -jar/path/to/app.jar)。 – kba