如何为Javac设置环境变量以能够找到导入的包? [英] How to set environment variables for javac to be able to find imported packages?

查看:189
本文介绍了如何为Javac设置环境变量以能够找到导入的包?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不是Java开发人员.我只想运行一个Java应用程序(可以从以下网站下载: http://code.google.com/p/k-shortest-路径/下载/列表 ,名称为:KShortestPaths_Java_v2.1.zip)

I am not a java developer. I just want to run a java application (which can be downloaded from: http://code.google.com/p/k-shortest-paths/downloads/list , under this name: KShortestPaths_Java_v2.1.zip)

在尝试编译test \ edu \ asu \ emit \ qyan \ test \ YenTopKShortestPathsAlgTest.java时 我知道与路径设置有关的包...不存在"和符号...不存在".您能告诉我如何设置环境变量以及如何从哪个目录编译并运行该Java文件吗? (我的操作系统是Windows XP,并且已将应用程序保存在C:\ KSh中)

While trying to compile test\edu\asu\emit\qyan\test\YenTopKShortestPathsAlgTest.java I get "package ... does not exist" and "symbol ... does not exist" which I know are related to path setting. Can you please tell me how I should set environment variables and from which directory compile and run that java file? (My operating system is Windows XP and I have saved the application in C:\KSh)

我解决了编译问题.现在,我有一个CLASS文件:YenTopKShortestPathsAlgTest.但是,当我尝试使用Java运行它时,出现以下错误:找不到主类...程序将存在" 我猜这又与其他jar文件所在的路径有关.您能给我一个提示吗?

I resolved the problem with compiling. Now, I have a CLASS file: YenTopKShortestPathsAlgTest. However, when I try to run it with java, I get this error: "could not find the main class... program will exist" which I guess is again related to the paths other jar files are located. Could you please kindly give me a hint?

推荐答案

该zip文件包含.classpath.project文件.这些文件由Eclipse Java IDE使用.

The zip file contains a .classpath and a .project file. These files are used by the eclipse java IDE.

也许最简单的方法是

Perhaps the most easy way would be to download eclipse and import the project there.

如果您想手动操作,请尝试

If you want to do it by hand, try

javac -sourcepath src;test test\edu\asu\emit\qyan\test\YenTopKShortestPathsAlgTest.java

从目录C:\KSh.

下载 junit. jar 并使用

javac -classpath junit.jar -sourcepath....

这篇关于如何为Javac设置环境变量以能够找到导入的包?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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