Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to solve the classpath problem of Java

2025-01-22 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article mainly explains "how to solve the classpath problem of Java". The content of the explanation is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "how to solve the classpath problem of Java".

When running Java programs, it is often necessary to specify a directory containing various jar packages as the classpath. We used to use-Djava.ext.dirs=... To specify the jar directory.

But in the new version of JDK, which seems to start with JDK 9, you will be prompted when you still use this parameter:

C:\ Users\ Winter Lau > java-Djava.ext.dirs=lib-Djava.ext.dirs=lib is not supported. Use-classpath instead.Error: Could not create the Java Virtual Machine.Error: A fatal exception has occurred. Program will exit.

Well, it's easy for you to replace it with-classpath or-cp.

And then I'll try.

Java-cp lib xxx.xxxxjava-cp lib\ * .jar xxx.xxx

Although the result is correct, the classpath setting does not work.

After thinking about it for a long time, I can't believe I want to play like this:

Java-cp lib\ * xxx.xxxx

Note that it's lib\ * instead of lib\ *. Jar is not lib. Linux can be replaced with a forward slash.

Thank you for your reading, the above is the content of "how to solve the classpath problem of Java". After the study of this article, I believe you have a deeper understanding of how to solve the classpath problem of Java. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report