zoukankan      html  css  js  c++  java
  • Java 略记

    通常

    编译Java app  javac appname.java

    执行Java app  java appname(Java虚拟机)

    此外,Setting an Entry Point with the JAR Tool(how to run *.jar)

    The 'e' flag (for 'entrypoint'), introduced in JDK 6, creates or overrides the manifest's Main-Class attribute. It can be used while creating or updating a jar file. Use it to specify the application entry point without editing or creating the manifest file.
    For example, this command creates app.jar where the Main-Class attribute value in the manifest is set to MyApp:
    
    jar cfe app.jar MyApp MyApp.class
    You can directly invoke this application by running the following command:
    
    java -jar app.jar
    If the entrypoint class name is in a package it may use a '.' (dot) character as the delimiter. For example, if Main.classis in a package called foo the entry point can be specified in the following ways:
    
    jar cfe Main.jar foo.Main foo/Main.class

    使用makefile编译,生成dex格式的jar文件(在dalvik VM上运行)

    ANDROID_SRC_DIR = /home/ymy/android/android-4.2
    android_dir_dx = /home/ymy/android/platform-tools/dx
    all:
    javac hello.java -cp ../framework/core.jar
    $(android_dir_dx) --dex --output=hello.jar hello.class
    clean:
    @rm *.jar *.class

    运行(dx是指anroid SDK 中的dx工具,负责将java.class转换为dex格式,以便在dalvik上运行)

    dalvik -cp hello.jar hello   #classes.dex is created and stored inside in this hello.jar
  • 相关阅读:
    How to Build Office Developer Tools Projects with TFS Team Build 2012
    查看hyper-v主机mac地址
    “Stamping” PDF Files Downloaded from SharePoint 2010
    PostgreSQL体系基本概念
    PostgreSQL 安装
    HDFS+MapReduce+Hive+HBase十分钟快速入门
    光照计算公式
    游戏中的碰撞
    数组
    扑克牌概率
  • 原文地址:https://www.cnblogs.com/rayfloyd/p/2773485.html
Copyright © 2011-2022 走看看