Running batch file error
I have already tried to find some solution on Java Essential forum, not much success there. I hope someone might suggest something here.
Design: one big file, split into chunks, recombined according to some order, feeded to some exe file, and finally compilation of results.
Problem: I can run that smoothly with jdk, however, when I use Java beans I am running into troubles. I can split the file, create an order, recombine the files, but when I try to feed it to an exe file(through a batch file) i get this error:
endfile record was detected in a READ statement (UNIT = 3). Error occurs at _MAIN__. A dubplicate file name exists or the file cannot be foundThe main method is something like this:
s.split_ftn07() ;
s.Define_Order() ;
for (int i = 1 ; i < 11 ; i ++)
s.re_combine(i) ;
s.run_Fastran(i) ;
s.ass_Result() ;my batch file:
@echo off
cd
"C:\JBoss\jboss-4.0.5.GA\bin\Fastran\FASTRAN.EXE"
ren FTN04 FTN04i
:finishand my method that runs the batch file: (as soon as it pass the exec(), it opens the cmd.exe windows and displays the error message).
public void run_Fastran(int x)
try
File ftn07_i = new File("C:\\JBoss\\jboss-4.0.5.GA\\bin\\Fastran\\ftn07_" + x) ;
File ftn07 = new File("C:\\JBoss\\jboss-4.0.5.GA\\bin\\Fastran\\ftn07") ;
ftn07_i.renameTo(ftn07) ;
String path = "";
path = "cmd /c start C:\\JBoss\\jboss-4.0.5.GA\\bin\\Fastran\\FCall.bat";
Runtime rt = Runtime.getRuntime();
Process proc = rt.exec(path);
String nameNew = "C:\\JBoss\\jboss-4.0.5.GA\\bin\\Fastran\\FTN04-" + x + "-p12";//change p12 with the crack path input by user.
File file = new File("C:\\JBoss\\jboss-4.0.5.GA\\bin\\Fastran\\FTN04i");
while (file.exists()==false)//until FTNO4i come into existence
// File with new name
File file2 = new File(nameNew);
// Rename file
file.renameTo(file2);
File ftn07Back = new File("C:\\JBoss\\jboss-4.0.5.GA\\bin\\Fastran\\ftn07") ;
File ftn07_iBack = new File("C:\\JBoss\\jboss-4.0.5.GA\\bin\\Fastran\\ftn07_" + x) ;
ftn07Back.renameTo(ftn07_iBack) ;
File ftn07_i_del = new File("C:\\JBoss\\jboss-4.0.5.GA\\bin\\Fastran\\ftn07_" + x) ;
ftn07_i_del.delete() ;
catch(Exception e)
e.printStackTrace();
}I am tired to figure out whats going on? Need some help here, will be greatly appreciated. Thanks
Thanks to all, I really appreciate all the pains which all of you have taken in resolving my problem.
It wasn't Java problem, rather batch file problem. I was only changing the directory, and was not providing for the exe file to run.
@echo off
cd "C:\JBoss\jboss-4.0.5.GA\bin\Fastran"
"C:\JBoss\jboss-4.0.5.GA\bin\Fastran\FASTRAN.EXE"
ren FTN04 FTN04i
EXIT
:finishNow it is working fine.
I did check the access permissions, no problem with that I guess. The problem was with the path. The batch file couldnt go pass bin directory, and I noticed that only today ;(. At any rate, I changed that and now it is all smooth and dandy.
Once again, thanks a lot.
Similar Messages
-
Error running batch files from java source file???
Dear Friends,
hi,
this is with response to a doubt i had earlier ,
i want to run batch files from the java source file ,i tried using this code (here batrun is the batch file name that contains commands to run other java files)
try
String [] command = {"c:\\vishal\\finalmain\\batrun"};
Runtime.getRuntime().exec(command);
catch(Exception e)
but i got the following error.
java.io.IOException: CreateProcess: gnagarrun error= 2
plz. help me, i tried all combination w/o success,
in anticipation(if possible give the code after testing)
Vishal.hello there,
i solved the prob. by using
cmd /c start filename ,but i need to pass parameters ie
cmd /c start java "c:/vishal/runfile a b" where a and b are the parameters. but it is not accepting this in Runtime.getRuntime.exec(),
any solutions ?????????
regards,
Vishal -
HOST IN 10g to run batch file on application server
Hi,
I am trying to deploy a form from 6i to 9i. the form use Host builtin to run batch file on machine. this works fine when i run form on client server environment. but when i run the same form after compiling in 9i and run on 3 tier model and try to run batch file from form it give me error that
'ftp' is not recognized as an internal or external command,
operable program or batch file.
any suggestion?It could be because the Host session doesn't have any environment variables set i.e. there is no PATH variable, so it simply doesn't know where to look to find the 'ftp' executable. You could try supplying the explicit path of the ftp executable and see if that works. (This was a problem I had running Host commands on a Unix application server.)
James -
How to run batch file from oracle forms 9i
Hi everyone.
i have a data in csv file. i want to upload it to my database. i am using sql loader for it.
i have made a batch file which run the sql loader and transfer my data to database.
How to run batch file from oracle forms 9i.
when i press the button, nothing uploads in my database. (when i simply run the batch file it works).
here is my code
Begin
HOST('C:\temp\batchfile.bat');
message('done');
end;
Thanks in advance
regards
sajidthis is my log file, when i run manually.
SQL*Loader: Release 10.2.0.1.0 - Production on Thu Jul 1 23:27:53 2010
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Control File: file_to_upload.ctl
There are 2 data files:
Data File: sk.csv
Bad File: sk.bad
Discard File: none specified
(Allow all discards)
Data File: sk1.csv
Bad File: sk1.bad
Discard File: none specified
(Allow all discards)
Number to load: ALL
Number to skip: 0
Errors allowed: 50
Bind array: 64 rows, maximum of 256000 bytes
Continuation: none specified
Path used: Conventional
Table KHAN, loaded from every logical record.
Insert option in effect for this table: APPEND
Column Name Position Len Term Encl Datatype
SR FIRST * , O(") CHARACTER
DATES NEXT * , O(") CHARACTER
AGENT NEXT * , O(") CHARACTER
COUNTRY NEXT * , O(") CHARACTER
TRANSACTIONS NEXT * , O(") CHARACTER
PKR NEXT * , O(") CHARACTER
USD NEXT * , O(") CHARACTER
BANK NEXT * , O(") CHARACTER
Table KHAN:
11088 Rows successfully loaded.
0 Rows not loaded due to data errors.
0 Rows not loaded because all WHEN clauses were failed.
0 Rows not loaded because all fields were null.
Space allocated for bind array: 132096 bytes(64 rows)
Read buffer bytes: 1048576
Total logical records skipped: 0
Total logical records read: 11088
Total logical records rejected: 0
Total logical records discarded: 0
Run began on Thu Jul 01 23:27:53 2010
Run ended on Thu Jul 01 23:27:54 2010
Elapsed time was: 00:00:00.63
CPU time was: 00:00:00.17 -
Unable to run batch file through BO XI 3.1 server
IHi,
I am unable to run batch file (.bat) from BO XI CMC. the batch file is running fine through command prompt but fails at server. Error msg is "Running this type of program is disabled by your administrator".
Can you help?
Thanks in advance,
AvijitHave your administrator enabled the running of that type of program in the CMC?
Sincerely,
Ted Ueda -
Getting the famous error :
... is not recognized as an internal or external command`*
When & Where :
not sure about the total range of the problem,
Here I can't run batch files and "devneve.exe"
sample Batch could be :
@echo off
clr
'clr' is not recognized ...
**Here are the keynotes:**
1. I run it as an admin (cmd)
2. The Path variable seems to have anything needed, Powershell's path is also there sys32..v1
3. I'm going into the current directory of devnev.exe ...
4. ran also "devnev.exe"
5. I don't have 2 cmd s in a known folder
6. the autorun registries for command prompt were deleted
7. the cmd extensions were disabled and re-enabled
8. Avast IS 9 is running,
9. The system seems to be fine
10. all .Net frameworks are installed
11. for a test jetAudio or ILDasm could be executed from the cmd
Win 8.1 Pro , CPU i7, VS 2013 upd2thanks,
this was one of the silliest problems I've ever encountered, my bad fault,
the file is DevEnv not DevNev...!
but about the clr, don't know from when I added them to my batches, but I'm sure the scripts were working correctly a time ago, maybe by a mistake I changed them, I thought it is the most known command, but I was wrong, there is a long time gap between me
and DOS. -
Running batch files thraugh java by passing parameters
Hi
I want to run a batch file by passing some parameters.
Eg: copy.bat "D:\live\hoe.txt" "D:\test"
while doing this from command prompt its working and i have written some java code for running this batch file.
String live="D:\\live\\how.txt";
String test="D:\\test";
String bat="D:\\copy.bat";
String[] command = new String[3];
command[0] = bat;
command[1] = live;
command[2] = test;
try {
Runtime.getRuntime().exec(command);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
but this time its not copying the file;
Please help.Just another cross poster.
[http://www.java-forums.org/new-java/15005-running-batch-files-thraugh-java-passing-parameters.html]
db -
Unable to run batch files in my EP server
Hi,
I'am unable to run batch files(go.bat and configtool.bat) on my EP server.Anbody please give me a solution.
With Regards
Pradeep.BIf your EP Server is on non-windows based environment then you cannot use go.bat & configtool.bat or else you can. If you are trying to execute these on unix based machines then you have to use go.sh & configtool.sh files.
Pradeep -
Can't run batch file in Windows 2008 R2
Trying to run batch file (manually first) with powershell commands.
Powershell commands work fine thru powershell but the batch file will not execute manually.
I am trying to run as administrator.
Is there a permission or policy I may be missing?
Thanks
Dave
Dave KozlowskiHi,
Some bat type command can't run in the powershell environment, you must confirm you have choiced the correct lunch tools.
Hope this helps.
We
are trying to better understand customer views on social support experience, so your participation in this
interview project would be greatly appreciated if you have time.
Thanks for helping make community forums a great place. -
Editing is terminated message when running batch input error using lsmw
Any Idea why would I get the info message like
"Editing is terminated message when running batch input error using lsmw"
please suggest where to look at.
Thanks,
Edited by: mark_yellow mark on Jul 1, 2008 3:27 AMHi Mark,
Welcome.
This is lsmw batch input error.while uploading the G/L accounts using the Batch Input process (program name RFBISA00) in LSMW.this error mainly generates...
Fix the error using logs.
thanks
karthik -
PDQ - run batch file on user current folder...
Hi,
I'm running batch file:
cd %USERPROFILE%\AppData\Local\Microsoft\Windows\Temporary Internet Files\
but it's not opening the current logged on user
how to deploy it on current logged on user?
thanks,,,
This topic first appeared in the Spiceworks CommunityThis is not working for me in Windows 8. I have a shortcut to an EXE file located in"C:\Users\admin\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup". If I set the shortcut to run as administrator (screenshot attached) then it does
not run at all on startup. If I uncheckmark "Run as Administrator" then it starts fine (but does not have enough privileges to do what it needs to do). In Windows 7 this was not an issue since the current user was a local administrator and did
not need to elevate its privileges further.
Any ideas how I can work around this problem? Thanks!
Ugh... it won't let me attach a screenshot until my "account is verified", whatever that means. -
Error on running batch file in ODI
Hi All,
I am trying to run a batch file thats on another server.
So I mapped the network drive to point to that path as X:
I included OS Command step in the ODI package to call the batch file on X:\.
I used the following command:
cmd /c //X:\MyBatchFile.bat
when I execute the same with & without agent, it shows the following error:
'Wrong process return code'
I need some guidance here. Please help!
Thanks,
RubyI have seen that this error - Wrong process return code generally comes when syntax are not correct. To correct that i would recommend run the syntax in the Windows system from Oracledi/bin path and check if the that works and once you get the correct syntax ,copy and paste the codes into the OS command and try that should work .
Make sure you use the correct Agent . -
Windows task scheduler to run batch file running a java program
I have created a batch file that runs my SendEmail program. The batch file is in the same directory as the java program. The only line in the batch file is
java SendEmail
This works fine from the command prompt but from the windows task scheduler it fails to function. Any help on how I can overcome this problem will be greatly appreciated.
THanksLooks okay. The classpath is set, too, I guess? Btw, try running javaw instead of java. I may err, but I think it can show a console, so you can watch any error messages.
-
SQL 2008 Agent - run batch file not working
Hello,
I am having some strange issues with a batch file running out of SQL agent I'm hoping I can get some help with.
The batch file's purpose is to send some log files to a SFTP server.
The job has been working great for the past 3 weeks, however this morning it stopped working. The job doesn't error out, however the entire job completes in 00:00:00 duration and I'm given the following message
Date 4/7/2014 3:38:00 PM
Log Job History (***Log Transfer)
Step ID 1
Server *******
Job Name **** Log Transfer
Step Name run batch
Duration 00:00:00
Sql Severity 0
Sql Message ID 0
Operator Emailed
Operator Net sent
Operator Paged
Retries Attempted 0
Message
Executed as user: USERNAMERemoved . The step did not generate any output. Process Exit Code 0. The step succeeded.
The batch file looks like
echo *********************************
echo ** JOB EXECUTED %date% %time% **
if %errorlevel% neq 0 exit /b
C:
cd "C:\Program Files (x86)\WinSCP"
winscp /console /script=G:\Batch\LogTransfer.txt
call G:\Batch\LogTransfer2.bat
echo ** COMPLETED %date% %time% **
echo *********************************
I have numerous other batch jobs running on this server, no other job has had this issue. I have deleted and recreated both the job step and the entire job. I have recreated the batch files from scratch. I have also deleted the entire
contents of the batch file and just simply put in echo **** and still received the message so I'm near positive it has nothing to do with the actual batch file.
I have reset SQL Agent, as well rechecked that the SQL Agent account has run batch rights granted to it.
I moved the batch files to another folder, and they worked for about 4 runs until the same issue happened!!!
The job does execute 100% perfect if I run it manually via batch or if I kick it off starting the job out of SQL.
I am out of options here, does anyone have any ideas that could help me out?
Thanks,
RyanHello,
Try to edit the step, and on the Advanced page of that step try to configure the job to create a log on the location you specify (Output file). Try to run the step again and examine the log created.
Could you try to change the owner of the job to “sa” or to your Windows account? Maybe the SQL Server Agent account does not have access
to the following folders:
G:\Batch\
C:\Program Files (x86)\WinSCP
Alternatively, you can try to create a proxy account.
http://technet.microsoft.com/en-US/library/ms190698(v=SQL.105).aspx
Hope this helps.
Regards,
Alberto Morillo
SQLCoffee.com -
Run batch files through java code
Hi All
I need to run a batch file using java code . I am not getting any error, but also no output. Can someone let me know the problem with my code.The code i am using is
import java.io.*;
public class batchtest {
public static void main(String[] args) {
Runtime r = Runtime.getRuntime();
Process p= null;
String line;
try{
p = r.exec("cmd /c testBatch.bat");
BufferedReader input = new BufferedReader
(new InputStreamReader(p.getInputStream()));
while ((line = input.readLine()) != null) {
System.out.println(line);
input.close();
System.out.println("running...");
}catch(Exception e)
e.printStackTrace();
}Maybe this helps:
http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html
Maybe you are looking for
-
Preview hangs while trying to open old multiple files
Hello Everyone! After restarting my Macbook Pro, I opened Preview, it showed all the files I was using before closing it, but it was frozen. I checked the errors on the Console: 11/09/12 20:19:55,726 Preview[909]: SCNetworkReachability server not av
-
My Photoshop CS5 crashes - need help reading crash report
Hi, I am running Mac OS 10.8.5 with Photoshop CS5 (all updates performed). Suddenly my PS crashed by opening the mor than one file. I would appreciate someone's help to read my crash report - as to what software is causing it. Thanks! Here is the cra
-
How to call custom BSP application on click of BACK button for SC in EBP.
Hi All, We are implementing OCI using custom BSP applications.In EBP SC screen ,in step1 (Select Goods/Services), the links for these BSP applications are displayed. The user can create a shopping cart using these applications , after the items are t
-
Converting external link as2 script to as3
Hello. I used this script I found online to make a Flash file that accessed an external text file full of hyperlinks through buttons in the Flash movie. The code is as2. I had to update the Flash file to AS3 and now the script doesn't work. I can't f
-
I purchased Adobe CC Student and Teacher Edition so that I could complete my school assignments. However, I need to install it on both my laptop and desktop for obvious reasons. Last night I installed the applications on my desktop computer, but afte