java编译

查看jar包内容

jar vtf  /jar/path/org/apache/commons/commons-lang3/3.3.2/commons-lang3-3.3.2.jar

     0 Sun Apr 06 14:19:20 CST 2014 META-INF/
  1854 Sun Apr 06 14:19:18 CST 2014 META-INF/MANIFEST.MF
     0 Sun Apr 06 14:07:50 CST 2014 org/
     0 Sun Apr 06 14:07:50 CST 2014 org/apache/
     0 Sun Apr 06 14:07:50 CST 2014 org/apache/commons/
     0 Sun Apr 06 14:18:58 CST 2014 org/apache/commons/lang3/
     0 Sun Apr 06 14:18:58 CST 2014 org/apache/commons/lang3/builder/
     0 Sun Apr 06 14:18:58 CST 2014 org/apache/commons/lang3/concurrent/
     0 Sun Apr 06 14:18:58 CST 2014 org/apache/commons/lang3/event/
     0 Sun Apr 06 14:18:58 CST 2014 org/apache/commons/lang3/exception/
     0 Sun Apr 06 14:18:58 CST 2014 org/apache/commons/lang3/math/
     0 Sun Apr 06 14:18:58 CST 2014 org/apache/commons/lang3/mutable/
     0 Sun Apr 06 14:18:58 CST 2014 org/apache/commons/lang3/reflect/
     0 Sun Apr 06 14:18:58 CST 2014 org/apache/commons/lang3/text/
     0 Sun Apr 06 14:18:58 CST 2014 org/apache/commons/lang3/text/translate/
     0 Sun Apr 06 14:18:58 CST 2014 org/apache/commons/lang3/time/
     0 Sun Apr 06 14:18:58 CST 2014 org/apache/commons/lang3/tuple/
 11358 Sun Apr 06 14:07:48 CST 2014 META-INF/LICENSE.txt
   301 Sun Apr 06 14:07:48 CST 2014 META-INF/NOTICE.txt
  2602 Sun Apr 06 14:18:58 CST 2014 org/apache/commons/lang3/AnnotationUtils$1.class
  7004 Sun Apr 06 14:18:58 CST 2014 org/apache/commons/lang3/AnnotationUtils.class
 49696 Sun Apr 06 14:18:56 CST 2014 org/apache/commons/lang3/ArrayUtils.class
  2367 Sun Apr 06 14:18:58 CST 2014 org/apache/commons/lang3/BitField.class
  8553 Sun Apr 06 14:18:56 CST 2014 org/apache/commons/lang3/BooleanUtils.class
   246 Sun Apr 06 14:18:56 CST 2014 org/apache/commons/lang3/builder/Builder.class
 11465 Sun Apr 06 14:18:58 CST 2014 org/apache/commons/lang3/builder/CompareToBuilder.class
  2068 Sun Apr 06 14:18:56 CST 2014 org/apache/commons/lang3/builder/Diff.class
   337 Sun Apr 06 14:18:58 CST 2014 org/apache/commons/lang3/builder/Diffable.class
  1378 Sun Apr 06 14:18:58 CST 2014 org/apache/commons/lang3/builder/DiffBuilder$1.class
  1402 Sun Apr 06 14:18:58 CST 2014 org/apache/commons/lang3/builder/DiffBuilder$10.class
  1380 Sun Apr 06 14:18:58 CST 2014 org/apache/commons/lang3/builder/DiffBuilder$11.class
  1408 Sun Apr 06 14:18:58 CST 2014 org/apache/commons/lang3/builder/DiffBuilder$12.class
  1364 Sun Apr 06 14:18:58 CST 2014 org/apache/commons/lang3/builder/DiffBuilder$13.class
  1399 Sun Apr 06 14:18:58 CST 2014 org/apache/commons/lang3/builder/DiffBuilder$14.class
.....
.....
.....
 13646 Sun Apr 06 14:18:56 CST 2014 org/apache/commons/lang3/math/NumberUtils.class
