After searching various methods on the Internet, I plan to install the JDK in the virtual machine by sharing files between the host machine (Win) and the virtual machine (Linux).
Let's do it.
First, set up a shared folder
First, set the D:\baidu\shareFolder directory as a shared folder, and the method will not be repeated.
Then set the shared folder on the virtual machine:
![](http://dl2.iteye.com/upload/attachment/0124/0788/eeebe22d-9059-3994-ab9b-82ee4d87be16.png)
2. Mount the shared file and
execute: sudo mount -t vboxsf shareFolder /home/fuhy/winshare
but the execution fails, showing: -unknown filesystem type vboxsf
After searching, refer to https://segmentfault .com/a/1190000004362463
found that the host (win) and virtual machine (Linux) need to install Guest Additions, so click "Device - Install Enhancements...":
![](http://dl2.iteye.com/upload/attachment/0124/0791/31a0578e-a217-3c4d-bc08-5170fd148ca1.png)
But the installation reported an error:
![](http://dl2.iteye.com/upload/attachment/0124/0793/fc154c2e-990e-3adb-87a1-c037a86db99d.png)
Need to mount VboxGuestAdditions.iso, so Execute: sudo mount /dev/cdrom /home/fuhy/winshare
![](http://dl2.iteye.com/upload/attachment/0124/0797/a69bc774-97b6-3ecf-b49e-da4b20f8f5a2.png)
to check, it can be seen that it is mounted:
![](http://dl2.iteye.com/upload/attachment/0124/0799/1dbe81a7-f02b-37f5-ae52-6e2147628b3c.png)
execute it: sudo sh ./VboxLinuxAdditions.run
![](http://dl2.iteye.com/upload/attachment/0124/0803/449a3644-b9e3-352d-aa8a-6d0a37b262ca.png)
The last sentence: Failed to set up service vboxadd, please check the log file, explain Execution failed.
Check the log:
![](http://dl2.iteye.com/upload/attachment/0124/0805/f06fc24e-6f13-34f9-b5f2-020514663ea4.png)
There is this sentence: Please check that you have gcc, make, the header files for your Linux kernel and possibly perl installed..
It can be seen that gcc, make and other software may not be installed, try it:
![](http://dl2.iteye.com/upload/attachment/0124/0809/dc8a47d6-c8c9-3eff-bc14-7618e7597ebe.png)
then install gcc and execute sudo apt -get install build-essential
![](http://dl2.iteye.com/upload/attachment/0124/0811/d3643996-2376-3950-a4f1-3794989fecea.png)
wait for a while, after the installation is complete, execute: gcc --version
![](http://dl2.iteye.com/upload/attachment/0124/0813/43e564c0-7d3d-3999-8e47-102f6538d66e.png)
to see that the installation is successful, re-execute: sudo sh ./VboxLinuxAdditions.run
![](http://dl2.iteye.com/upload/attachment/0124/0815/2cb41c12-ddba-3556-a2d7-5df7bf375638.png)
The last sentence: Could not find the X.Org or Xfree86 Windows System, skipping. It doesn't matter, this has no effect.
Continue to execute: sudo mount -t vboxsf shareFolder /home/fuhy/winshare to
![](http://dl2.iteye.com/upload/attachment/0124/0817/23121fde-8bed-3354-ab37-ce3be96ca91a.png)
see that the mount is successful.