# Cannot find java after successful openjdk 7 installation



## Psilotop (Nov 16, 2013)

I just installed openjdk7 by executing `make install clean` in /usr/ports/java/openjdk7 with no errors. However, when I try to execute a Java command I get a response saying 
	
	



```
java: Command not found.
```
 My first thought was that Java was installed to a location outside of my PATH, but I've searched all likely directories and I can't find it at all. I'm totally stumped now - I can't find the Java file but I didn't get any installation errors. Any suggestions?


----------



## jrm@ (Nov 16, 2013)

You can verify it was installed and check out all installed files with `pkg info -f openjdk7` (info your are using the new package tools) or `pkg_info -f openjdk7` (with the old package tools).  Perhaps you are using a shell that needs to rehash?


----------



## fonz (Nov 16, 2013)

Psilotop said:
			
		

> ```
> java: Command not found.
> ```


Did you rehash your shell? `% rehash` when using tcsh or `$ hash -r` when using (ba)sh.

java/openjdk7 installs java into /usr/local/bin. If it's not there, see if it's anywhere else (`$ find / -name java 2>/dev/null` in a (ba)sh shell). If not, it probably didn't install properly.


----------



## Psilotop (Nov 16, 2013)

I did `rehash`, (I'm using tcsh) but it didn't help. Using `pkg_info -f openjdk7` it looks like openjdk7 is not installed. Should I just rerun `make install clean`? I'm sorry if this is elementary, I'm new to Unix in general. It's just a single command so I don't know what mistakes I could have made installing the port.


----------



## fonz (Nov 16, 2013)

Hmm, I just built java/openjdk7 myself without any problems. You did update your ports tree (`# portsnap fetch update`) before starting the build, right?

If there's no /var/db/pkg/openjdk-7-_something_ directory on your system, the port wasn't installed properly. Trying again shouldn't hurt.


----------



## Psilotop (Nov 16, 2013)

Yep, I ran `portsnap fetch extract` and `portsnap fetch update` this morning, before the install. I'm trying the installation again now.

That package is not in that directory, so it definitely didn't install properly. That's a really handy directory to know about, thank you.


----------



## Psilotop (Nov 17, 2013)

I don't think I read carefully enough the first time around because I got an error when trying to install openjdk7 the second time around


```
===>  Installing for pkgconf-0.9.3                                              
===>  Checking if devel/pkgconf already installed                               
pkg_add: package 'pkgconf-0.9.3' conflicts with pkg-config-0.25_1               
pkg_add: please use pkg_delete first to remove conflicting package(s) or -f to f
orce installation                                                               
*** Error code 1                                                                
                                                                                
Stop in /usr/ports/devel/pkgconf.                                               
*** Error code 1                                                                
                                                                                
Stop in /usr/ports/x11-fonts/fontconfig.                                        
*** Error code 1                                                                
                                                                                
Stop in /usr/ports/x11-fonts/dejavu.                                            
*** Error code 1                                                                
                                                                                
Stop in /usr/ports/x11-fonts/dejavu.                                            
*** Error code 1                                                                
                                                                                
Stop in /usr/ports/java/openjdk7.                                               
*** Error code 1                                                                
                                                                                
Stop in /usr/ports/java/openjdk7.
```

I guess the problem is this line: 
	
	



```
pkg_add: package 'pkgconf-0.9.3' conflicts with pkg-config-0.25_1               
pkg_add: please use pkg_delete first to remove conflicting package(s) or -f to f
```
 I don't understand the conflict, though. How do two differently named packages conflict?


----------



## fonz (Nov 17, 2013)

Psilotop said:
			
		

> I don't understand the conflict, though. How do two differently named packages conflict?




```
[CMD=%]cat /jails/pointyhat/usr/ports/devel/pkgconf/pkg-descr[/CMD]
pkgconf is a program which helps to configure compiler and linker flags for
development frameworks. [highlight]It is similar to pkg-config, but was written from
scratch in Summer of 2011 to replace pkg-config[/highlight], which now needs itself to build
itself.
```
devel/pkg-config was deleted from the ports tree over a year ago. If you still have it around, it's probably easiest to first install ports-mgmt/portmaster, then do `# portmaster -o devel/pkgconf devel/pkg-config` and then try again with OpenJDK.


----------



## Psilotop (Nov 17, 2013)

Ah, thanks for the thorough answer. That is incredibly helpful. I'll give that a try and see what happens.


----------



## Psilotop (Nov 18, 2013)

After `make install clean` for portmaster, the portmaster commands are not found so I can't run that second line. 

I'm running all of this on a FreeBSD jail in FreeNAS. I haven't updated either FreeNAS or the jail in about a year (if it's not broken...) and I'm guessing that's the reason that I'm having these conflicts. I just tried with a fresh install of the jail and everything is the same. A freshly installed OS shouldn't have trouble installing a port written for it, so I'm going to try and save myself some frustration and update both FreeNAS and the accompanying FreeBSD jail. At least this was a learning experience...


----------



## ondra_knezour (Nov 18, 2013)

Psilotop said:
			
		

> After `make install clean` for portmaster, the portmaster commands are not found so I can't run that second line.



You have to `rehash` after installation or logoff and login again.


----------



## onaicuL (Jul 25, 2017)

Your pkgconf is old.

For others reading this, I'm not sure if it's necessary but I ran:

```
portsnap fetch
portsnap extract
```
before this.

Go to `devel/pkgconf`, `make deinstall`, `make reinstall`. Go to `java/openjdk8` and attempt to install again with `make -DBATCH install clean`


----------



## ShelLuser (Jul 25, 2017)

onaicuL said:


> Your pkgconf is old.


Please check the date of a thread before responding. This thread is almost 4 years old, as can be seen from the date of the last post. The issues which were a thing have long been resolved now.

Also: `portsnap extract` is only needed when you install the Ports collection for the first time. When you have a ports collection you can simply use `# portsnap fetch update` to keep it up to date. See the portsnap(8) manualpage for more info on that.


----------



## sham1810 (Jul 11, 2019)

Hi,

I installed openjdk12 from ports. I can see it is installed in /usr/local/openjdk12/bin/. Should I just add this to the PATH in order to run java from the command line? Or is there a better way like creating a symlink? If i decide to install Oracle JDK, how can i switch easily between the two?


----------



## SirDice (Jul 11, 2019)

Install java/javavmwrapper.


----------



## ucomp (Jul 11, 2019)

sham1810 said:


> ... if i decide to install Oracle JDK ...


you won`t



SirDice said:


> Install java/javavmwrapper.


... nothing will happen with that ...



sham1810 said:


> Should I just add this to the PATH in order to run java from the command line?



yes (permanently) : 


```
sham1810@freebsd:~# yourEditor /etc/csh.cshrc

# $FreeBSD: releng/12.0/bin/csh/csh.cshrc 337849 2018-08-15 14:41:24Z brd $
#
# System-wide .cshrc file for csh(1).
setenv JAVA_VERSION "12.0+"
setenv JAVA_HOME /usr/local/openjdk12
--
sham1810@freebsd:~# source /etc/csh.cshrc
--

sham1810@freebsd:~# java -version
java -version
openjdk version "12" 2019-04-16
OpenJDK Runtime Environment (build 12+12-2)
OpenJDK 64-Bit Server VM (build 12+12-2, mixed mode)
```


----------



## SirDice (Jul 11, 2019)

ucomp said:


> ... nothing will happen with that ...


Why not?


```
The Java VM wrapper provides a convenient system for switching between
different Java VMs.  It also provides symbolic links in ${PREFIX}/bin to
allow the use of the Java executables without having to add the specific
Java VM executable directories to the PATH environment variable.
```


----------



## ucomp (Jul 11, 2019)

SirDice said:


> Why not?


Hi Sir,
...
maintainer timeout ...
& something like this :





						237054 – java/openjdk11: Needs to be integrated into bsd.java.mk
					






					bugs.freebsd.org
				




to be honest , I never really used javavmwrapper to switch VMs because I prefer to control all java by myself in the shell & elsewhere, but that are long story details far away from the initial question.


----------



## SirDice (Jul 11, 2019)

At quick glance that PR looks to be more for the ports infrastructure itself and is to allow building of Java ports using the various different Java engines.


----------



## ucomp (Jul 11, 2019)

SirDice said:


> At quick glance that PR looks to be more for the ports infrastructure itself and is to allow building of Java ports using the various different Java engines.


yes, true... openjdk11/12 is under daily "fine-grain" development and I presume no one asks for the vmwrapper. I personally don't know for what I should need that vmwrapper. But if you're interested in you could   try it out(explain or even perhaps fix some things) and compare it to the relatively simple control "by hand" (             #16           )

I would be interested in what you`ll find out


----------



## ucomp (Jul 11, 2019)

to add:
SirDice , since maintainer timeout, why not you? ;-)


----------



## SirDice (Jul 11, 2019)

I don't have enough Java experience for it, so I won't be able to fix or test certain issues. You seem a lot more qualified for it actually 

I am actually looking at emulators/mame to maintain, but that's entirely unrelated to this.


----------



## ucomp (Jul 11, 2019)

*--- /*off topic: --*


SirDice said:


> I am actually looking at emulators/mame to maintain, but that's entirely unrelated to this.



great ! I personally only play Defender on my Apple II  ....
Apple II seems to be supported by your port ? (which I didn't know exists):


			https://www.mamedev.org/releases/whatsnew_0209.txt
		

-apple2: Attach a SCSI CD-ROM to the Apple II SCSI Card by default. [R. Belmont]
-apple2: Documented FocusDrive/ZIPDrive partition information format, and fixed it so it works. [R. Belmont]
...for coincidence I've got a real physical SCSI-ZipDrive on my AppleII ...
*--- */------*


SirDice said:


> ... qualified for it actually ....



I have to go to the dentist in  1/2 hour , could you  start working on it in the meantime ?   ..


----------



## SirDice (Jul 11, 2019)

ucomp said:


> Apple II seems to be supported by your port ? (which I didn't know exists):


Yes, I've been able to run it and try a few things. I also managed to build a Apple ][gs with a working mousedesk by adding a SCSI card and an empty CHD image as its disk. That was fun (I own an actual working Apple ][gs  ) . I'm mostly using the 'traditional' MAME arcade emulations running original arcade games. I have a severe case of retro gaming fever.

MAME seems to have changed its release schedule some time ago and are now pushing out a new version at the end of each month. The update to 0.210 was simple, I wanted to take the opportunity and remove the Python 2.7 build dependency. But I'm getting a few weird build issues with Python 3.6 which I haven't been able to trace yet. I might do a quick fix for 0.211 now and push the other improvements a few versions forward.


----------



## ucomp (Jul 11, 2019)

SirDice said:


> Yes, I've been able to run it and try a few things. I also managed to build a Apple ][gs with a working mousedesk by adding a SCSI card and an empty CHD image as its disk. That was fun (I own an actual working Apple ][gs  ) . I'm mostly using the 'traditional' MAME arcade emulations running original arcade games. I have a severe case of retro gaming fever.
> 
> MAME seems to have changed its release schedule some time ago and are now pushing out a new version at the end of each month. The update to 0.210 was simple, I wanted to take the opportunity and remove the Python 2.7 build dependency. But I'm getting a few weird build issues with Python 3.6 which I haven't been able to trace yet. I might do a quick fix for 0.211 now and push the other improvements a few versions forward.


great stuff you do while I have to go to the dentist now ;-)
I will take a closer look at your port at the next opportunity and am very curious

I put the java vm-switch thing to the HowtO department here :  
          #1


----------

