[Scala base]--java Run Jar class, Scala run Jar class __java

Source: Internet
Author: User

1, Java Operation

Test jar: Execute---java-classpath f:/testhello.jar Test2

Or

JAVA-CP F:/testhello.jar Test2

Print Results: Hello World

The Java classes are as follows:

/**
 * Document: This kind of function----> Print Hello World
 * USER:YANGJF
 * date:2016/9/25  9:48
/Public Class Test2 {public
    static void Main (string[] args) {
        System.out.println (' Hello World ');
    }



2, Scala operation

Test jar: Execute--"Scala-classpath F:/testhello.jar Test2

Print Results: Hello World

The Scala classes are as follows:

/**
  * Document: This type of action---->
  * USER:YANGJF
  * DATE:2016/9/25  9:37/
object Test2 {
  def Main (args:array[string]) {
    println ("Hello World")
  }
}


Note: If you want to introduce additional packages, you need the following design

JAVA-CP ".: Lib/phoenix-core-4.7.0-hbase-0.98.jar:\
lib/scala-library-2.10.5.jar:\
lib/ Test-phonenix.jar: "\
com.yjf.phoenix.kerberos.QueryPhoenixTableData  \
>>/home/spark/logs/ Hour_cdn_license_queryphoenixtabledata.log 2>&1


The above test passes, can use directly



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.