Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I am running Ubuntu 12.10 with Oracle Java 7 installed (as described here). I want to install JUnit 4 but if I do a simple sudo apt-get install junit, it starts to download openjdk and the like (which I don't want). How to manually do it? And from where do I download and install.

Please help!

share|improve this question
    
I guess that happens because Oracle Java is not present on the repositories, so it tries to install one available. JUnit is basically a .jar, so you can add it to your projects. See this. –  Salem Apr 2 '13 at 18:34
    
So I have to download junit.jar and hamcrest-core.jar and put them in /usr/share/java? –  pratnala Apr 3 '13 at 4:44
    
^ That didn't work –  pratnala Apr 3 '13 at 9:58
    
Umm what? My problem isn't solved. I said didn't –  pratnala Apr 3 '13 at 15:47
    
Sorry :) What I was saying before is that if you are using an IDE like Eclipse or Netbeans you can add that jar to each project you need. –  Salem Apr 3 '13 at 15:57

1 Answer 1

up vote 2 down vote accepted

As Oracle JDK is not availabe in the default repositories, it is not listed in the dependencies or jUnit. So to "install" it you have to download the .jar's and place them where Oracle JRE could find them.

Supposing you installed JRE on /usr/local/java the correct place should be /usr/local/java/jdk<version>/jre/lib. So a command like this should suffice:

sudo cp /path/to/junit_jars/*.jar /usr/local/java/jdk<version>/jre/lib

And for Junit you have to just include the jar into your program classpath. You can download the jar from here.

share|improve this answer
    
Marked solved because I learnt how to install Junit –  pratnala Apr 5 '13 at 7:47

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.