如何将.class文件与.java文件一起使用 [英] how to use a .class file with .java files

查看:219
本文介绍了如何将.class文件与.java文件一起使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对java非常环保(我用C / C ++编程),但我还是没有弄清楚这一切是如何协同工作的。

I'm quite green to java (I program in C/C++) and I still haven't figured out how this all works together.

我不是要求任何人做我的作业,我只是对一些基本的java东西感到困惑。我有一项任务,希望我创建一个迷宫。该作业附带了一些预先实现并且理论上有效的文件。该文件夹为我提供了一些.java文件和一些.class文件。我打开了.java文件,其中大部分是没有实际代码的接口,所以我假设它的内容是在这些.class文件中。我的问题是,我如何与这些.class文件接口?我需要做一些像导入myClass的东西;如果我有一个名为myClass.class的文件?

I'm not trying to ask for anyone to do my homework, I'm just confused about some basic java stuff. I have an assignment which wants me to create a maze. The assignment comes with some files which have been pre-implemented and theoretically works. The folder gives me some .java files and some .class files. I opened the .java files and most of them are interfaces with no real code, so I'm assuming the meat of it are in these .class files. My question is, how do I interface with these .class files? do I need to do something like import myClass; if I have a file called myClass.class?

我已经尝试导入这些文件所包含的文件目录(通过Eclipse),但似乎没有显示.class文件。我猜它正在后台处理?

I've tried importing the file directory which these files are contained in (through Eclipse), but it seems the .class files don't show up. I'm guessing it's being processed in the background?

这是指向作业的链接
http://www.ics.uci.edu/~goodrich/teach/ics23/LabManual/Dark/

这是包含所有.java和.class文件的zip文件
http://www.ics.uci.edu/~goodrich/teach/ics23/LabManual/Dark/Dark.zip

Here's the zip file with all the .java and .class files http://www.ics.uci.edu/~goodrich/teach/ics23/LabManual/Dark/Dark.zip

提前致谢!

推荐答案

在Eclipse中将.class文件添加到项目中:右键单击项目,选择属性 - > Java Build Path - > Libraries并单击Add Class Folder按钮。选择包含类的文件夹。

To add .class files to your project in Eclipse: right-click your project, select properties --> Java Build Path --> Libraries and click on Add Class Folder button. Select the folder with the classes.

这篇关于如何将.class文件与.java文件一起使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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