我試圖讓我的電腦上安裝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