.....
.....
.....
  1075 Sun Apr 06 14:18:56 CST 2014 org/apache/commons/lang3/time/FastDatePrinter$StringLiteral.class
  1314 Sun Apr 06 14:18:56 CST 2014 org/apache/commons/lang3/time/FastDatePrinter$TextField.class
  1268 Sun Apr 06 14:18:56 CST 2014 org/apache/commons/lang3/time/FastDatePrinter$TimeZoneDisplayKey.class
  1736 Sun Apr 06 14:18:56 CST 2014 org/apache/commons/lang3/time/FastDatePrinter$TimeZoneNameRule.class
  1467 Sun Apr 06 14:18:56 CST 2014 org/apache/commons/lang3/time/FastDatePrinter$TimeZoneNumberRule.class
  1340 Sun Apr 06 14:18:56 CST 2014 org/apache/commons/lang3/time/FastDatePrinter$TwelveHourField.class
  1347 Sun Apr 06 14:18:56 CST 2014 org/apache/commons/lang3/time/FastDatePrinter$TwentyFourHourField.class
  1247 Sun Apr 06 14:18:56 CST 2014 org/apache/commons/lang3/time/FastDatePrinter$TwoDigitMonthField.class
  1395 Sun Apr 06 14:18:56 CST 2014 org/apache/commons/lang3/time/FastDatePrinter$TwoDigitNumberField.class
  1245 Sun Apr 06 14:18:56 CST 2014 org/apache/commons/lang3/time/FastDatePrinter$TwoDigitYearField.class
  1300 Sun Apr 06 14:18:56 CST 2014 org/apache/commons/lang3/time/FastDatePrinter$UnpaddedMonthField.class
  1423 Sun Apr 06 14:18:56 CST 2014 org/apache/commons/lang3/time/FastDatePrinter$UnpaddedNumberField.class
 12485 Sun Apr 06 14:18:56 CST 2014 org/apache/commons/lang3/time/FastDatePrinter.class
  1079 Sun Apr 06 14:18:56 CST 2014 org/apache/commons/lang3/time/FormatCache$MultipartKey.class
  4852 Sun Apr 06 14:18:56 CST 2014 org/apache/commons/lang3/time/FormatCache.class
   238 Sun Apr 06 14:18:58 CST 2014 org/apache/commons/lang3/time/StopWatch$1.class
  1214 Sun Apr 06 14:18:58 CST 2014 org/apache/commons/lang3/time/StopWatch$SplitState.class
   843 Sun Apr 06 14:18:58 CST 2014 org/apache/commons/lang3/time/StopWatch$State$1.class
   843 Sun Apr 06 14:18:58 CST 2014 org/apache/commons/lang3/time/StopWatch$State$2.class
   843 Sun Apr 06 14:18:58 CST 2014 org/apache/commons/lang3/time/StopWatch$State$3.class
   843 Sun Apr 06 14:18:58 CST 2014 org/apache/commons/lang3/time/StopWatch$State$4.class
  1909 Sun Apr 06 14:18:58 CST 2014 org/apache/commons/lang3/time/StopWatch$State.class
  3646 Sun Apr 06 14:18:58 CST 2014 org/apache/commons/lang3/time/StopWatch.class
  1629 Sun Apr 06 14:18:58 CST 2014 org/apache/commons/lang3/tuple/ImmutablePair.class
  1703 Sun Apr 06 14:18:56 CST 2014 org/apache/commons/lang3/tuple/ImmutableTriple.class
  1998 Sun Apr 06 14:18:58 CST 2014 org/apache/commons/lang3/tuple/MutablePair.class
  2194 Sun Apr 06 14:18:58 CST 2014 org/apache/commons/lang3/tuple/MutableTriple.class
  3289 Sun Apr 06 14:18:56 CST 2014 org/apache/commons/lang3/tuple/Pair.class
  3209 Sun Apr 06 14:18:56 CST 2014 org/apache/commons/lang3/tuple/Triple.class
 14323 Sun Apr 06 14:18:58 CST 2014 org/apache/commons/lang3/Validate.class
     0 Sun Apr 06 14:19:20 CST 2014 META-INF/maven/
     0 Sun Apr 06 14:19:20 CST 2014 META-INF/maven/org.apache.commons/
     0 Sun Apr 06 14:19:20 CST 2014 META-INF/maven/org.apache.commons/commons-lang3/
 20377 Sun Apr 06 14:06:04 CST 2014 META-INF/maven/org.apache.commons/commons-lang3/pom.xml
   117 Sun Apr 06 14:08:14 CST 2014 META-INF/maven/org.apache.commons/commons-lang3/pom.properties
jar包内容样例

 

设置环境变量

export CLASSPATH=.:/Users/zhangjiansheng10/.m2/repository/org/apache/commons/commons-lang3/3.3.2/commons-lang3-3.3.2.jar

代码

import org.apache.commons.lang3.math.NumberUtils;


public class HelloWorld {
    public static void main(String[] args){
        System.out.println("Hello World!");
        String str = "123*422@100";
        //String str = "100";
        long a = NumberUtils.toLong(str);
        System.out.println("a:" + a);
    }
}

  

编译

javac  -classpath /jar/path/org/apache/commons/commons-lang3/3.3.2/commons-lang3-3.3.2.jar  HelloWorld.java

java HelloWorld

 

Maven编译

<plugin>
              <groupId>com.github.os72</groupId>
              <artifactId>protoc-jar-maven-plugin</artifactId>
              <version>3.5.1</version>
              <executions>
                  <execution>
                      <phase>generate-sources</phase>
                      <goals>
                          <goal>run</goal>
                      </goals>
                      <configuration>
                          <protocArtifact>com.google.protobuf:protoc:3.0.0</protocArtifact>
                          <inputDirectories>
                              <include>src/main/protobuf</include>
                          </inputDirectories>
                         <outputTargets>
                              <outputTarget>
                                  <type>java</type>
                                  <outputDirectory>src/main/java</outputDirectory>
                              </outputTarget>
                              <outputTarget>
                                  <type>grpc-java</type>
                                  <outputDirectory>src/main/java</outputDirectory>
                                  <pluginArtifact>io.grpc:protoc-gen-grpc-java:1.0.1</pluginArtifact>
                              </outputTarget>
                          </outputTargets>
                      </configuration>
                  </execution
              </executions>
       </plugin>

我通过“ mvn protoc-jar:run”执行它,但是它跳过了grpc服务存根,只将“消息”隐蔽到Java代码中。

 

 

 

posted on 2022-04-29 23:36  cfox  阅读(35)  评论(0编辑  收藏  举报

导航