0

I have seen similar questions on SO and I'm just not getting it. I have a bunch of Java classes I need to import as a library. How do I make the jar file, save it in the right place, then tell Eclipse to import the jar file?

The classes I want in my library are here: StdIn library code

and this is the java code I want to import the library into: Sattolo algorithm code

There is a further library I would need to import to make the Sattolo algorithm run, but once I get the general idea...

I am a very, very new Java coder, so please be patient with me not understanding what must seem very basic.

Davtho1983
  • 3,827
  • 8
  • 54
  • 105
  • Note that you must eventually understand how jar files work, because they are integral in solving classpath problems which is by far the hardest problems for newcomers without help. – Thorbjørn Ravn Andersen Oct 08 '17 at 12:26

1 Answers1

1

Step 1: create a jar from you classes, if your using eclipse then simply https://www.cs.utexas.edu/~scottm/cs307/handouts/Eclipse%20Help/jarInEclipse.htm

Step 2: add the jar dependency to your eclipse project How to import a jar in Eclipse

Shai
  • 26
  • 1
  • Any idea how to include the txt file at http://algs4.cs.princeton.edu/11model/cards.txt so it runs? – Davtho1983 Oct 08 '17 at 13:33
  • I'm not sure what you "so it runs" txt files do not "run" they are just data. You can add txt files to the resource folder and they will be bundled with your final jar. – Shai Oct 15 '17 at 08:35