PDA

View Full Version : Sticking a JAVA class in a library




Eraserhead
Jan 19, 2006, 02:10 PM
Hey, I'm not sure if I'm asking the right question, but basically I have some java class files (from my University - specifically one called MaInput.class) I would like to be able to access this class file (and possibly some others) from any java .class file I run on my Mac, is this possible? It seems to be on the UNIX machines...



cubist
Jan 19, 2006, 02:38 PM
They will run fine, just ftp them over. Open a terminal window and execute them with the java command, e.g. java foo

therevolution
Jan 19, 2006, 02:44 PM
Add the files to your classpath. More info here (http://java.sun.com/j2se/1.4.2/docs/tooldocs/solaris/classpath.html).

Eraserhead
Jan 19, 2006, 02:50 PM
They will run fine, just ftp them over. Open a terminal window and execute them with the java command, e.g. java foo
Thanks, thats probably the easiest thing to do...

plinden
Jan 19, 2006, 02:51 PM
jar them first:
jar cfv yourclasses.jar <list of class files or directory>

before ftping them over. Then you'll just need to reference the jar file in your classpath.