1

This is an extremely basic question, but I haven't been able to find the answer anywhere. I'm completely new to Java.

There's a Java program on github that I'm trying to get running on my Mac. The associated documentation does not give any information on compiling or running the code. I would prefer not disclosing in any more detail the specific program I'm trying to run.

The program contains multiple .java files and a classmexer.jar file for tracking memory usage. There is also a subfolder, cern, that contains additional subfolders that ultimately contain .class files. There is no makefile.

I've downloaded all of the source code as a tar.gz file and unwrapped it into ~/codeDirectory/. When I try to compile from this directory with

$ javac *.java

or

$ javac A.java

(where A.java is the first class that program calls), I get dozens of compile errors. This code clearly compiles successfully elsewhere, so I'm unsure what to make of this.

The first error that appears is

A.java:5: cannot access cern.colt.function.DoubleFunction
class file for cern.colt.function.DoubleFunction not found
    cern.jet.random.AbstractDistribution.makeDefaultGenerator();
                                        ^
./B.java:4: package com.javamex.classmexer does not exist
import com.javamex.classmexer.*;
^
./B.java:180: cannot find symbol
symbol  : variable MemoryUtil
location: class B
        long noBytes = MemoryUtil.deepMemoryUsageOf(hp);
                       ^

My suspicion is that there's an improperly or incorrectly specific path somewhere, but I haven't been able to find it.

Thanks in advance for any help troubleshooting.

1
  • 1
    You might need to add dependencies, such as the colt libraries, if they weren't included. If there is a POM file, it can maybe do this automatically when you use maven. Commented Jan 18, 2012 at 21:36

2 Answers 2

5

If you downloaded a Java program from github, it's nearly certain that it comes with a build.xml for use with Apache Ant, or a pom.xml for use with Apache Maven, or some other file for use with some other build tool. Typically, a code base on github will have documentation telling you what tool to use and how to use it.

Sign up to request clarification or add additional context in comments.

3 Comments

There is no *.xml file or any information in the readme about compilation. It's just these .java files and the one jar.
I would have grave doubts of the quality of any code left lying about on github in that state. So you've going to have to learn to use ant or maven (or Eclipse or IntelliJ) for yourself.
This is the developer's first commit, so it sounds like I should contact him about it. I will look into the programs you mentioned. Thank you. (Will accept your answer when I get a bit more info from the developer.)
0

The program I was attempting to run was incomplete and did not include the source code for two dependencies (including colt, which the compiler flagged above). Thanks to Anony-Mousse for suggesting this option. Installing all the necessary source code solved the problem; the developer has also updated the files.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.