Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7166875
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T14:29:02+00:00 2026-05-28T14:29:02+00:00

How do set up a Unix based VirtualBox guest for Java Development? I wish

  • 0

How do set up a Unix based VirtualBox guest for Java Development? I wish to keep some of my existing development environment (I run Windows) and integrate it using VirtualBox. Is this possible?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T14:29:03+00:00Added an answer on May 28, 2026 at 2:29 pm

    It took me some time to come up with a more flexible solution to install not only a development environment on Linux, from scratch, but also cater for a system running on VirtualBox.

    I have found that running two systems through VirtualBox running on a Windows 7 Ultimate edition gives the optimal solution for my needs as a Java based web developer with additional bash scripting skills.

    Let’s start by my host system (Windows 7 Ultimate) provides me with a proprietary environment where I can install proprietary JDK from Oracle in addition to tools like Photoshop, MS Office, MSSQL, etc. The Ultimate version of Windows 7 allows me to set up XP Mode machines to add IE6, IE7, IE8 to my browser range (you need a new machine for each legacy Internet Explorer). I am also able to test Safari on Windows, but not Linux (to my knowledge). Most of the other tools I use related to Java (IDE’s and Maven, servers), simply need to be unpacked to a specific location or a run o the installer. The two crucial choices I make are: 1) Keep everything in my “%USERPROFILE%” (home) directory & *2)*Ensure my IDE has Maven support.

    The idea is to get our host and guest working in unison. The two systems can benefit each other as I demonstrate in the video below. We can set up SVN repositories with tortoise SVN client in Windows to be used as repositories in guest systems. Obviously if you want proper SVN clients on guests in VirtualBox, install them. However your guest IDE’s will be able to use these Windows created repositories. You can go the other way too by sharing a folder and using your guest SVN client to make it into a subversion repository.

    Our guest system (Linux), allows us to remove some bloatware from Windows. Things like FileZilla & Putty are no longer needed. Our guest comes with a superior terminal with built in ftp and ssh. We can also create bash scripts now to build/rebuild our Linux development and to download our needs. You can even write bash scripts to download and unpack Maven into a Windows shared directory.

    Linux also aids the Web developer with an additional browser which needs to be tested like Konqueror.

    More importantly, our Linux system can just be used as a completely different environment to our host. We can set up Open JDK versions and configure our Maven install accordingly which can also be shared between host and guest as the JRE abstracts it from our host/guest.

    I have written the following script that downloads and installs Oracle JDK onto your guest, Maven, NetBeans & IDEA. The script also prompts you for a file to write ‘boot’ commands to in an attempt to mount some defaults like ‘.m2’, ‘maven’, ‘SVN’, ‘NetBeansProjects’, ‘IDEAProjects’ from your host to guest. Provided that you have set up VirtualBox with Guest Additions and set up these directories to be shared.

    You are prompted for your systems script file which can be used to write startup commands to. I wish there was a universal location for this on Linux but OpenSuse is not playing along so you won’t be able to use the default I provided (type in: /etc/rc.d/boot.local). If you don’t like this feature the script will create ‘on-the-fly’ scripts in your ‘/usr/local/bin’ location.

    Finally, because we are working with shared folders on the guest only (if everything is set up correctly), it should be safe to delete your guest because your are sharing projects, Maven, SVN, from host system and the data should still be there.

    See this vid

    #!/bin/bash
    #Author: Yucca Nel http://thejarbar.org
    #Will restart system
    #Modify these variables as needed...
    tempWork=/tmp/work
    defaultStartScript=/etc/init.d/rc.local
    locBin=/usr/local/bin
    javaUsrLib=/usr/lib/jvm
    defaultMaven=3.0.4
    defaultNetBeansVer=7.1
    mavenUsrLib=/usr/lib/maven
    defaultIDEA=11.0.1
    
    sudo mkdir -p $javaUsrLib
    mkdir -p $tempWork
    sudo mkdir -p $mavenUsrLib
    mkdir -p $HOME/.m2
    mkdir -p $HOME/SVN
    
    cd $tempWork
    
    #Update this line to reflect newer versions of JDK...
    wget http://download.oracle.com/otn-pub/java/jdk/7u2-b13/jdk-7u2-linux-i586.tar.gz
    
    #Extract the download
    tar -zxvf $tempWork/*
    rm -rf $tempWork/*.gz
    
    #Move it to where it can be found...
    sudo mv -f $tempWork/* $javaUsrLib/
    export JAVA_HOME="$javaUsrLib/jdk1.7.0_02"
    
    sudo ln -f -s $javaUsrLib/jdk1*/bin/* /usr/bin/
    rm -rf $tempWork/*
    #Update this line to reflect newer versions of JDK...
    
    if ! grep "JAVA_HOME=$javaUsrLib/jdk1.7.0_02" /etc/environment
    then
    echo "JAVA_HOME=$javaUsrLib/jdk1.7.0_02" | sudo tee -a /etc/environment
    fi
    
    source /etc/environment
    
    read -p "Please [Enter] full path name of your local startup script ($defaultStartScript is the default). Please
    make sure on this before providing a value by consulting documentation for your system:" locStartScript
    locStartScript=${locStartScript:-$defaultStartScript}
    
    read -p "Please [Enter] Maven Version ($defaultMaven is default):" mavenVersion
    mavenVersion=${mavenVersion:-$defaultMaven}
    
    read -p "Please [Enter] NetBeans Version ($defaultNetBeansVer is default):" netbeansVersion
    netbeansVersion=${netbeansVersion:-$defaultNetBeansVer}
    
    read -p "Please [Enter] IDEA Version ($defaultIDEA is default):" ideaVersion
    ideaVersion=${ideaVersion:-$defaultIDEA}
    
    
    if [ ! -f $locStartScript ]
    then
    echo "The file you provided could not be found. Remember to include the full path and try again. Exiting in 7 secs..."
    sleep 7
    exit 1
    fi
    
    wget http://mirrors.powertech.no/www.apache.org/dist//maven/binaries/apache-maven-$mavenVersion-bin.tar.gz
    tar -zxvf $tempWork/*
    
    #Move it to a more logical location
    sudo mv -f $tempWork/apache-maven-$mavenVersion $mavenUsrLib/
    sudo ln -f -s $mavenUsrLib/apache-maven-$mavenVersion/bin/* /usr/bin/
    
    #If you have Maven on Windows and use VirtualBox, you can set up the maven to be a virtualbox shared folder.
    #The name must match the name used below (ignore if irrelevant to you).
    
    
    if [ -f /sbin/mount.vboxsf ]
    then
    sudo /sbin/umount $HOME/.m2
    sudo /sbin/umount $mavenUsrLib
    sudo /sbin/mount.vboxsf .m2 $HOME/.m2
    sudo /sbin/mount.vboxsf maven $mavenUsrLib
    fi
    
    if mountpoint -q $HOME/.m2 &&  mountpoint -q $mavenUsrLib
    then
    tar -zxvf $tempWork/*
    sudo mv -f $tempWork/apache-maven-$mavenVersion $mavenUsrLib/
    #Add it to the start script to automate process...
    if ! grep "sudo /sbin/mount.vboxsf .m2 $HOME/.m2" $locStartScript
    then
    echo "sudo /sbin/mount.vboxsf .m2 $HOME/.m2" | sudo tee -a $locStartScript
    fi
    
    if ! grep "sudo /sbin/mount.vboxsf maven $mavenUsrLib" $locStartScript
    then
    echo "sudo /sbin/mount.vboxsf maven $mavenUsrLib" | sudo tee -a $locStartScript
    fi
    sudo chmod +x $locStartScript
    
    #Create a mount and unmount script file...
    rm -rf $tempWork/*
    echo '#!/bin/bash' > $tempWork/maven-mount.sh
    echo "sudo /sbin/mount.vboxsf .m2 $HOME/.m2" >> $tempWork/maven-mount.sh
    echo "sudo /sbin/mount.vboxsf maven $mavenUsrLib" >> $tempWork/maven-mount.sh
    echo "echo 'mounted maven'" >> $tempWork/maven-mount.sh
    echo "exit 0" >> $tempWork/maven-mount.sh
    
    echo '#!/bin/bash' > $tempWork/maven-umount.sh
    echo "sudo umount $HOME/.m2" >> $tempWork/netbeans-umount.sh
    echo "sudo umount $mavenUsrLib" >> $tempWork/netbeans-umount.sh
    echo "echo 'unmounted maven'" >> $tempWork/maven-mount.sh
    echo 'exit 0' >> $tempWork/maven-umount.sh
    
    #Script for mounting ALL VirtualBox shared solders....
    #If there isn't one create one...
    if [ ! -f $locBin/mount-all-from-host.sh ]
    then
    echo '#!/bin/bash' > /mount-all-from-host.sh
    echo "sudo /sbin/mount.vboxsf .m2 $HOME/.m2" | sudo tee -a $tempWork/mount-all-from-host.sh
    echo "sudo /sbin/mount.vboxsf maven $mavenUsrLib" | sudo tee -a $tempWork/mount-all-from-host.sh
    echo "exit 0" | sudo tee -a $tempWork/mount-all-from-host.sh
    
    #Otherwise if there is one, but no mount, add one...
    elif ! grep "sudo /sbin/mount.vboxsf .m2 $HOME/.m2" $locBin/mount-all-from-host.sh
    then
    sudo sed -ie '$d' $locBin/mount-all-from-host.sh
    echo "sudo /sbin/mount.vboxsf .m2 $HOME/.m2" | sudo tee -a $locBin/mount-all-from-host.sh
    echo "exit 0" | sudo tee -a $locBin/mount-all-from-host.sh
    
    elif ! grep "sudo /sbin/mount.vboxsf maven $mavenUsrLib" $locBin/mount-all-from-host.sh
    then
    sudo sed -ie '$d' $locBin/mount-all-from-host.sh
    echo "sudo /sbin/mount.vboxsf maven $mavenUsrLib" | sudo tee -a $locBin/mount-all-from-host.sh
    echo "exit 0" | sudo tee -a $locBin/mount-all-from-host.sh
    
    fi
    
    #Script for unmounting ALL VirtualBox shared folders...
    #If there isn't one create one...
    if [ ! -f $locBin/umount-all-from-host.sh ]
    then
    echo '#!/bin/bash' > $tempWork/umount-all-from-host.sh
    echo "sudo umount -a -t vboxsf" | sudo tee -a $tempWork/umount-all-from-host.sh
    echo "echo 'unmounted all VirtualBox shared folders'" | sudo tee -a $tempWork/umount-all-from-host.sh
    echo "exit 0" | sudo tee -a $tempWork/umount-all-from-host.sh
    fi
    
    chmod +x $tempWork/*
    sudo mv -f $tempWork/* $locBin/
    rm -rf $tempWork/*
    fi
    
    sudo ln -f -s $mavenUsrLib/apache-maven-$mavenVersion/bin/* /usr/bin/
    rm -rf $tempWork/*
    
    
    wget http://dlc.sun.com.edgesuite.net/netbeans/$netbeansVersion/final/bundles/netbeans-$netbeansVersion-ml-javase-linux.sh
    sh $tempWork/*sh;
    
    
    #Add Netbeans launcher to your PATH. Doing so allows you to run 'netbeans' command from the terminal
    #This line will need to be changed if you changed the default install location (IOW Netbeans is not in ~/)
    sudo ln -f -s ~/netbeans-7.1/bin/netbeans /usr/bin/;
    
    #If you use VirtualBox , you can share your projects between Host and guest. Name of shared
    #folder must match 'NetBeansProjects'
    mkdir -p $HOME/NetBeansProjects
    
    if [ -f /sbin/mount.vboxsf ]
    then
    sudo /sbin/umount $HOME/NetBeansProjects
    sudo /sbin/mount.vboxsf NetBeansProjects $HOME/NetBeansProjects
    fi
    
    if mountpoint -q $HOME/NetBeansProjects
    then
    #Add it to the start script to automate process...
    if ! grep "sudo /sbin/mount.vboxsf NetBeansProjects $HOME/NetBeansProjects" $locStartScript
    then
    echo "sudo /sbin/mount.vboxsf NetBeansProjects $HOME/NetBeansProjects" | sudo tee -a $locStartScript
    fi
    chmod +x $locStartScript
    
    #Create a mount and unmount script file...
    rm -rf $tempWork/*
    echo '#!/bin/bash' > $tempWork/netbeans-mount.sh
    echo "sudo /sbin/mount.vboxsf NetBeansProjects $HOME/NetBeansProjects" >> $tempWork/netbeans-mount.sh
    echo "mounted NetBeansProjects" >> $tempWork/netbeans-mount.sh
    echo "exit 0" >> $tempWork/netbeans-mount.sh
    
    echo '#!/bin/bash' > /netbeans-umount.sh
    echo "sudo umount $HOME/NetBeansProjects" >> $tempWork/netbeans-umount.sh
    echo "unmounted NetBeansProjects" >> $tempWork/netbeans-mount.sh
    echo 'exit 0' >> $tempWork/netbeans-umount.sh
    
    #Script for mounting ALL VirtualBox shared solders....
    #If there isn't one create one...
    if [ ! -f $locBin/mount-all-from-host.sh ]
    then
    echo '#!/bin/bash' > $tempWork/mount-all-from-host.sh
    echo "sudo /sbin/mount.vboxsf NetBeansProjects $HOME/NetBeansProjects" | sudo tee -a $tempWork/mount-all-from-host.sh
    echo "exit 0" | sudo tee -a $tempWork/mount-all-from-host.sh
    
    #Otherwise if there is one, but no mount, add one...
    elif ! grep "sudo /sbin/mount.vboxsf NetBeansProjects" $locBin/mount-all-from-host.sh
    then
    sudo sed -ie '$d' $locBin/mount-all-from-host.sh
    echo "sudo /sbin/mount.vboxsf NetBeansProjects $HOME/NetBeansProjects" | sudo tee -a $locBin/mount-all-from-host.sh
    echo "exit 0" | sudo tee -a $locBin/mount-all-from-host.sh
    fi
    
    #Script for unmounting ALL VirtualBox shared folders...
    #If there isn't one create one...
    if [ ! -f $locBin/umount-all-from-host.sh ]
    then
    echo '#!/bin/bash' > $tempWork/umount-all-from-host.sh
    echo "sudo umount -a -t vboxsf" | sudo tee -a $tempWork/umount-all-from-host.sh
    echo "echo 'unmounted all VirtualBox shared folders'" | sudo tee -a $tempWork/umount-all-from-host.sh
    echo "exit 0" | sudo tee -a $tempWork/umount-all-from-host.sh
    fi
    
    chmod +x $tempWork/*
    sudo mv -f $tempWork/* $locBin/
    rm -rf$tempWork/*
    fi
    
    wget http://download-ln.jetbrains.com/idea/ideaIC-$ideaVersion.tar.gz;
    tar -zxvf $tempWork/*;
    
    #Move it to a better location...
    mv -f $tempWork/idea-IC-* $HOME/;
    rm -rf $tempWork/*
    
    sudo ln -f -s $HOME/idea-*/bin/* /usr/bin/;
    
    #If you use VirtualBox , you can share your projects between Host and guest. Name of shared
    #folder must match 'IdeaProjects'
    mkdir -p $HOME/IdeaProjects
    
    if [ -f /sbin/mount.vboxsf ]
    then
    sudo /sbin/umount $HOME/IdeaProjects
    sudo /sbin/mount.vboxsf IdeaProjects $HOME/IdeaProjects
    fi
    
    if mountpoint -q $HOME/IdeaProjects
    then
    #Add it to the start script to automate process...
    if ! grep "sudo /sbin/mount.vboxsf IdeaProjects $HOME/IdeaProjects" $locStartScript
    then
    echo "sudo /sbin/mount.vboxsf IdeaProjects $HOME/IdeaProjects" | sudo tee -a $locStartScript
    fi
    chmod +x $locStartScript
    
    #Create a mount and unmount script file...
    rm -rf $tempWork/*
    echo '#!/bin/bash' > $tempWork/idea-mount.sh
    echo "sudo /sbin/mount.vboxsf IdeaProjects $HOME/IdeaProjects" >> /idea-mount.sh
    echo "echo 'mounted IdeaProjects'" >> $tempWork/idea-mount.sh
    echo "exit 0" >> $tempWork/idea-mount.sh
    
    echo '#!/bin/bash' > $tempWork/idea-umount.sh
    echo "sudo umount $HOME/IdeaProjects" >> $tempWork/idea-umount.sh
    echo "echo 'unmounted IdeaProjects'" >> $tempWork/idea-mount.sh
    echo 'exit 0' >> $tempWork/idea-umount.sh
    
    #Script for mounting ALL VirtualBox shared solders....
    #If there isn't one create one...
    if [ ! -f $locBin/mount-all-from-host.sh ]
    then
    echo '#!/bin/bash' > $tempWork/mount-all-from-host.sh
    echo "sudo /sbin/mount.vboxsf IdeaProjects $HOME/IdeaProjects" | sudo tee -a $tempWork/mount-all-from-host.sh
    echo "exit 0" | sudo tee -a $tempWork/mount-all-from-host.sh
    
    #Otherwise if there is one, but no mount, add one...
    elif ! grep "sudo /sbin/mount.vboxsf IdeaProjects" $locBin/mount-all-from-host.sh
    then
    sudo sed -ie '$d' $locBin/mount-all-from-host.sh
    echo "sudo /sbin/mount.vboxsf IdeaProjects $HOME/IdeaProjects" | sudo tee -a $locBin/mount-all-from-host.sh
    echo "exit 0" | sudo tee -a $locBin/mount-all-from-host.sh
    fi
    
    #Script for unmounting ALL VirtualBox shared folders...
    #If there isn't one create one...
    if [ ! -f $locBin/umount-all-from-host.sh ]
    then
    echo '#!/bin/bash' > $tempWork/umount-all-from-host.sh
    echo "sudo umount -a -t vboxsf" | sudo tee -a $tempWork/umount-all-from-host.sh
    echo "echo 'unmounted all VirtualBox shared folders'" | sudo tee -a $tempWork/umount-all-from-host.sh
    echo "exit 0" | sudo tee -a $tempWork/umount-all-from-host.sh
    fi
    
    chmod +x $tempWork/*
    sudo mv -f $tempWork/* $locBin/
    rm -rf $tempWork/*
    fi
    
    if [ -f /sbin/mount.vboxsf ]
    then
    sudo /sbin/umount $HOME/SVN
    sudo /sbin/mount.vboxsf SVN $HOME/SVN
    fi
    
    if mountpoint -q $HOME/SVN
    then
    #Add it to the start script to automate process...
    if ! grep "sudo /sbin/mount.vboxsf SVN $HOME/SVN" $locStartScript
    then
    echo "sudo /sbin/mount.vboxsf SVN $HOME/SVN" | sudo tee -a $locStartScript
    fi
    chmod +x $locStartScript
    
    #Create a mount and unmount script file...
    rm -rf $tempWork/*
    echo '#!/bin/bash' > $tempWork/svn-mount.sh
    echo "sudo /sbin/mount.vboxsf SVN $HOME/SVN" >> /svn-mount.sh
    echo "echo 'mounted SVN'" >> $tempWork/svn-mount.sh
    echo "exit 0" >> $tempWork/svn-mount.sh
    
    echo '#!/bin/bash' > $tempWork/svn-umount.sh
    echo "sudo umount $HOME/SVN" >> $tempWork/svn-umount.sh
    echo "echo 'unmounted SVN'" >> $tempWork/svn-mount.sh
    echo 'exit 0' >> $tempWork/svn-umount.sh
    
    #Script for mounting ALL VirtualBox shared solders....
    #If there isn't one create one...
    if [ ! -f $locBin/mount-all-from-host.sh ]
    then
    echo '#!/bin/bash' > $tempWork/mount-all-from-host.sh
    echo "sudo /sbin/mount.vboxsf SVN $HOME/SVN" | sudo tee -a $tempWork/mount-all-from-host.sh
    echo "exit 0" | sudo tee -a $tempWork/mount-all-from-host.sh
    
    #Otherwise if there is one, but no mount, add one...
    elif ! grep "sudo /sbin/mount.vboxsf SVN" $locBin/mount-all-from-host.sh
    then
    sudo sed -ie '$d' $locBin/mount-all-from-host.sh
    echo "sudo /sbin/mount.vboxsf SVN $HOME/SVN" | sudo tee -a $locBin/mount-all-from-host.sh
    echo "exit 0" | sudo tee -a $locBin/mount-all-from-host.sh
    fi
    
    #Script for unmounting ALL VirtualBox shared folders...
    #If there isn't one create one...
    if [ ! -f $locBin/umount-all-from-host.sh ]
    then
    echo '#!/bin/bash' > $tempWork/umount-all-from-host.sh
    echo "sudo umount -a -t vboxsf" | sudo tee -a $tempWork/umount-all-from-host.sh
    echo "echo 'unmounted all VirtualBox shared folders'" | sudo tee -a $tempWork/umount-all-from-host.sh
    echo "exit 0" | sudo tee -a $tempWork/umount-all-from-host.sh
    fi
    
    chmod +x $tempWork/*
    sudo mv -f $tempWork/* $locBin/
    rm -rf $tempWork/*
    fi
    
    sudo rm -rf $tempWork
    sudo /sbin/reboot
    
    exit 0
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to run the same set of Unix commands on multiple machines. I
I basically have a server set up and I'm accepting new clients(UNIX) and i'm
I set up all my certificates and keys today and am trying to run
I am an old Unix guy who is converting a makefile based project over
I am trying to execute unix command using SSH from cygwin. My set of
I have a Unix bash function that executes a script that parses custom environment
I am hosting a Java web service on a AIX unix box using JBoss.
On a modern Unix or Linux system, how can you tell which code set
How do I set up my execution environment for ESC/Java2 in WindowsXP? And furthermore,
i have unix shell script which is need to be run like below test_sh

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.