473,414 Members | 1,621 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,414 software developers and data experts.

File created from eclipse but not from running jar

Hi ,
I have developed a java code to read csv file and write another file after some modifications, the code is working fine when running through eclipse, but when I am creating jar and trying to execute it the files are not getting created.
Any idea why it is happening.
I am using windows 7.
Feb 29 '12 #1
12 2443
r035198x
13,262 8TB
How are you executing the jars and where are the files supposed to be created?
Mar 1 '12 #2
I am executing the jar using command prompt in widows
Expand|Select|Wrap|Line Numbers
  1. java -jar xxx.jar
the log file is also getting generated where I have printed the message that files are written.
Mar 1 '12 #3
the files are supposed to be created in a new folder in the same system.
Mar 1 '12 #4
r035198x
13,262 8TB
Does the log file say that the files have been created?
How do you specify the output folder for the files?
Mar 1 '12 #5
yes the log file is saying file is created, i have specified the ouput folder in a properties file , the code is running fine from eclipse IDE.
Mar 1 '12 #6
r035198x
13,262 8TB
Let's see the code where you get the output file path from the properties and create File/FileWriter object with it.
Mar 1 '12 #7
Expand|Select|Wrap|Line Numbers
  1.     String filename= properties.getProperty("out");
  2.  
  3. Writer output = new BufferedWriter(new FileWriputfileter(filename));
  4. output.write(strbuff.toString());
  5.  
  6.                     output.flush();
  7.                     output.close();
Mar 1 '12 #8
r035198x
13,262 8TB
Do you have e.printStackTrace() in your catch block?
It could be that your property file was not found/loaded in the jar file and an exception is being thrown?
Mar 1 '12 #9
tested the jar in other system with windows 7 and it is working only in my system it is not creating file. No exception is thrown i have e.getMessage() in the logs.
Mar 1 '12 #10
r035198x
13,262 8TB
What is the file output path specified like? Does it exist on your computer and do you have write rights to it?
Also if the the code is not too long you could post it here.
Mar 1 '12 #11
code is too long, can't paste it here the output path is in my system only, C:/abhi/ff/. I have rights on it and able to create file in it when I am executing the code from eclipse... the log file is getting generated in both the cases while executing from eclipse and jar and all the log messages are same , but in case of jar the files are not getting created.
Mar 1 '12 #12
r035198x
13,262 8TB
If you are not hiding exceptions with an empty catch block then some condition that requires file to be generated is not being met on your computer. Also try executing the jar as an administrator.
Mar 1 '12 #13

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Daniel | last post by:
when writing out a file from .net, when is the file created? after the bytes are all written to the hard drive or before the bytes are written to the hard drive?
2
by: Robizzle | last post by:
Sorry, I must be blind but I can't seem to find it anywhere. What function will return the time a file was created? I see filemtime(...) returns the time that file was last Modified and...
4
by: Oliver Knoll | last post by:
According to my ANSI book, tmpfile() creates a file with wb+ mode (that is just writing, right?). How would one reopen it for reading? I got the following (which works): FILE *tmpFile =...
1
by: lsemos58 | last post by:
How can I restore the .bak file created while using wrkgadm.exe to create a new workgroup information file. Luane
5
by: xhy_China | last post by:
How to close an file in an running process from another process? For example: There are two running processes,named procIn and procFrom. A file named needCloseFile was opened in procIn. Now I...
3
by: pnsreee | last post by:
Hi All, I am trying to print a log file created in the same script with the code bellow. but Im not getting output on screen. The output file is created using rediretion of output. ...
2
by: tulasisridhar | last post by:
Hi All, I have binary file created in Unix I now need to read it using VB.net and doo some procesing. There is some conversion between bigendian and little endians. I know the structure...
1
oll3i
by: oll3i | last post by:
i have eclipse pointing to jdk but whenever i start eclipse or create a new project i get the error 18.10.08 16:10:51 CEST: Error on adding indexing context central; read past EOF 18.10.08...
4
by: cworkman29729 | last post by:
hello i need to know how i can set the description of a txt file created by my app using c# thanks!!
2
by: Venkat G | last post by:
$ db2 describe table venkat Data type Column Column name schema Data type name Length Scale Nulls...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.