Problems related to the setting of path and classpath in JDK in Java (about the import custom package and jar)

Source: Internet
Author: User

After JDK is installed, you need to set the environment variable path. Otherwise, you can only use the direct path to call commands such as java and javac. XX. set the path of the XX package, that is, classpath. These two environment variables must be set separately so that JDK can find the corresponding file.

First, set path:

In this way, you can use java and javac commands. Then set classpath:

R <喎?http: www.bkjia.com kf ware vc " target="_blank" class="keylink"> VcD4KPHA + kernel/WuMP3zerV + 7 XEwre + kernel/Na4w/ew/Mv51NrEv8K8vLS/kernel + o7o8YnI + kernel = "brush: java;"> package abuge. home; public class Vector {public Vector () {System. out. println ("AbuGe. home. vector ");}}2. Second file:

package abuge.home;public class List{public List(){System.out.println("AbuGe.home.List");}}

3. The third file is the class that references the package: import abuge is used during import. home. *. The wildcard * is used, causing compilation and running to fail. You can reference it directly (I still don't understand why)


The steps for compiling and running JDK are as follows: during this period, the package is packaged into a jar file and then directly called






Related Article

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.