Use Java -cp command

        Server to run the program, uses some Linux commands, to be a simple note.

        Linux (Mac) at

java -cp:. jar package fully qualified name of the main class path

     There are fully qualified name of the absolute path means, such as a document file storage path, the absolute path might be / usr / local / sbin / file ;
        the term is also used in other places, such as the Java class package naming: com.linux. struct.sort.bubblesort, quoted from the most primitive to the top place specific object, which is a fully qualified name.

       E.g

java -cp .:myClass.jar packname.mainclassname

    windows next to. ;myClass.jar colon into a semicolon 

 

    From the beginning java1.6, cp parameter supports wildcard matching jar file. Two things to note:

    1. quotes"

    2. *instead*.jar

    This time can be directly written so

Windows:

java -cp "Test.jar;lib/*" my.package.MainClass

Linux:

java -cp "Test.jar:lib/*" my.package.MainClass

 

    With no personal habits: the wording directly with spaces

Guess you like

Origin www.cnblogs.com/nekopower/p/11589158.html