Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Background processing linux issue '&'

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a program written in java that produces a number of reports from a given script that runs against a database. When I run the program like 'java javaprogram.jar &' (with various parameters) it puts it into the background and runs. However when run this way it produces concatenated reports i.e. 2 or 3 reports appearing in 1 file. However when run without the '&' (linux) the program runs and produces the reports without any issues.

Does anyone know what may be occurring, there is only 1 java program running.
Hope some one can help - Unfortunately I cannot show any code as its copyright.
 
Bartender
Posts: 9612
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How are you creating these reports (i.e. writing to stdout or creating files with Java IO or some third party library)?   What command line options are there and do any control output?

Perry Davies wrote:
Unfortunately I cannot show any code as its copyright.



Can you create a short, self contained, correct example  that exhibits this behavior?  
 
Perry Davies
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Writing reports out using Java IO no third party libraries are used - parameters added are options on what report gets printed but none indicate amending reports together. So no they do not control output just the type of report. I was wondering if java is trying to optimize the work and moving some of the work to another processor - although there is no such code being used in the program.

I will try as you suggested a small program that does similar and check to see if it acts in a similar way.
 
Rancher
Posts: 4607
47
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The first thing I would do is chuck a load of debugging in there to find out why it is using the same filename for a bunch of reports in one case and not the other.

That will at least give you some data to work with, and then you can focus a bit better.

Java will not be optimising anything here.
 
Sheriff
Posts: 7638
522
Mac OS X VI Editor BSD Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
@OP

Do you add '&' before various arguments or after? That may have an affect.

Do you want to share at least the instruction you are issuing from within your terminal?
 
Onion rings are vegetable donuts. Taste this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic