Maven 3.0.4错误在Windows 8 x64上:用法:java [-options] class [args ...] [英] Maven 3.0.4 error on Windows 8 x64: Usage: java [-options] class [args...]

查看:1060
本文介绍了Maven 3.0.4错误在Windows 8 x64上:用法:java [-options] class [args ...]的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我在这个论坛上的第一篇文章。我有一个Maven 3的问题。操作系统:Windows 8 Professional RTM。



如果我运行任何maven命令(无论如何),我总是得到以下答案:


用法:java [-options] class [args ...]
(执行一个类)或java [-options] -jar jarfile [args ...]
(执行jar文件)



其中选项包括:
-server选择服务器VM
-hotspot是服务器VM的同义词[已弃用]
默认的VM是服务器。

  -cp<目录和zip / jar文件的搜索路径> 
-classpath<目录和zip / jar文件的类搜索路径>
A;目录分离列表,JAR存档,
和ZIP存档来搜索类文件。
-D< name> =< value>
设置系统属性
-verbose [:class | gc | jni]
启用详细输出
-version打印产品版本并退出
-version:< value> ;
要求指定的版本运行
-showversion打印产品版本并继续
-jre-restrict-search | -jre-no-restriction-search
在版本搜索中包含/排除用户私有JRE
- ? -help打印此帮助消息
-X在非标准选项上打印帮助
-ea [:< packagename> ... |:< classname>]
-enableassertions [:< ; packagename> ... |:< classname>]
启用断言
-da [:< packagename> ... |:< classname>]
-disableassertions [:< ; packagename> ... |:< classname>]
禁用断言
-esa | -enablesystemassertions
启用系统断言
-dsa | -disablesystemassertions
禁用系统断言
-agentlib:< libname> [=< options>]
加载本机代理库< libname> -agentlib:hprof
另请参见:-agentlib:jdwp = help和-agentlib:hprof = help
-agentpath:< pathname> [=< options>]
加载本机代理库通过完整路径名
-javaagent:< jarpath> [=< options>]
加载Java编程语言代理,请参见java.lang.instrument

-splash:的ImagePath>
显示具有指定图像的初始屏幕


我用Google和论坛搜索,但唯一的结果是一个不同的问题:这是一个环境变量的问题(大多数结束路径与额外的斜杠)。



如果我执行java -version我得到:


java版本1.6.0_35Java(TM)SE运行时环境(build
1.6。 0_35-b10)Java HotSpot(TM)64位服务器虚拟机(构建20.10-b01,混合模式)


如果我执行javac -version我得到:


javac 1.6.0_35



$ b $我使用的Maven主题是3.0.4。这些是我添加的环境变量(我添加了M2_HOME和MAVEN_HOME,因为我不知道哪个是正确的变量):

  CATALINA_OPTS =%MAVEN_OPTS%
CLASSPATH =%JAVA_HOME%\src.zip;%JAVA_HOME%\lib\tools.jar;
JAVA_HOME = C:\Program Files\Java\jdk1.6.0_35
M2_HOME = d:\software\apache-maven-3.0.4
MAVEN_HOME = d:\\ \\ softwareware \apache-maven-3.0.4
MAVEN_OPTS = -Xms512m -Xmx1024m -XX:PermSize = 256m -XX:MaxPermSize = 512m
PATH =%JAVA_HOME%\bin;%MAVEN_HOME%\\ \\ bin; d:\software\eclipse;%M2_HOME%\bin

路径环境变量有更多的路径,但我只是粘贴在这里我为最后一年项目添加的路径。



提前感谢您的帮助。

解决方案

您需要设置的唯一环境变量是:

  JAVA_HOME = C:\Program Files\Java\jdk1.6.0_35 
MAVEN_HOME = D:\software\apache-maven-3.0.4
PATH =%PATH%;%MAVEN_HOME% \bin;%JAVA_HOME%\bin

请注意,使用D:而不是d: p>

This is my first post on this forum. I have a problem with Maven 3. OS: Windows 8 Professional RTM.

If I run any maven command (whatever) I always get the following answer:

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

I used Google and forum search but the only results were a different problem: it was a problem on environment variables (most of them ending the path with an additional slash).

If I execute java -version I get:

java version "1.6.0_35" Java(TM) SE Runtime Environment (build 1.6.0_35-b10) Java HotSpot(TM) 64-Bit Server VM (build 20.10-b01, mixed mode)

If I execute javac -version I get:

javac 1.6.0_35

The Maven verssion I am using is 3.0.4. These are the environment variables I added (I added M2_HOME and MAVEN_HOME because I am not sure about which one is the right variable):

CATALINA_OPTS=%MAVEN_OPTS%
CLASSPATH=%JAVA_HOME%\src.zip;%JAVA_HOME%\lib\tools.jar;
JAVA_HOME=C:\Program Files\Java\jdk1.6.0_35
M2_HOME=d:\software\apache-maven-3.0.4
MAVEN_HOME=d:\software\apache-maven-3.0.4
MAVEN_OPTS=-Xms512m -Xmx1024m -XX:PermSize=256m -XX:MaxPermSize=512m
PATH=%JAVA_HOME%\bin;%MAVEN_HOME%\bin;d:\software\eclipse;%M2_HOME%\bin

The path environment variable has more paths but I just pasted here the paths I added for my final year project.

Thanks in advance for your help.

解决方案

The only environment variables you need to set are:

JAVA_HOME=C:\Program Files\Java\jdk1.6.0_35
MAVEN_HOME=D:\software\apache-maven-3.0.4
PATH=%PATH%;%MAVEN_HOME%\bin;%JAVA_HOME%\bin

Note, use D: instead of d:

这篇关于Maven 3.0.4错误在Windows 8 x64上:用法:java [-options] class [args ...]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