1. jdk/bin/jps should list all the java process IDs running that system
  2. subsequently invoke jdk/bin/jinfo <pid> to see lot of information... what you require is also there...
Answer from K Adithyan on Stack Exchange
🌐
Mkyong
mkyong.com › home › java › how to print out the current project classpath
How to print out the current project classpath - Mkyong.com
August 30, 2012 - As per “Sham” comment, this works; System.out.println(System.getProperty(“java.class.path”).replace(‘:’,’\n’)); ... Thanks again, MKyong, very useful ! ... Thanks! Very helpful! ... Thank man. Love your blog. ... It’s “correct” in some sense, but I know of at least two cases where it’s not what you really want: (1) On systems where the classpath length may exceed command-line or other limits, the system property may include at least one level of indirection via the Class-Path keyword in a jar’s manifest.
🌐
Java2Blog
java2blog.com › home › core java › java path › print classpath in java
Print Classpath in Java - Java2Blog
February 14, 2022 - ... You can use System.getProperty("java.class.path") to get ClassPath in java. CLASSPATH variables tell application to location where it should find user classes. Default CLASSPATH is current working directory(.). You can override this value using CLASSPATH variables or -cp command...
🌐
Blogger
javahungry.blogspot.com › 2022 › 09 › java-print-classpath.html
Java Print Classpath | Java Hungry
The java.class.path argument extracts CLASSPATH using System.getProperty() and split its paths using String's split() method as shown below in the example: import java.io.File; public class PrintClasspathJava { public static void main(String args[]) { String classpath = System.getProperty(...
🌐
Baeldung
baeldung.com › home › java › core java › understanding java’s classpath vs. build path
Understanding Java’s Classpath vs. Build Path | Baeldung
August 28, 2024 - To set the classpath via the command line, we use the -classpath option when running the java command: ... Here, MyProgram is the name of the main class, and /path/to/class/files is the directory where the class file is located.
🌐
Blogger
javarevisited.blogspot.com › 2011 › 01 › how-classpath-work-in-java.html
How to Set Classpath for Java on Windows and Linux? Steps and Example
To set Classpath for Java In Linux, ... your Linux or Unix Machine. Now to check the value of Java CLASSPATH in Linux type "echo ${CLASSPATH}" this will print the value of Classpath in the command prompt....
🌐
Oracle
docs.oracle.com › javase › tutorial › essential › environment › paths.html
PATH and CLASSPATH (The Java™ Tutorials > Essential Java Classes > The Platform Environment)
This will print the version of the java tool, if it can find it. If the version is old or you get the error java: Command not found, then the path is not properly set. To set the path permanently, set the path in your startup file. For C shell (csh), edit the startup file (~/.cshrc): ... For ksh, the startup file is named by the environment variable, ENV. To set the path: ... The CLASSPATH variable is one way to tell applications, including the JDK tools, where to look for user classes.
🌐
HowToDoInJava
howtodoinjava.com › home › java examples › java – set classpath from command line
Java - Set Classpath from Command Line
January 25, 2022 - In Windows, the path separator is semicolon ( ; ) and the path separator in Linux is colon ( : ). ... Use -classpath or -cp option to provide the classpath locations while starting the Java application or tool.
Find elsewhere
🌐
How to do in Java
howtodoinjava.com › home › java basics › java classpath
How to set CLASSPATH in Java - HowToDoInJava
February 23, 2023 - Use -classpath argument to set classpath from command prompt/console.
🌐
Stack Overflow
stackoverflow.com › questions › 55859560 › is-there-a-way-to-get-the-classpath-from-a-intellij-project-in-order-to-execute
java - Is there a way to get the classpath from a Intellij project in order to execute the project from the command line (terminal)? - Stack Overflow
I have created a large Maven project in Intellij IDEA that uses many libraries and Maven dependencies, I now have to be able to run it from the command line (using Terminal in MacOS Mojave). Is the...
🌐
Java Code Geeks
javacodegeeks.com › home › core java
Get Classpath from Classloader in Java - Java Code Geeks
December 9, 2024 - The method getURLs() returns an array of URLs that represent the locations where the ClassLoader is searching for classes. These URLs are then printed one by one using a for loop, displaying the classpath used by the custom ClassLoader to load classes. ... The ClassLoader is a crucial part of the Java runtime environment, enabling the dynamic loading of classes and resources.
🌐
Javaspring
javaspring.net › blog › java-print-classpath
Java Print Classpath: A Comprehensive Guide | JavaSpring.net
July 8, 2025 - User Classpath: This can be set for a specific Java application. It can be set using the -cp or -classpath option when running a Java program from the command - line. The simplest way to print the classpath in Java is by accessing the java.class.path system property.
🌐
JetBrains
intellij-support.jetbrains.com › hc › en-us › community › posts › 206757845-Intellij14-How-to-get-the-classpath-of-the-current-project-
Intellij14: How to get the classpath of the current project? – IDEs Support (IntelliJ Platform) | JetBrains
April 22, 2015 - Searching the forum, this question was already asked many years ago: https://devnet.jetbrains.com/message/502975#502975 Project project = (Project) event.getDataContext().getData(DataConstants.PROJECT); ProjectRootManager projectManager = ProjectRootManager.getInstance(project); projectManager.getFullClassPath(); However, it looks like it relies on API that does not exist anymore. By what was getFullClassPath() replaced in IntelliJ 14? Andrea ... "The classpath of the project" is not a very meaningful thing in IntelliJ IDEA because each module has its own independent classpath.
Top answer
1 of 9
340

