Running java program with arguments in Unix

Hi
I am a new newbie to java so pardon if this is too simple for you .
This is my scenario. I have a java program which parses an xml and writes a .dat file. I execute this testparser.java in unix environment like this
java testparser xml1.xml
and it retuns me a .dat file
But my issue is I have to run my parser program for 40 xml files. The requirement is I have to create a script file and possibly with a for loop which will loop through 1-40 xml files and return me the .dat file.
I am really at a loss here. I am new both to Java and Unix
So pls help me out
Thanks in Advance
G

You could just do this in Java. Make it take all 40 xml files on the command line, and convert them all with one program invocation.
If you want to do it in shell script, you can do something like
for tmp in `ls -1 *.xml`; do
  java testparser $tmp
donedepending on your shell, etc.

Similar Messages

  • Can't run java program with GUI

    My computer can run java program properly.
    However, for those program with GUI (using swing),
    my computer is unable to display the GUI.
    What's wrong with it? Is there any PATH I need to set before running GUI program?
    Thanks
    icedgold

    Cut, copy, paste then compile and run this;-import java.awt.*;
    import javax.swing.*;
    public class MyJFrame extends JFrame {
      public MyJFrame() {
          super("My first JFrame");
          Container c  = getContentPane();
          JPanel panel = new JPanel();
          panel.setBackground(Color.white);//  (new Color(255, 255, 255));
          JLabel jl = new JLabel("Yes it works");
          panel.add(jl);     
          c.add(panel);
      public static void main(String[] args) {
        MyJFrame frame = new MyJFrame();
        frame.setSize(180,120);
        frame.setLocation(200, 300);
        frame.setDefaultCloseOperation( EXIT_ON_CLOSE );
        frame.setVisible(true);
    }

  • Running java program as a server

    Please advise of what's difference in running java program with -server option and just runing it like java program1?
    Thx

    -server option uses the server VM for the program and if you use -client it will be run using client VM. Default is client.
    The main difference is the optimations. When you are running with -client option the program is optimized to startup faster and to give better response times.
    -server option optimizes for better resourse management which is important than start up time in server systems

  • Why can't I run my Java program with just the JRE, the JDK is required?

    I've recently written 3 programs in Java using the Netbeans IDE with JDK 1.6 as the default Java platform. The compile-time libraries include the Swing Application Framework. I use BuildDesk from ProductiveMe to package the each program into a Windows installer.
    When I install the programs on a new computer without a JRE or JDK being present, and attempt to run them I get an error (as expected) stating that there is no JVM. The messages says that I need to install JDK 1.3 or higher. I downloaded the latest JRE onto the new computer and attempted to run the programs and I get the same error message. My question is, why can't I run these programs with just the JRE installed? Why do I need the JDK? When I install the JDK, the programs run fine. The typical user may not have the JDK on their system, but they likely have the JRE if they've run Java programs before.
    Is the answer as simple as there must be library functions being used by the programs that belong to the JDK, but not the JRE? I'd rather a user not have to install the JDK verses the JRE because they may also have to update some Windows environment variables.
    Thank you for any help on this issue.

    915088 wrote:
    Thanks for your replies. I further investigated BuildDesk and found an option which allows a JVM check but that check needs the JDK. I stopped the JVM check and rebuilt using BuildDesk and it now only requires the JRE to run the programs. The reason why I use BuildDesk is to package more than just the jar file for the user. BuildDesk allows me to create a installation folder structure as well as include any other files in the build. I could just as well zipped all this together for the user but decided against that method.I don't think anyone will question your usage of an installer tool; that is entirely up to you. But what is questionable is that you have problems with that installer tool and then go look for help in a Java programming forum. The next time, go look for help at the source. If there is no way to acquire help (support, a forum, a mailinglist, anything) then that is a very good reason to not use the product in question.

  • Reg:Unix shellscripts running java programs

    hi,
    We are using unix shell scripts , by running that script it will execute some java programs.
    when we running shell scripts, which executes the programs it is generating some log files ie some error is occuring.
    i want to why these files are generating
    Thanks and Regards,
    Meer S.

    HI ,
    we are running the shell script which runs java programs,
    we are getting the result no problem ,
    but it is generating the unwanted ORBTRC files
    we are using websphere application server.
    we donot want these orbtrc files.
    HOW CAN WE DISABLE THE FILES
    pls guide this.
    Thanks and regards,

  • How can i run my java program with out java language

    Hai to every one ..Iam new to java language ...am using windows xp operating system , i did not installed java language in my system .. how can i run a java program with out installing java language... Which files is requied to run java program..?
    any one can help me??

    Hai to every one ..Iam new to java language ...am
    using windows xp operating system , i did not
    installed java language in my system .. how can i run
    a java program with out installing java language...
    you ... can ... not ... do ... this
    Which files is requied to run java program..?
    any one can help me??a JVM. Download it from sun's website.
    [url http://java.sun.com/javase/downloads/index.jsp]Download JavaSE here

  • How to run a standalone java program with JRC to display/run a report

    Hi All,
    I am new to this forum.
    I am trying to run a java program developed using JRC to run a report created using Crystal Report XI. I stucked because not knowing how to run that java program.
    Can anyone help me? or
    can give a simple java code to do the same.
    Thanks in advance.
    Saravanakumar.

    Hi Saravana
    For the steps to run a standalone application java program with JRC to display/run a report ,please refer the following link.
    http://support.businessobjects.com/communityCS/TechnicalPapers/cr_xi_r2_jrc_deployment.pdf.asp
    You can get the sample code for standalone/desktop applications from the following link.
    http://support.businessobjects.com/communityCS/FilesAndUpdates/crxi_r2_jrc_desktop_samples.zip.asp
    Please do revert in case of any queries.
    Thanks
    Soni

  • How to run java program from website?

    Hello
    I'd like to know how to run java program from my web page.
    I'd like to push some button in this web page so java program that would be on my server
    would pop-up. Can it be done automaticaly upon running this web site? (without any buttons - I just enter website and program pops up).
    Cheers

    I rather thought about RMI. But I could try servlets. So how it would look like?.
    I would make http request in browser (enter address) and program would show up in its window?. And I would not have to change anything in my program?. This program would run then on both boxes?. One remotely and one not?.
    But I would have to learn some basics, I've never worked with servlets. Could you suggest some good sites about it?. With ready examples so I could tweak them to my purpose.
    Message was edited by:
    macmacmac

  • Run java program overnight

    Hey,
    I left my office yesterday evening leaving my macbook on
    while it was running a java program that it's supposed to requires between 2 and 3 hrs.
    This morning not only the program was still running (hard to believe it takes more than 12 hrs!)
    but when I typed in the shell the 'ps -all' command
    it says the program has been running for around 30 mins, and now it's still running!
    Is it possible that with certain settings the mac stops its processes after a while?
    What should I check?
    Thanks for helping, I'm actually a newbie in the mac world:)
    g

    How many of the links here have you tried while you were waiting for an answer?
    http://www.google.com/search?q=running+java+program+as+windows+service
    (Note that the query is a direct copy/paste from your post.)

  • Run java program on linux

    Hi All
    I'm beginner with linux
    I have java program and I can run it in windows7 with bat file
    jre1.6.0_04\bin\java -classpath "..\classes"  database_com.Main_Class 7778
    pauseI want to run this program in linux but I can't
    I try run this program with bat file :
    /java-1.5.0-gcj-4.3-1.5.0.0/bin/java -classpath "../classes"  database_com.Main_Class 7778
    pauseplease help me

    Ora-dbaabode wrote:
    I want to run this program in linux but I can'tImagine you have a splitting headache and decide to go to the doctor. You come into his (or her) office and say, Doc, I'm not feeling to well. The doctor replies and asks, well, what seems to be the problem? You reply: "well, I just don't feel too good". See where I'm getting at (hint: missing details!).
    As for your JDK, I highly, no, I very highly recommend you get rid of GCJ and install Sun's JDK. This may very well be the source of your problems. GCJ is a pain in the @ss!

  • Can we able to run java program inside  javascript

    Hi all
    can we able to run java program inside javascript or integrate java with javascript.....whether its possible...

    No. You can't execute Java code from within a JS script in Acrobat/Reader.

  • Vim and Eclim (Java): Run Java program in embedded terminal window

    Hello all,
    I'm trying to create a decent Vim setup for Java programming. I've installed Eclim, and it works alright. However, one annoyance I have is the way that Eclim runs Java programs. When run (via the :Java command in Vim), a Java program runs in a new shell instance pretty independent from Vim, and then when the program terminates (and Enter is pressed), the output is put into a new buffer at the bottom of the Vim window with the output.
    The problem with this is that I must press Enter to go back to Vim after the program terminates, and then the output buffer is automatically selected even though I most likely do not care to copy any of the output.
    So, this is what I would like to happen:
    - I run my Java program somehow (doesn't have to be with :Java)
    - A buffer containing the running program in a shell is put on the screen (if not already there)
    - The program terminates, and the focus did not change to the output buffer
    At the very least, I want the focus to not change to the output buffer after the program is done running.
    Any ways to at least somewhat accomplish what I'm trying to  get at?

    Trent wrote:
    Yeah? I had AP CS when they first introduced the GridWorld case study. I hope you get more out of the class than I did.
    I have never used Java except for that and my first CS class at university. I eventually realized that software (as a job) wasn't for me and took a route closer to EE. I still fight to avoid being called a programmer though
    I like the idea of programming for a job, not necessarily "software development", something computer science-y sound good to me.
    But anyway, to end on an on-topic note, I embedded gvim inside Eclipse as described here.

  • Starting Java Program with a bash Shell script

    Hi !
    I know this is a Linux query but I am putting it on this site to get different answers.
    I want to start my Java program with a shell script. Can anybody give me a proper script to start my Java program?
    I am using RH Linux 7.3 and JDK 1.4.
    Can I start the Java program without starting the terminal? Just like the Sun One Studio4 'runide.sh' script.
    Please help.
    Bye Niteen

    assuming you have your PATH and CLASSPATH variables set correctly, your script should look like this:
    #!/bin/bash
    cd <project_dir>
    java <class> &
    example:
    #!/bin/bash
    cd ~/projects
    java project1.main_package.MainClass &
    of course you could add some more elaborated stuff like compiling files before running the program, etc.
    if you dont like terminals, try running "nautilus" (it's like Windows Explorer). i never use nautilus (especially for running scripts), so i cant guarantee it will work, although i dont see why it shouldnt...

  • Running java program at windows startup

    I need to run java program at startup and then it will continue to run in its own thread.
    Any body having idea how to do that programmatically?
    Zeeshan

    This is one option but this is not feasible in my scenario as this application will be running over a network which involves hundreds of computer so is there any way to do it programatically?
    I mean if I can load java class file through an exe file then I can load my class file in the startup using C++.
    Any Suggestions.
    thanks for the help
    regards,
    Zeeshan

  • How to Install crystal run time programs with out designer.

    Can anyone suggest me  how to install crystal run time program with out installing entire designer software.
    Is it coming along with CR software package, which we have to do custom install or is it coming as a different package.  
    Currently my client is using only the run time programs to trigger crystal  report from VB app but developers have installed entire software for development.  We need to figure out how this install can be done, as it was done long time before and folks who have done it left the company.  
    Any suggestion on this would be of great help to me.

    See this wiki:
    https://wiki.sdn.sap.com/wiki/display/BOBJ/CrystalReportsforVisualStudio.NETRuntimeDistribution-Versions9.1to12.0
    Ludek

Maybe you are looking for

  • Issue at the time of Down payment

    Dear friends I created one Down payment request for Rs.10000/- in F-47. When I am making the Down payment through F-48, system is allowing more than Rs.10000/- against the above Down payment request. Is there any control or any note to apply or any c

  • Dual boot Win7/Win8 not showing

    Hi, after installing Windows 8 parallel to Windows 7, Windows 7 loads without showing dual boot. But: dual boot shows when inserting the Windows 8 installation dvd (without booting from it, though!). I thought that maybe the problem is about two volu

  • Could not adjust InfoSet..

    Hello Experts, I have to enhance existing datasource which was extracted from SAP Query. However, I found that there was a problem with the infoset referred in the SAP Query. The system show messages that I need to adjust the InfoSet. Once I adjusted

  • How to covert .rdf(windows version) to .rep (Solaris) version

    Hi I have developed a report (.rdf) in windows. I want to deploy it in solaris machine. Application server is installed in the solaris machine only. I did the following and I received the following error bash-2.05$ /u02/oradata/data/APPS/bin/rwconver

  • Mpower// if i use 2 ssds in port 1&2 in riad 0 can i not use hdd in sata ports 3

    mpower// if i use 2 ssds in port 1&2 in riad 0 can i not use hdd in sata ports 3 4 5 6 as my hdd wont work does not show up in bios or windows// help help