1、场景:
争对网上的很多文章中javac编译与java运行的文章,有很多不明确的地方,使得在合适时发现很多坑。这里给大家作下简介。
2、Javac的使用注意:
javac -d ./ ./InstallCert.java
其中-d表示要编译到哪里,加-d的目地是让后面加的java文件编译后,可以产生由package名称所确定的文件夹结构下的class文件。这样再运行java去执行时,就不会提示找不到类模块了。
3、Java的使用注意:
java -classpath ./;c:mylib.jar;c:mylib2.jar packagename.className
其中-classpath后面指定./表示前面 javac 编译时-d所指定的目录,之后加所依赖的jar文件,注意的是,windows上要用;分隔,而linux上要用:分隔。最后加空格加上包名.类名。
如:
"C:Program Files (x86)Javajdk1.8.0_111injava.exe" -classpath D:ProjectJavaProjectAzureDemo argetclasses;C:Usersyungoal.m2 epositorycommicrosoftazureazure1.0.0-beta3azure-1.0.0-beta3.jar;C:Usersyungoal.m2 epositorycommicrosoftazureazure-client-runtime1.0.0-beta3azure-client-runtime-1.0.0-beta3.jar;C:Usersyungoal.m2 epositorycommicrosoftazureazure-client-authentication1.0.0-beta3azure-client-authentication-1.0.0-beta3.jar;C:Usersyungoal.m2 epositorycommicrosoftazureadal4j1.1.2adal4j-1.1.2.jar;C:Usersyungoal.m2 epositorycom imbusdsoauth2-oidc-sdk4.5oauth2-oidc-sdk-4.5.jar;C:Usersyungoal.m2 epositoryjavaxmailmail1.4.7mail-1.4.7.jar;C:Usersyungoal.m2 epositoryjavaxactivationactivation1.1activation-1.1.jar;C:Usersyungoal.m2 epository etjcipjcip-annotations1.0jcip-annotations-1.0.jar;C:Usersyungoal.m2 epository etminidevjson-smart1.1.1json-smart-1.1.1.jar;C:Usersyungoal.m2 epositorycom imbusdslang-tag1.4lang-tag-1.4.jar;C:Usersyungoal.m2 epositorycom imbusds imbus-jose-jwt3.1.2 imbus-jose-jwt-3.1.2.jar;C:Usersyungoal.m2 epositoryorgouncycastlecprov-jdk15on1.51cprov-jdk15on-1.51.jar;C:Usersyungoal.m2 epositorycomgooglecodegsongson2.2.4gson-2.2.4.jar;C:Usersyungoal.m2 epositoryorgslf4jslf4j-api1.7.5slf4j-api-1.7.5.jar;C:Usersyungoal.m2 epositorycommicrosoftazureazure-mgmt-resources1.0.0-beta3azure-mgmt-resources-1.0.0-beta3.jar;C:Usersyungoal.m2 epositorycommicrosoftazureazure-mgmt-storage1.0.0-beta3azure-mgmt-storage-1.0.0-beta3.jar;C:Usersyungoal.m2 epositorycommicrosoftazureazure-mgmt-network1.0.0-beta3azure-mgmt-network-1.0.0-beta3.jar;C:Usersyungoal.m2 epositorycommicrosoftazureazure-mgmt-compute1.0.0-beta3azure-mgmt-compute-1.0.0-beta3.jar;C:Usersyungoal.m2 epositorycommicrosoftazureazure-mgmt-graph-rbac1.0.0-beta3azure-mgmt-graph-rbac-1.0.0-beta3.jar;C:Usersyungoal.m2 epositorycommicrosoftazureazure-mgmt-keyvault1.0.0-beta3azure-mgmt-keyvault-1.0.0-beta3.jar;C:Usersyungoal.m2 epositorycommicrosoftazureazure-mgmt-batch1.0.0-beta3azure-mgmt-batch-1.0.0-beta3.jar;C:Usersyungoal.m2 epositorycommicrosoftazureapi-annotations .0.1api-annotations-0.0.1.jar;C:Usersyungoal.m2 epositorycommicrosoft estclient-runtime1.0.0-beta3client-runtime-1.0.0-beta3.jar;C:Usersyungoal.m2 epositorycomgoogleguavaguava18.0guava-18.0.jar;C:Usersyungoal.m2 epositorycomsquareup etrofit2 etrofit2.0.2 etrofit-2.0.2.jar;C:Usersyungoal.m2 epositorycomsquareupokhttp3okhttp3.3.1okhttp-3.3.1.jar;C:Usersyungoal.m2 epositorycomsquareupokiookio1.8.0okio-1.8.0.jar;C:Usersyungoal.m2 epositorycomsquareupokhttp3logging-interceptor3.3.1logging-interceptor-3.3.1.jar;C:Usersyungoal.m2 epositorycomsquareupokhttp3okhttp-urlconnection3.3.1okhttp-urlconnection-3.3.1.jar;C:Usersyungoal.m2 epositorycomsquareup etrofit2converter-jackson2.0.2converter-jackson-2.0.2.jar;C:Usersyungoal.m2 epositorycomfasterxmljacksoncorejackson-databind2.7.2jackson-databind-2.7.2.jar;C:Usersyungoal.m2 epositorycomfasterxmljacksondatatypejackson-datatype-joda2.7.2jackson-datatype-joda-2.7.2.jar;C:Usersyungoal.m2 epositorycomfasterxmljacksoncorejackson-annotations2.7.0jackson-annotations-2.7.0.jar;C:Usersyungoal.m2 epositorycomfasterxmljacksoncorejackson-core2.7.2jackson-core-2.7.2.jar;C:Usersyungoal.m2 epositoryjoda-timejoda-time2.4joda-time-2.4.jar;C:Usersyungoal.m2 epositoryorgapachecommonscommons-lang33.4commons-lang3-3.4.jar;C:Usersyungoal.m2 epositoryio eactivex xjava1.1.8 xjava-1.1.8.jar;C:Usersyungoal.m2 epositorycomsquareup etrofit2adapter-rxjava2.0.2adapter-rxjava-2.0.2.jar;C:Usersyungoal.m2 epositorycommicrosoftazureazure-keyvault1.0.0-beta3azure-keyvault-1.0.0-beta3.jar;C:Usersyungoal.m2 epositorycommicrosoftazureazure-keyvault-webkey1.0.0-beta3azure-keyvault-webkey-1.0.0-beta3.jar;C:Usersyungoal.m2 epositorycommons-codeccommons-codec1.10commons-codec-1.10.jar com.test.azuredemo.Test