In Intellij 13, it looks it's slightly different again. Here are the instructions for Intellij 13:

  1. click on the Project view or unhide it by clicking on the "1: Project" button on the left border of the window or by pressing Alt + 1
  2. find your project or sub-module and click on it to highlight it, then press F4, or right click and choose "Open Module Settings" (on IntelliJ 14 it became F12)
  3. click on the dependencies tab
  4. Click the "+" button on the right and select "Jars or directories..."
  5. Find your path and click OK
  6. In the dialog with "Choose Categories of Selected File", choose Classes (even if it's properties), press OK and OK again
  7. You can now run your application and it will have the selected path in the class path
2 of 9
101

It appears that IntelliJ 11 has changed the method, and the checked answer no longer works for me. In case anyone else arrives here via a search engine, here's how I solved it in IntelliJ 11:

  1. Go to the Project Structure, click on Modules, and click on your Module
  2. Choose the "Dependencies" tab
  3. Click the "+" button on the right-hand side and select "Jars or directories..."
  4. Add the directory(ies) you want (note you can multi-select) and click OK
  5. In the dialog that comes up, select "classes" and NOT "jar directory"
  6. Make sure you're using that Module in your run target

Note that step 5 seems to be the key difference. If you select "jar directory" it will look exactly the same in the IDE but won't include the path at runtime. There appears to be no way to determine whether you've previously selected "classes" or "jar directory" after the fact.

🌐
Medium
medium.com › javarevisited › back-to-the-basics-of-java-part-1-classpath-47cf3f834ff
Tutorial on how Java classpath works | Javarevisited
May 15, 2022 - However, it is required by the java command to run. Let’s compile this little project. First we create a bin folder to hold the compiled stuff in the root project folder then compile the two files [2]. > mkdir bin > javac src/java/myprogram/Main.java src/java/myprogram/utils/Util.java -d bin/ You should now have the following file structure. ClasspathProject/ | ---> src/java/myprogram/ | ---> Main.java | ---> utils/ | ---> Util.java | ---> bin/myprogram/ | ---> Main.class | ---> utils/ | ---> Util.class
🌐
Princeton CS
introcs.cs.princeton.edu › java › 15inout › classpath.html
Setting the Classpath in Java
If the CLASSPATH variable does not exist, select New. Type CLASSPATH for the variable name and .;C:\introcs for the variable value. Click OK three times. ... Use your favorite text editor (e.g., TextEdit) to add the following line to the file /Users/username/.bashrc.
🌐
Gradle
discuss.gradle.org › help/discuss
How can I print a parseable run time classpath? - Help/Discuss - Gradle Forums
March 10, 2021 - I managed to build a Java Gradle project, and I’m now trying to run it from the command line. For that, I’d need gradle to print the the runtime dependencies. If I do: gradle dependencies --configuration runtimeClasspath This prints out a decorated tree of dependencies, which is rather ...
🌐
thilina's blog
thilinamb.wordpress.com › 2009 › 07 › 01 › analyse-the-classpath-of-a-running-java-program
Analyse the classpath of a running Java program | thilina's blog
July 1, 2009 - Sometimes we come across scenarios where it is required to analyze the classpath of a running java program to make sure that the correct libraries are picked up. In my scenario, I wanted to check whether an endorsed jar has been picked instead of the jar that comes with the JDK. Few of the possible ways of doing this is, Use the ‘-verbose:class’ argument with the ‘java’ command when starting the program. Use ‘System.getProperty(“java.class.path”);’ inside the program to print the classpath.
🌐
GeeksforGeeks
geeksforgeeks.org › java › different-ways-to-set-a-classpath-in-java
Different Ways to Set a Classpath in Java - GeeksforGeeks
July 23, 2025 - Enter Variable name :classpath [Don't give space between class path] Variable value:<directory_location>(for example in my F:\workspace\bin) Click OK->OK->OK. Close all windows, open a new command prompt, and run the java command