How can I open a program using Java and then perform certain tasks with it?

For example, and this is just an example, I want to write a Java program that opens MS Paint and then manipulates that program. This can be useful to automate certain tasks.
My question is whether this can be done writing Java code and if so how? If not possible, would I need to use a scripting language instead?

write a Java program that opens MS Paint and then
manipulates that program. This can be useful to
automate certain tasks."manipulates" is a too wide term. Let me narrow down:
1. If you want to open (run) the program and then shut (kill) it down it is possible and fairly trivial to do in java. Look up Runtime and Process classes in java.lang package
2. If you want to open the program and edit some image/document in the opened program. It is very difficult in java. May be possible... using some Java/COM bridge, assuming your native program is COM/Active-x compliant. Note: these things go beyond the boundary of JVM and needs to interact with host OS and involves shared memory, ipc and all "low level" stuffs.
If you want to be able to play around with these COM/Activex apps- choose .NET instead :-)
3) You can open the program from java and pass it some command line arg as in (1) above and then the program will load that document/image at startup automatically. You may then edit the doc/image thru that program itself. However, Java is not doing anything for you here, other than just starting off your native mspaint.exe ot notepad.exe.
-BJ
Message was edited by:
Bimalesh

Similar Messages

  • How can we open any file using JAVA...

    Hi all
    i trying to make code in that code i choose a file using a filechooser then put that file name in FILE object like (File file = fileChooser.getSelectedFile();)
    but the thing is how can i open that file for example if that file is HTML file then opens in IE or if that file is MS Word document that open in Word, like that
    is there any suggestions
    Thanx
    Regards
    Satinderjit

    start is a windows command-line utility.
    start foo.doc will start Word (or Star Office or Word Perfect or whatever is registered for the .doc extension),
    start bar.htmnl will start your registered browser etc.

  • How can i install any program using java code

     
    Hi friends,
    i want to know how can i install any software using c# code.

    Hi,
    You may change your title, Since this is C# forum.
     >>i want to know how can i install any software
    usingc# code
    So what kind of your software?
    In C#,we can install and uninstall "*.msi" files (setup).
    The code to install software without user interface is:
    private void installSoftware()
    Process p = new Process();
    p.StartInfo.FileName = "msiexec.exe";
    p.StartInfo.Arguments = "/i \"C:\\Application.msi\"/qn";
    p.Start();
    For more detailed information, please refer to article
    C# - Installing and uninstalling software in codeproject.
    Best regards,
    Kristin
    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.
    Click
    HERE to participate the survey.

  • How can I run other programs using java program

    hi experts,
    I am trying to execute a set of commands from java program
    eg: from command prompt
    java CommandExecutor c:\winnt\notepad.exe c:\some.exe c:\onemorecommand.exe
    and inside the CommandExecutor main method..
    public static void main(String []arg)
    for(i = 0; i < arg.length; i++)
    Runtime.getRuntime().exec(arg(i));
    the above code is executing all the command one after the other, but I want to execute the above commands squentially, i.e I want to execute the second command only after finishing the first command and the third after finishing the second and so on depending upon the arguments passed, how can I acheive this...
    I have tried to use the Process which is returned by the exec(arg) method but the exitValue() returns same value before execution and after execution.
    thanks,
    krishna

    Did you try to get the process returned and then try
    process.waitFor() method. This waits for the process to finish.
    After that try the next execution

  • How can i open the popup from java class

    Hi,
    Please tell me how can i open the popup from java class.
    I am using jdev 11.1.1.7.0
    I have used the below code which works fine in jdev 2.1 but it will have some errors in 11.1.1.7.0.
    Please tell me some way to do this in all jdev versions.
    Bean obj = (Bean)RequestContext.getCurrentInstance.getExternalContext.getPageFlowScope(“obj”);
    Code for hide pop-up
    FacesContext context = FacesContext.getCurrentInstance();
    String popupId = obj.getPopUpBind().getClientId()
    ExtendedRenderKitService service = Service.getRenderKitService(FacesContext.getCurrentInstance(),
    ExtendedRenderKitService.class);
    String hidePopup = "var popupObj=AdfPage.PAGE.findComponent('" + popupId +
    "'); popupObj.hide();";
    service.addScript(FacesContext.getCurrentInstance(), hidePopup);
    Code to Show pop-up
    StringBuffer showPopup = new StringBuffer();
    showPopup.append("var hints = new Object();");
    showPopup.append("var popupObj=AdfPage.PAGE.findComponent('" +
    obj.getPopUpBind().getClientId() + "');popupObj.show(hints);");
    service.addScript(FacesContext.getCurrentInstance(), showPopup.toString());
    Code need to be added in jsff pop tag
    binding="#{pageFlowScope.bean.popUpBind}
    Variable need to be added in Bean.java
    private RichPopup popUpBind;

    Hari,
    Since you're using a non-public build of JDeveloper, you should be using a non-public forum.
    John

  • How can we prevent back button  using java script

    how can we prevent back button using java script

    Would be quicker for you to google for javaScript
    javascript:window.history.forward(-1);

  • How can I open websites that use adobe flash ?

    How can I open websites that use adobe flash ?

    The website should open, but the Adobe Flash will not work as there's no Flash plug-in for mobile Safari.
    After some failed attempts by Adobe to work out Flash for iPad, Apple decided to forgo it, and Steve Jobs published a famous letter on the reasons why Apple would not be supporting Flash on iPad.
    The fall, Adobe announced that they were abandoning Flash on all mobile platforms, including Android, and they have deprecated the use of Flash as a plug-in on Desktop platforms. Flash will be moving to become a platform for development of cross-platform desktop applications and HTML5 will replace it for web and mobile purposes.
    Web sites that still use Flash will slowly move away from the technology in the next few months. Most web sites that expected traffic from mobile device users have already moved away from using Flash.

  • How can i get system variable using java

    Hi,
    I just want to know how can i get system variables using java code.
    for example i want to get the the date for today or i want to get the number of processes that's running.
    Thanks alot

    Hi,
    I just want to know how can i get system variables
    using java code.
    for example i want to get the the date for today or i
    want to get the number of processes that's running.
    Thanks alotSome generic "system variables" are available though Java, usually through the System class.
    Date today = new Date();
    is instantiated with the current date and time.
    Other system values, like environment values, should be passed to java through the command line (-D option) by setting system properties.
    Finally, platform specific values like the number of processes running will have to be written in platform specific code and executed by JNI (java native interface).
    Java is platform or system agnostic. Common system values, like time, are implemented. Hopefully you won't need platform specific values.

  • How can I build Instalation Program for java applet?

    I want to build on line internet game based on java applet.
    Uset must instull the game to his computer.And this program mast Connect to the server when user enter
    to this application.Not from explorer,but from my application,like when i enter to ICQ.
    My questions:
    How can i build instalation program in java?
    How can i connect to the server when user enter into my game not from explorer but from game?
    Thanks,Maya.

    Hi Maya
    First of all an Applet does not have to be "installed" as you would with a normal application. The browser handles the install and execution of the applet.
    Check out this URL for more about applets:
    http://web2.java.sun.com/docs/books/tutorial/applet/index.html
    On the subject client/server pairs - see:
    http://web2.java.sun.com/docs/books/tutorial/networking/sockets/index.html
    If you decide to make the game an application instead check out Sun's WebStart - under the products section.
    That's about all the help I can give you.
    Programming a game is a complicated subject - I am doing one too:
    http://hjem.get2net.dk/mhjembaek/armageddon/
    Kind reg,
    Hjembaek

  • How can i transfer my rarely used applications and files so i can make room on my computer harddrive?

    how can i transfer my rarely used applications and files so i can make room on my computer harddrive?

    Well the applications you should leave alone as they install files elsewhere that are needed like preferences etc that won't be on the external drive if you attempt to run it from there.
    Some programs are completely self contained and will run just fine from a external drive, but applicaiton's are usually small.
    Now your user files! That could use some thinning for sure! Especially stuff you don't use that often and Video files which take up a lot of space.
    You can buy a external USB drive at any office / computer supply store and just plug it in and backup files via drag and drop.
    What happens when you plug in a drive is TimeMachine will pop up and ask to make it a TimeMachine drive, this just backups up everything on your computer to restore from in case your OS X or boot drive fails. It's a image of your drive and so whatever is on the boot drive is on the TM drive. So that doesn't server your purpose which is you want to free some space off your main boot drive.
    However you should get another drive and allow TM to do it's thing to that drive, also to make a hold option bootable clone of your boot drive (using yet another external drive) using Carbon Copy Cloner or SuperDuper so in case your boot drive fails you can quickly and easily boot off the clone and have a working machine right away.
    One of the posters here has a excellent instructions what does what, both should be used to backup your data.
    http://web.me.com/pondini/Time_Machine/Clones.html

  • Hello. I have a Mac i7 2.3 Ghz 16GB RAM. OS 10.9.5. I can not open any program. AE and Premiere. I upgraded but nothing happens. because. thanks. Ben

    Hello. I have a Mac i7 2.3 Ghz 16GB RAM. OS 10.9.5. I can not open any program. AE and Premiere. I upgraded but nothing happens. because.
    thanks
    Ben

    Ben do you receive any specific error messages?   Were you able to apply the updates successfully?

  • Can I upgrade to OS X Lion, and then reformat my computer with the OS X CD?

    Can I upgrade to OS X Lion, and then reformat my computer with the OS X CD? Because if I reformating my mac with the regualr OS X CD, would that erase the Lion? Since I just donwloading the Lion, and don't really have a CD for it.

    If you install Lion then erase the drive that will erase Lion. To purchase and download Lion you must first install Snow Leopard 10.6.6 or later to access the App Store where you purchase and download the Lion installer. You might read this before:
    Make Your Own Lion Installer
    1. After downloading Lion you must first save the Install Mac OS X Lion application. After Lion downloads DO NOT click on the Install button. Go to your Applications folder and make a copy of the Lion installer. Move the copy into your Downloads folder. Now you can click on the Install button. You must do this because the installer deletes itself automatically when it finishes installing Lion.
    2. Get a USB flash drive that is at least 8 GBs. Prep this flash drive as follows:
    Open Disk Utility in your Utilities folder.
    After DU loads select your hard drive (this is the entry with the mfgr.'s ID and size) from the left side list. Note the SMART status of the drive in DU's status area.  If it does not say "Verified" then the drive is failing or has failed and will need replacing.  SMART info will not be reported  on external drives. Otherwise, click on the Partition tab in the DU main window.
    Under the Volume Scheme heading set the number of partitions from the drop down menu to one. Set the format type to Mac OS Extended (Journaled.) Click on the Options button, set the partition scheme to GUID then click on the OK button. Click on the Partition button and wait until the process has completed.
    Select the volume you just created (this is the sub-entry under the drive entry) from the left side list. Click on the Erase tab in the DU main window.
    Set the format type to Mac OS Extended (Journaled.) Click on the Options button, check the button for Zero Data and click on OK to return to the Erase window.
    Click on the Erase button. The format process can take up to several hours depending upon the drive size.
    3. Locate the saved Lion installer in your Downloads folder. CTRL- or RIGHT-click on the installer and select Show Package Contents from the contextual menu. Double-click on the Contents folder to open it. Double-click on the SharedSupport folder. In this folder you will see a disc image named InstallESD.dmg.
    4. Plug in your freshly prepared USB flash drive. You are going to clone the InstallESD.dmg disc image to the flash drive as follows:
    Open Disk Utility.
    Select the USB flash drive from the left side list.
    Click on the Restore tab in the DU main window.
    Check the box labeled Erase destination.
    Select the USB flash drive volume from the left side list and drag it to the Destination entry field.
    Drag the InstallESD.dmg disc image file into the Source entry field.
    Double-check you got it right, then click on the Restore button.
    When the clone is completed you have a fully bootable Lion installer that  you can use without having to re-download Lion.

  • How can i open "my computer" in java

    How can i open ]my computer[b in java                                                                                                                                                                                                                       

    Two options:
    1) Execute
    Runtime.getRuntime().exec("explorer.exe ::{20D04FE0-3AEA-1069-A2D8-08002B30309D}");2) Look at javax.swing.JFileChooser
    The first option will do what you want, but it is specific to Windows only (I tested it on XP, I don't know if it'll work on other versions). The second is cross-platform, but won't give you the same view as a native explorer.

  • How can i open two chanel use JMF?

    i want have a capture card. if have four chanel.
    how can i open four camera in the same time?
    does JavaTV can do that?

    When you are in one app, press the home button and open another app. You can't see more than one app at a time, but you can have as many open as memory will allow.
    To quickly switch between the apps, double-click the home button. Active apps will be shown in the order you last used them. You can slide the active bar to see more of recent apps.

  • How can i generate BARCODE Images using JAVA Code

    Hello ,
    My requirement is to generate BarCode Images to Print using JAVA Code.
    User will give only
    1) String.as Input Parameter and
    2) Type of Encoding you want to apply on to the String.
    outPut : code should generate Bar Code Images as per the requirements.
    can any one help me out with jars ????? or any link which can provide me start.

    1) I have requriement like generate doc file with
    more than one barcode image on that document.???
    So?
    If your chosen "doc file" format supports inclusion of multiple images there's no problem.
    If it doesn't, choose another format.
    2) I am able to generate .doc file but in which
    format i should open that doc file.????
    The same format you used to create it.
    3) Main thing is how can i put more than one barcode
    image on that doc file????
    That would depend on the file format and the API used to create it.
    is any one faced the same problem or gone through
    same requirement.
    Almost certainly. And they solved it too, given the document I'm looking at right now which is an e-ticket for an airline that has many barcodes and other generated images on it.
    So keep on trying, grasshopper, and you may find enlightenment.

