java - how to connect server in VM from windows

07
2014-07
  • Lakmal

    I have installed Red Hat Server 6.4 in VirtualBox and I also installed Java. I wrote a socket program (port 13 , ip = x.x.x.x). Then in Command prompt, I execute telnet x.x.x.x 13

    But it doesn't connect. Then I removed firewalls in Red Hat, But I still can't connect. Can someone please help me? You can find my code below:

    try {
            socServerSocket = new ServerSocket(SERVICE_PORT);
            while (true) {
                socClient = socServerSocket.accept();                
                RequestProcessor thread = new RequestProcessor(socClient);
                executorService.execute(thread);               
    
            }
    
        } catch (Exception e) {
    
        }
    
  • Answers
    Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

    Related Question

    Installation of java in LINUX
  • prakash.panjwani

    I am trying to install Java on Red Hat Linux through SSH.

    I am using wget to download the installer. When wget downloads the file, it saves it with a filename of

    jre-6u16-linux-i586-rpm.bin?e=1255431454245&h=f50f4cda5641e55f8e49f217e854faca%2F&filename=jre-6u16-linux-i586-rpm.bin
    

    But, when I try to execute the file to install it, it throws this error

    cannot access `jre-6u16-linux-i586-rpm.bin?e=1255431454245': No such file or directory
    

    I am new to Linux. Please explain how to install Java on Linux through the terminal.


  • Related Answers
  • John T

    First and foremost make sure the file is not the webpage, the Linux jre6u16 is roughly 19mb. The ampersand (&) in the filename as already stated, tells the OS to run the process in the background. Rename the file to something simpler using mv and put the filename in quotes:

    mv "jre-6u16-linux-i586-rpm.bin?e=1255431454245&h=f50f4cda5641e55f8e49f217e854faca%2F&filename=jre-6u16-linux-i586-rpm.bin" jre-6u16-linux-i586-rpm.bin

    then allow execute permissions:

    chmod a+x jre-6u16-linux-i586-rpm.bin

    then we can install it:

    ./jre-6u16-linux-i586-rpm.bin
  • Michael Borgwardt

    What Linux distribution are you using? Most of them should allow you to install Java through their package management system (such as APT for Debian and Ubuntu), which is easier, and allows for easy updates as well.

    If you really must install it manually, start by renaming the file to something shorter and then make it executable with this command:

    chmod a+x filename
    

    Then you should be able to run it.

  • gnibbler

    you probably had to put quotes around when you ran wget.

    rename the file like this

    mv 'jre-6u16-linux-i586-rpm.bin?e=1255431454245&h=f50f4cda5641e55f8e49f217e854faca%2F&filename=jre-6u16-linux-i586-rpm.bin' jre-6u16-linux-i586-rpm.bin
    

    then install it

  • sfussenegger

    How big is this file (ls -lh jre*)? To me, it looks like you've downloaded Sun's download page instead of the installer.

    Additionally, there is no such thing as a "Linux OS". (Linux is the kernel, try to become familiar with the terminology!) If your looking for answers, try searching (aka googling) for your distribution name, e.g. "ubuntu java installation" or "suse java installation". You may also try to include your version for even better results, e.g. "karmic java installation".

    And finally, you should consider serverfault.com and superuser.com for this kind of questions.

  • user14049
    1. Not really programing related,
    2. Use quotes around file name (jre-6u....). That ampersand "&" in downloaded file name has special meaning (run process in background)
    3. Depending on you linux distro there should be better way (distribution specyfic that takes care of all process and updates).