java调用class文件,如何将.class文件与.java文件一起使用

博主在尝试理解Java项目中如何与预编译的.class文件交互。他们已经有一些.java接口文件,但主要逻辑似乎在.class文件中。通过Eclipse,他们试图将.class文件导入项目,但遇到了类不显示的问题。解决方案是通过右击项目,选择属性,然后在Java构建路径中添加类文件夹来解决。
摘要由CSDN通过智能技术生成

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

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?

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?

Thanks in advance!

解决方案

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.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值