我已将所有jar文件存储到特定的文件夹中.如何配置特定文件夹到Jshell类路径? [英] I have stored all the jar file into specific folder. How to configure specific folder to Jshell classpath ?

查看:72
本文介绍了我已将所有jar文件存储到特定的文件夹中.如何配置特定文件夹到Jshell类路径?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已将所有jar文件存储到特定文件夹中,并且已将特定文件夹添加到Jshell类路径中.添加类路径后,我无法在jshell中导入软件包.

I have stored all the jar file into specific folder and I have added specific folder to Jshell classpath. I am unable to import packages in jshell after adding classpath.

如果我在类路径中提到了所有的jar文件名,那就很好.我不想在类路径中提到所有的Jar文件名,因为我必须在类路径中添加上千个jar文件.

It is working fine If I have mentioned all the jar file name in classpath. I don't want to mentioned all the Jar file name in classpath because I have to add more than thousand number of jar files into classpath.

如何为Jshell classpath配置特定文件夹?

How to configure specific folder to Jshell classpath ?

推荐答案

在jshell中声明类路径的路径.

Declare the path of classpath in jshell.

jshell> /env -class-path path_of_dependecies

如果classpath是当前工作文件夹

If classpath is current working folder

jshell> /env -class-path .

当您从依赖项调用特定类或调用静态方法时,必须使用命令import

When you call specific class or call static method from dependencies, you must use command import

jshell> import com.foo_company.*

请参阅权威教程 http://cr .openjdk.java.net/〜rfield/tutorial/JShellTutorial.html#setting-a-classpath

这篇关于我已将所有jar文件存储到特定的文件夹中.如何配置特定文件夹到Jshell类路径?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