I have a compiled binary specifically sun Oracle java that I am using instead of Ubuntu`s apt-get version of java ( what ever it may be ).

I am installing an apt-get package ( maven ) and would like apt-get to use the version of java I have manually installed

I can not install any more packages or tools on the system. I have what ever Ubuntu LTS 12.04 comes with.

  • Are you asking how to specify which java for maven to use? Have you set JAVA_HOME? – rickhg12hs Oct 15 '13 at 13:07
  • Apt-get doesn't use Java. Did you mean you want Maven to use a different installation of Java? Do you want to use it only for Maven or for everything? – Gilles 'SO- stop being evil' Oct 15 '13 at 19:07
  • I am using apt-get to intsall maven. I would like apt-get to not install java as part of maven`s dependencies or alternatively add my binary to apt-get – MageProspero Oct 16 '13 at 8:08
  • 1
    You have said what you want to do, but you haven't said why. If any sun java package will do, you can build (if not already available) a sun java binary (deb) package for Ubuntu. If maven depends on a different version of java, you could also build a custom maven deb which depends on sun java. This of course assumes maven will work with sun java. I have no idea if that is the case. – Faheem Mitha Jun 2 '14 at 15:01

Sorry, but is not possible. Maven has dependencies of Java and these can't be ignored:

apt-cache depends maven
 |Depends: default-jre
 |Depends: default-jre-headless

So, whenever you try to install maven, java will get installed. The only way to get around this is packaging your own version of Java and install it in your system, otherwise I don't see any other safe way you can do this.


You can run apt-get install maven with the --nodeps flag, but make sure you have all other dependencies of maven installed.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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