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

  • Home
  • SEARCH
  • 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 8325515
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T00:27:48+00:00 2026-06-09T00:27:48+00:00

I am trying to write Java code to run wget to retrieve an image

  • 0

I am trying to write Java code to run wget to retrieve an image from a server

I believe that I have wget properly installed. If I type:

wget http://insitu.fruitfly.org/insitu_image_storage/img_dir_38/insitu38795.jpe

I find the image in my user account folder.

The following Java code was working properly on Ubuntu, but I had to move the project over to OSX (Mountain Lion)

import java.io.*;
import java.io.IOException;

public class runWget
{

  public static void main (String args[])
  {
    String whatToRun = "wget     http://insitu.fruitfly.org/insitu_image_storage/img_dir_38/insitu38795.jpe";
   try
   {
     Runtime rt = Runtime.getRuntime();
     Process proc = rt.exec(whatToRun);
     int exitVal = proc.waitFor();
     System.out.println("Process exitValue:" + exitVal);
   } catch (Throwable t)
     {
       t.printStackTrace();
     }
  }
}

When I try to run it on OSX, I get the runtime error:

java.io.IOException: Cannot run program “wget”: error=2, No such file
or directory

I would greatly appreciate if someone could tell me what I am doing wrong.

  • 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-06-09T00:27:49+00:00Added an answer on June 9, 2026 at 12:27 am

    If wget is indeed installed on your OS X system, then try to specify the full path to it.

    Try:

    which wget

    from the command line, then use that fully qualified path in your Java application.

    String whatToRun = "/usr/local/bin/wget http://insitu.fruitfly.org/insitu_image_storage/img_dir_38/insitu38795.jpe";
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to write a small Java application that will let me run
What's up y'all, I am trying to write some code in Java that will
I'm trying to write a Java program that will run an OpenOffice Macro. I'm
I'm trying to write a simple code in Java to connect to a memcache
I am trying at write a java program that hits a url over ssl,
I am trying to write a Java program that reads an input file consisting
I am trying to write a java application connecting to server connection channel with
I'm trying to write a Java UDF that will rank tuples in a bag
I'm trying to write some code in java to learn more about coding with
I am beginner to java and was trying out this code puzzle from the

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.