3

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!

10
  • 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, 2013 at 18:34
  • So I have to download junit.jar and hamcrest-core.jar and put them in /usr/share/java?
    – pratnala
    Apr 3, 2013 at 4:44
  • ^ That didn't work
    – pratnala
    Apr 3, 2013 at 9:58
  • Umm what? My problem isn't solved. I said didn't
    – pratnala
    Apr 3, 2013 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, 2013 at 15:57

1 Answer 1

2

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.

1
  • Marked solved because I learnt how to install Junit
    – pratnala
    Apr 5, 2013 at 7:47

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .