How do you run another Java file from a master Java file?

We're making a game in Java at school, and we need to know how we can run a Java file from another one - like inside the master Java file, we need to have a command to run game.java (something like that). Thanks!

We're making a game in Java at school, and we need to know how we can run a Java file from another one - like inside the master Java file, we need to have a command to run game.java (something like that). Thanks!One doesn't "run a Java file", and there's no conventional definition of "master Java file". If you want to call the main() method of another class, just make sure the class is in your classpath and call the method. If you want to start up a separate JVM with that class as a process, use Runtime.exec() or similar method.
~

Similar Messages

  • How to run java programs from a master java program?

    Hello,
    I have several java programs which run from the command prompt. I am seeking help with code for starting java programs from within a java program. For example, a program called master.java works something like this:
    import java.*;
    create connection pool
    create variables and result sets
    start/run slave1.java (var1, var2);
    start/run slave2.java (var3, var4, var5);
    start/run slave3.java (var1, var4);
    end of program master.java
    Each of the slave.java programs will run for up to an hour. I do not want the master.java program to pause for each slave program to stop. Instead, the master program will keep running and multiple slave programs will be running simultaneously with the master program. When a slave program starts, it is on its own. Also, if possible, I would like to have each of these slave.java programs open in a new separate command window, so I can observe each slave program running in separate windows.
    Any suggestions for code or helpful documentation are greatly appreciated.
    Thank you,
    Logan

    Thank you all.
    At the bottom of master.java I have successfully started a batch file with these lines:
    String jcmd = "cmd.exe /c start c:/data/simulations/MsgViewCount2.bat";
    Process proc = Runtime.getRuntime().exec(jcmd);
    But I still cannot get a java program to start. Here is one variation I have tried:
    String [] cmdArray = new String[2];
    cmdArray[0] = "java";
    cmdArray[1] = "slave1";
    Runtime runtime = Runtime.getRuntime();
    Process process = runtime.exec(cmdArray);
    This compiles, and no errors occur, but nothing happens.
    Regarding this comment:
    Why Runtime.exec? Either make the slaves Runnable or
    just call their main() methods.
    Oh, I see. Sepearate output. :PNone of the slave.java programs have any output.
    Thanks again.

  • How do you run a (Word) Document from a Swing application

    I want to create a Word Document and then open it from a Swing application. If you can't do that directly, what else can you do to get that result.

    gwils wrote:
    How do you recover a word document on a macbook pro?
    Just as you do it on a Mac Pro or a Mac Mini.
    What version of Mac OS X? What version of MS Word?
    If you're thinking of the AutoRecover feature, you have to enable it first. If it was enabled, this
    <http://kb.iu.edu/data/ahnd.html#FindingfilesMac>
    will tell you what to do.

  • How do you run a PSD Action from Bridge?

    I have a droplet on my desktop. I was thinking of copying the file to the droplet. I have to inspect the name of each file before the action gets run. If it meets certain critirea. Then I need to run the action on that pic. Or thumbnail. Thanks in advanced for any words of wisdom. Is there a guide for Bridge JS?

    Here is another go at this. It is working however, my target of photoshop 13 quits working when I put it inside this loop. The result is it wants to open up CS5 PHOTOSHOP.
    I am not sure about that yet. here it is.
    #target bridge
    app.document.deselectAll();
    var thumbs = app.document.getSelection("*");
    for(var a in thumbs){
    var f =thumbs[a].name.slice(0,10);
    var poo=f.indexOf ("BW");
    if(f.indexOf ("BW")!=-1){
        var poop=app.document.select(app.document.thumbnail.children[a]) ;
        var thumb = app.document.selections[0];
        thumb.open();
        runAction();
    function runAction(){
        var bt = new BridgeTalk;
    bt.target = "photoshop","13";
    var crud="try{doAction('2012 Design BW','Design' );}catch(e){}";
    bt.body =crud;
    bt.send();}
    I am running this from the STK. I am not sure if it would help it to run from Bridge I might try that next.
    If you have any ideas I would love to hear them.

  • How do you maintain layers in pdf from layered PM6.5 file?

    I've tried exporting from PM6.5, but get only 1 layer in pdf.  I've tried converting the file using Acrobat 6, but apparently Acrobat 6 doesn't support .p65 files for this.  I exported to a postscript file which Acrobat 6 could open/convert, but still only got 1 layer.

    They did not and given PM’s need to use postscript to create PDF there is
    no way to do this since postscript doesn’t support layers.

  • How do you move a quicktime movie from one iphoto library to another?

    How do you move a quicktime movie from one iphoto library to another?

    1 - export it from Library A via the File ➙ Export ➙ File Export menu with Kind = Original.
    2 - import it into Library B as you normally would.
    OT

  • How do you move your music library from a laptop to a desktop? I have moved my library from a laptop to another laptop but can't figure out how to move music from laptop to desktop. Anybody know? Thanks

    How do you transfer your music library from itunes on a laptop to a desktop? I have transfered from one laptop to another and from desktop to laptop but can't figure out how to go from LAPTOP TO DESKTOP> Thanks

    Hello, Sandralee59. 
    Thank you for the question.  The attached article below provides multiple options for moving your iTunes library to a new computer. 
    iTunes: How to move your music to a new computer
    http://support.apple.com/kb/ht4527
    Cheers,
    Jason H. 

  • How do you change the background color from black to another color on i movie

    How do you change the background color from black to another color on i movie

    You post your question in the iMovie forum.

  • Is it possible to run host command from SAP environment? How do you run?

    Hi
    Is it possible to run host command from SAP environment? How do you run?
    Thank You

    Hello Subhash
    You will more details in the following thread:
    Re: How to define command for SXPG_COMMAND_EXECUTE
    Regards
      Uwe

  • How do you remove the SIM card from one iPhone 5 and place it in another?

    how do you remove the SIM card from one iPhone 5 and place it in another?

    With a paper clip?  Refer to the User Guide.

  • How do you move itunes with playlists from one computer to another

    how do you move itunes with playlists from a computer to ext hard drive, so it will play from the ext harddrive and not the computer

    Type "move itunes library to external hard drive" into the google search bar.

  • How to view file from vss using java Commandline

    Hi To ALL,
    I wanted to view a file from vss through java code.
    By using the folowing code,i could able to get vss file in to local folder.
    Runtime.getRuntime().exec
    ("cmd /c ss Get $/Mywork/Myfile.java -GLC:/New");
    But i wanted to view file from vss using java code.
    any one please help me..
    Thanks in advance.........

    As always, Google is your friend.
    Follow the bouncing link.
    http://www.google.com/search?hl=en&q=VisualSourceSafe+%2B+Java+API
    PS.

  • How do you find out what application is generating a plist file in your preference folder?

    I have had two similar warnings come up in Drive Genius 3, a program that I use to manage my drives.  The warnings occur during a daily verification of preferences on my main drive, a 256GB SSD. 
    They state:
    "The preference file at '/Users/me/Library/Preferences/com.analogsolutions.Football.plist' may be corrupted."
    "The preference file at '/Users/me/Library/Preferences/org.machinedevelop.National.plist' may be corrupted."
    Per Drive Genius' advisement, "Corrupted files can cause appplication crashes and should be moved to the Trash." I delete the files, however they are regenerated each day. 
    Q: How do you figure out what application is generating a preference file?  And is there a way to tell if this is a OS generated preference file? 
    I have searched online and cannot find any information about either Analog Solutions or Machine Develop nor am I able to discern what these particular .plist files are for... 
    Q: Are these two .plist files truly potentially harmful?
    Thanks for the Help!
    iMac
    model iMac12,2
    3.4 GHz Intel Core i7
    8 GB 1333 MHz DDR3

    Hi Everyone, sorry for the late response.  I have been monitoring my Preferences Folder; every moment I am on my computer trying to catch what application/process generates these files.  I was hoping to try your suggestions, but oddly enough the offensive .plist files have not returned since the last time I deleted them about a week ago.... strange...
    In any case, I have responded to some of your suggestions and questions that I have information on:
    X423424X wrote: Ok, can you double click the .plist file?  If so it should attempt to launch the Property List Editor (in your Utilities folder).  That way you can look at stuff in the plist.  Maybe (hopefully) there's something in there that can shed some light on who is creating it.   If Property List Editor cannot open the file (some apps create files that have the .plist extension but don't actually create the proper XML format -- probably what ProSoft was alluding to) then try opening it with a text editor.
    The .plist file when opened in text editor contains a string of (what to me seems to be) an arbitrary list of numbers.
    Linc Davis wrote: Those files have been given obfuscated names so you won't know what created them. They must contain encrypted registration data for some third-party commercial software that you use.
    Yes, seems likely...
    Linc Davis wrote: It should be fairly easy to find out what application is creating them, if you really care. Move the files to the Desktop, then log out. Log back in while holding the shift key as you click the "Log In" button. That will prevent your login items from loading, among other things. Open your account preferences and launch the login items one at a time by double-clicking them in the list. After each one, check to see whether the files have been recreated.
    Ran through login, one by one, no luck in identifying the application(s). 
    X423424X wrote: Another thought, lock the plists on the hope that whatever is using them will "choke" and complain about it (no guarantee that will work but worth a try).
    Thanks, the lock idea is the one I will try next if they ever reappear...
    X423424X wrote: Also, I don't recall if I asked this but if those plists are deleted while logged in will they be recreated during that same login session.  Or do they only appear after you deleted them and then and then logged out and back in?  Or do you have to reboot to recreate them?
    Unfortunately I do not know for certain.  Though from all my login/startup/reboot tests I believe that they are not directly linked to starting up the machine or loging in either.
    I'm not really certain why the .plist have not returned.  I haven't uninstalled any programs, though I did run a couple updates for some widgets within the last week; however that was about 3 days after I deleted the last set of .plist files and usually they reappered everyday.  In any case, given that they have not been regenerated I guess my problem is solved per se, at least I am no longer getting that annoying warning everyday.   Still, it's a bit of a mystery  
    Thanks again for all the help!

  • HT5246 How do you run the Flashback malware removal tool?

    How do you run the Flashback malware removal tool?
    Thanks

    I am away from my computer and it is somewhat awkward to reply on an iPad.
    > I had already done what softwater instructed. I've read that it deletes itself on other threads, but it's still in my Finder as a Device. That's what confused me, because it doesn't appear to have deleted itself.
    Sorry, I wasn't clear. That is not the tool. It is the .dmg image mounted to your desktop. Next to the name you will see a small eject icon. Click on it or highlight it and choose "Eject" from the appropriate Finder menu. Once that happens you can drag the .dmg file to the trash as it will not delete itself.
    > I only recently upgraded to Snow Leopard and then Lion, in quick succession. My understanding is that there were (are) variants that would have infected my computer prior to my upgrading my OS to Lion. Before the upgrade, they were Adobe, but afterward they were Java. Could it be that be that the pop-ups were/are some other variant?
    Difficult to say for certain. Apple says it deletes all the common variants but does not specify which and I haven't seen the results of any testing done to verify that it finds and deletes those. The only dialogs that appeared with the initial variants were for FlashPlayer. They are depicted in the descriptions for Flashback-A on F-Secures site if you want to take a look. There have been none that I am aware of for Java, so that is probably either a web page or application that needs Java to run giving you that alert.
    > If the Flashback malware removal tool didn't find anything and my Software Update is current, does that mean the vulnerability has been fixed? At least for now? I understand that I Software Update will prompt downloads in the future if and when it needs to be patched again.
    The vulnerability is in Java, nowhere else, so if you don't have it installed there was nothing to fix.
    If you download Java in the future it will be the latest version Apple has available at the time, which hopefully will not be subject to exploitation, yet...

  • How do you remove back up data from the memory storage? my storage data states that i have over 80gb of data used for back ups and i dont know why as i use a external hard drive as a time machine .now my 250gb flash storage is nearly full

    how do you remove back up data from the memory storage? my storage data states that i have over 80gb of data used for back ups and i dont know why as i use a external hard drive as a time machine .now my 250gb flash storage is nearly full.. HELP!

    When Time Machine backs up a portable Mac, some of the free space will be used to make local snapshots, which are backup copies of recently deleted files. The space occupied by local snapshots is reported as available by the Finder, and should be considered as such. In the Storage display of System Information, local snapshots are shown as  Backups. The snapshots are automatically deleted when they expire or when free space falls below a certain level. You ordinarily don't need to, and should not, delete local snapshots yourself. If you followed bad advice to disable local snapshots by running a shell command, you may have ended up with a lot of data in the Other category. Ask for instructions in that case.
    See this support article for some simple ways to free up storage space.

Maybe you are looking for

  • My Back up is no longer there! Help me!

         After updating to the worst update of my phones life, ios5. I instantly couldnt receive any text messages.. It kept saying my sms inbox was full.. now I know thats impossible because I had used not enough half of the memory. So I tried everythin

  • My itunes 7 wont open at all

    I have recently downloaded the latest version of iTunes 7 and when i try to open it, it comes up with an error saying itunes has encountered an error and needs to close. Nither itunes or the standalone version of quick time seem to work. Can you help

  • Exception calling "ExecuteNonQuery" with "0" argument(s): "CommandText property has not been initialized.

    I have CSV file  which has sdimiler  data I am inserting those  date to desinated table and while executing this  query mentioned below I get error mentioned in TITLE insert into SU_EDIT_DETAIL(EDIT_FUNCTION, TABLE_FUNCTION, CODE_FUNCTION, CODE_TYPE,

  • How about an evaluation extension until there's a quality release?

    Adobe: Are you seriously expecting me buy CFB with so many bugs? I can't wait to become a fan of CFB, and I'll happily pay the money to buy it. But I'm not going to be happy if I have to fork over $300 for a product that won't even let me edit longs

  • Tax condition table for an access sequence

    Hi, I serched in the forums to find t.code or menu path for creating a tax condition table for MWST tax condition type, but no body has given any specific answer.  most of them have given the SD or MM related condition tables. My requirement is, I wa