Get Java classpath

Use System.getProperty("java.class.path") to obtain the Java class path.

package com.thb;

import java.io.IOException;

public class Test5 {

    public static void main(String[] args) throws IOException {
        System.out.println(System.getProperty("java.class.path"));
    }

}

Output when running under eclipse:
Insert image description here

Output when running under cmd:
Insert image description here
The output "." indicates the current directory.

Guess you like

Origin blog.csdn.net/panghuangang/article/details/135002396