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 6751051
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T12:52:52+00:00 2026-05-26T12:52:52+00:00

I have created some application, which is reading from System.in using the following method:

  • 0

I have created some application, which is reading from System.in using the following method:

    Scanner input = new Scanner(System.in);

    while (input.hasNextLine()) {

        String line = input.nextLine();

    }

Input data is being passed with linux command:

cat -A /home/someuser/somefile.txt | java -classpath "$CLASSPATH" com.test.Main

The crontab entry looks like:

MAILTO=someuser
CLASSPATH="/home/someuser/test.jar:/usr/share/java/jdom.jar:/usr/share/java/mysql-connector-java.jar"

0,10,20,30,40,50 * * * * cat -A /home/someuser/somefile.txt | java -classpath "$CLASSPATH" com.test.Main  >/home/someuser/output.txt

The permissions for the files shows the following:

-rw-r--r-- 1 someuser serhiy 8385601 2011-02-07 10:57 /home/someuser/somefile.txt

Everything is working fine on my machine(Ubuntu 9), but after installation on another machine Ubuntu 8, I figured out that program starts but seems not to be reading anything. I have triple checked all configurations and all permissions and the result still the same. When I run command manually everything is working, when it’s ran by crontab it seems not reading input. Anyone experienced this issues before?

Thanks for any help
Serhiy.

  • 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-26T12:52:53+00:00Added an answer on May 26, 2026 at 12:52 pm

    Are you defining the variables in crontab ? That does not seem right.

    1) Move the command to a shell script and invoke the shell command from cron, eg

    */10 * * * * /home/someuser/some_script.sh >/home/someuser/some_script.cronoutput 2>&1
    

    2) Contents of some_script.sh ; make sure the execute bit is set

    #!/bin/sh
    export MAILTO=someuser  
    export CLASSPATH="/home/someuser/test.jar:/usr/share/java/jdom.jar:/usr/share/java/mysql-connector-java.jar"  
    
    cat -A /home/someuser/somefile.txt | java -classpath "$CLASSPATH" com.test.Main  >/home/someuser/output.txt
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created one application which is reading outlook mail, but when user install
I have created some settings in a C# application using .NET 3.5 and Visual
I have created an application that does the following: Make some calculations, write calculated
I have an Application which, reads files from Sdcard and does some intense processing.
I have created some tests in my WPF application. Right now I am working
I have created an application that writes some data to the root folder of
I have created an application that uses settings.settings to store some user specific settings
Hi I have created a little application to move some files around and put
I'm using Rational Application Developer to create some web services. The problem I have
I have created some rounded navigation tabs using CSS and am having trouble when

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.