如何在命令行中运行java项目 [英] How to run a java project in command line

查看:392
本文介绍了如何在命令行中运行java项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个java项目,在eclipse上运行正常。现在,我需要使用命令行运行它,如java classpath ...如何根据在Eclipse中使用的存储的路径设置此类路径。

解决方案

只需导航到类文件所在的目录,然后使用



java -classpath。 myClass



编辑:您可以用任何类路径替换。例如,要找到您的类路径,您可以使用 echo%CLASSPATH%



编辑:看起来有很多可能有助于您此处的信息。


I have a java project, which runs fine on eclipse. Right now, I need to run it using command line, like java classpath ... How to setup this classpath based on the stored ones using in Eclipse.

解决方案

Simply navigate to the directory that the class file exists in and use

java -classpath . myClass

Edit: You can replace the . with any classpath. For example, to find your classpath you can use echo %CLASSPATH%

Edit: Looks like there's quite a bit of information that might help you here.

这篇关于如何在命令行中运行java项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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