Maybe you are looking for

  • How to use Swing Components in  JavaFX

    Hi All, I am new to JavaFx. I am trying to use java swing components in javafx. I found a sample program in net and tried it. But it shows compile time error. Code: MySwingComponent .fx import javafx.ext.swing.SwingComponent; import javax.swing.JComp

  • Authorization Issue in creating HR Master data through PA40

    Hi, I am facing an issue while creating HR master data thru PA40. On the first screen, I select Action Type Hire, put personnel area IN01,EE Group 1, EE Subgroup N2 and Execute. It takes me to the next screen. there I put all the information required

  • LaunchCast (Yahoo) on the Mac

    Someone must know a way to make this work? LaunchCast is great, but if I cant access it on my mac, what's the point? I know that they say only PCs and Mac OS9 work, but some smart mac addict must have figured out a way around this. Anyone . . . . Bue

  • Grays Appear Brown in CS3

    Greetings, I have Adobe CS3 Design Standard with PS, AI, AA, etc I recently started using it and discovered that there is a color setting issue: my grays appear in shades of brown. Wow, that's weird. I have Googled the issue, but have not discovered

  • 1/2 thru the downloading process, I am prompted to close IE but it is already closed

    Hello - I received a prompt telling me that I didn't have Adobe Flash Player installed on my computer (it had to have been installed on my computer last night; otherwise, I wouldn't have been able to play the computer games that I do).  While trying