Configuration
To configure the network, ensure that you create a virtual adapter on host system (via “Preferences” → “Network” menu in main VirtualBox window; make sure DHCP is enabled for this adapter) and that network connection type for virtual machine is set to “Host-only network” (via “Settings” → “Network” menu for selected virtual machine).
You will also need means to transfer files to virtual machine. VirtualBox shared directories approach is suggested and machine is configured to use shared directory called “Public” (check that you use an existing directory on your host machine, e.g. “C:\My files”, via “Settings” → “Shared Folders” menu for selected virtual machine).
Usage
Launch your virtual machine: login and password are simply “user”. Check network configuration with “ifconfig”.
Check if you can access shared directory with “ls /media/sf_Public/” .
When you need to turn the machine off, use “sudo shutdown -h now” command.
Network configuration issues
If all DHCP settings for your host-only network adapter have zero values by default, try the following settings:
- Server address: 192.168.56.100
- Server mask: 255.255.255.0
- Lower address bound: 192.168.56.101
- Upper address bound: 192.168.56.254
Internet access
With provided configuration, VM has no access to Internet. If you need to update or install additional packages, change the network connection type to “NAT” in “Settings” menu before launching VM (and later switch back to “Host-only network” to complete course tasks).
Java programs launching
Java Development Kit is not installed in provided VM, only Java Runtime Environment. Compile your programs on host system, copy resulting “.class” files to shared directory and launch your programs in VM with “java” executable.
Example: if your source program was situated in “src/1dv201/a2/Server.java” file (i.e., class “Server” in package “1dv201.a2”), resulting binary file will probably be “bin/1dv201/a2/Server.class”. Copy “1dv201” directory to your shared directory. In VM, use command “cd /media/sf_Public && ls” to make sure directory is available. Then to launch your program you can use “java -cp . 1dv201.a2.Server”. If you run into trouble on this stage, read about Java classpath in Oracle documentation.