Does Java program execute only java-jar?

Source: Internet
Author: User
Tags deprecated

Java-jar Xxx.jar params form for so many years, did not care that the original Java execution commands can be multivariate.

These two days just look at ROCKETMQ, by the way the shell script, and then found that I have so many years of Java-jar how ignorant.


Let's start with a command:

java-djava.ext.dirs= $ROCKETMQ _HOME/LIB-CP $ROCKETMQ _home/lib/rocketmq-example-3.5.8.jar Com.alibaba.rocketmq.example.simple.Producer


This command is to test the ROCKETMQ message generation class to generate the message.


Then looked back at the Java-help, instantly know. So many of our engineering writing, actually do not have to struggle with the Java packaging startup class is in the packaging time has been scored, do not have to tangle with a jar package has n multiple portals.


2012 when I was in a project to do a two-level center, then for a project of three entrances are called, the same set of code, configured with three Meta-inf, the inside of the portal class configured, and hit three jars, if the change code to repackage, time-consuming effort.

Now think back, if you do now, is to hit a jar package, three shell scripts, instant resolution of everything. Those who create these things are really geniuses, and the people who use them may need endless learning.


[Email protected] ~]$ Java-help

Usage:java [-options] class [args ...]

(to execute a class)

or Java [-options]-jar jarfile [args ...]

(To execute a jar file)

Where options include:

-d32 use a 32-bit data model if available

-d64 use a 64-bit data model if available

-server to select the "Server" VM

The default VM is server,

Because you is running on a server-class machine.



-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 would 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 would 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

See http://www.oracle.com/technetwork/java/javase/documentation/index.html for more details.




This article is from the "a flower proud of the Cold" blog, please be sure to keep this source http://feiweihy.blog.51cto.com/6389397/1868120

Does Java program execute only java-jar?

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.