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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T20:25:39+00:00 2026-05-15T20:25:39+00:00

I have a java class that I use to create a text file from

  • 0

I have a java class that I use to create a text file from a web application. I’m using the following code:

private void CreatePaymentFile(String QueryCriteria) {
BigDecimal TotalPay;
DecimalFormat df2 = new DecimalFormat("00000");
String RecordString = null;
try{
String fileName = "\\\\fileandprint\\Apps\\Jury\\SHARE\\Payment_" + shortdateToday + SeqID + "24400.txt";
File f = new File(fileName);
FileOutputStream fop = new FileOutputStream(f);
SetPaymentFileName("Payment_" + shortdateToday + SeqID + "24400.txt");
FileWriter PaymentStream = new FileWriter(fileName,true);
BufferedWriter out = new BufferedWriter(PaymentStream);

// TODO Auto-generated method stub
String RecordStringFormat = "%-220s%-3s%-4s%-3s%-5s%-5s%-5s%-5s%-30s%-287s%-10s%-150s%-1s%-30s%-1s%-80s%-10s%-6s%-6s%-10s%-20s%-5s%-12s%-43s%-2s%-10s%-70s%-3s%-1s%-1s%-10s%-4s%-6s%-10s%-10s%-5s%27s";
JurorPayDetails JurorpayDetails = new JurorPayDetails();
ArrayList<JurorPayDetails.JurorPayDetailsTable> JurorPayDetailsObjList = new ArrayList<JurorPayDetails.JurorPayDetailsTable>();
JurorpayDetails.setJurorPayDetailsSql("Select P.*, GroupAssignment, TermDateServed, LastName, FirstName, Street1, Street2, City, State, ZipCode, Mileage, PublicEmployee, PayTime, PayMiles from PayDetails P INNER JOIN Jurors J ON P.JurorID = J.JurorID INNER JOIN Address A ON J.JurorID = A.JurorID where AddressType = 'M' and J.TermDateServed IN (" + QueryCriteria +") ORDER BY GroupAssignment, LastName");
boolean indicator = JurorpayDetails.setListOfJurorPayDetails();

if (indicator == true)
{
int size = JurorpayDetails.getListSize();
JurorPayDetailsObjList = JurorpayDetails.getJurorPayDetailsList();
for (int i=0; i<size; ++i){
JurorPayDetails.JurorPayDetailsTable eachPayable = JurorPayDetails.JurorPayDetailsTable)JurorPayDetailsObjList.get(i);
TotalPay = eachPayable.HoursAmount.add(eachPayable.MilesAmount);
RecordString = String.format(RecordStringFormat, ((eachPayable.Street1.trim() + " " + eachPayable.Street2.trim()).trim()), "1","B","1","WFB10","00000","21801","21801",eachPayable.City,"",longdateToday,"", "N", "21801_" + eachPayable.JurorID,"N",((eachPayable.FirstName.trim() + " " + eachPayable.LastName.trim()).trim()),"",    "PYMTLD","0",longdateToday,"21801" + shortdateToday + SeqID,df2.format(i + 1),eachPayable.Zipcode,"","RE","0","","CHK","N", "Y",longdateToday,"PYMT",eachPayable.State, "","001","01200",Paymentdf.format(TotalPay));
out.append(RecordString);
out.newLine();
}
out.close();
}
}catch (Exception e) {
System.err.println("error: " + e.getMessage());
}
}

not a big thing, run a query, get the results and write them in a fixed format to a file and store it on one of our Windows servers.

This works fine when run locally, however, when we put the application on the Linux web server (and change the settings to Linux), the files are not stored in the correct network location.

I have tried using Windows file notation and Linux file notation:
\\fileandprint\Apps\Jury\SHARE\
and
//fileandprint/Apps/Jury/SHARE/

and yes the file location does exist, as I said when run locally in development it works, only when it’s on the Linux box does it not store the files correctly.

Any suggestions?

  • 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-15T20:25:40+00:00Added an answer on May 15, 2026 at 8:25 pm

    you need to explicitly mount the network share into a local directory. Please see http://linuxwiki.de/smbmount for an explanation on how to do this.

    Directly accessing the network share works in the Gnome and KDE file managers because they apply some magic themselves. On the operating system level those pathes don’t exist.

    If this does not solve the issue, please attach the exception output. You can change

    System.err.println("error: " + e.getMessage());
    

    to

    err.printStackTrace();
    

    This will include the exception name and stacktrace in addition to the message. This is especially helpful because the message may be null and you can easily see in which line of your code the exception occurred.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Java class MyPojo that I am interested in deserializing from JSON.
I'm using Java. I want to have a setter method of one class that
I have a Java Google App Engine web application that allows user upload of
I'm currently working on Mangler's Android implementation. I have a java class that looks
I have a simple Java class that I need to serialize to be stored
I have a simple Java class that has some methods: public class Utils {
I have a quite huge Java class that has several imported packages and libraries
In Java I have the necessity of implementing a class that extends Thread within
I am new to Java. I just read that class variables in Java have
In Java, how can I have a Runnable class that, depending on its constructor,

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.