How to use a .class file with .java files

I am pretty green for java (I program in C / C ++) and I still haven't figured out how it all works.

I am not trying to ask someone to do their homework, I am just confused by some basic java materials. I have a task that wants me to create a maze. The destination comes with some files that were previously implemented and theoretically work. The folder gives me some .java files and some .class files. I opened the .java files, and most of them are interfaces without real code, so I assume this is meat in these .class files. My question is: how do I interact with these .class files? I need to do something like import myClass; if i have myClass.class file?

I tried to import the file directory in which these files are contained (via Eclipse), but it seems that the .class files are not showing. I assume it is being processed in the background?

Here is a link to the task http://www.ics.uci.edu/~goodrich/teach/ics23/LabManual/Dark/

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

Thanks in advance!

+5
source share
7 answers

To add .class files to your project in Eclipse: right-click your project, select properties β†’ Java Build Path β†’ Libraries, and click Add Folder Class. Select the class folder.

+4
source

, . , , .

:

myClass mc = new myClass();

(new myClass()).myRoutine();

-

myClass.staticalicious();

, .

, .class .java.

, , , Java:) MyClass, myClass.

+4

.class - .java. , .class , :

: some.package.class

: import some.package;

, , , .

+1

, - Java, " ", . .

, .

, :

. Linux/Unix:

javac -classpath <dirWithClassFiles>:. .....

:

java -classpath <dirWithClassFiles>:. .....

.

+1

- java-. java- .o C ++, "" , , .

java , import some.package.name.*;, (, SomeClass some.package.name.SomeClass)

0

, IDE. IDE , ...

import example.some.Thing;

.java , .class. , .

0

Eclipse IDE .class. . perticular , .

0
source

All Articles