Command Prompt Problem

Hi everyone, I'm new to Java and I'm using version 6, on windows vista to compile and run some code. Out of nowhere though, after it had been working fine, every time I run the file (after it has compiled just fine with javac), it has simply opened up the notepad with the text i typed, essentially it just opens up the file and does not run the program. please help!!!

Create a batch file (*.bat) on notepad. Quick and simple.
Sample:
@echo off
java name
pauseName should obviously be whatever the class file name is. If you want to run Sample.class, you type in java Sample.
By the way, @echo makes it so you don't see the commands and pause puts the "Press any key to continue..." part at the end. If you don't put pause at the end, the window will just close by itself.
Edit: Put the batch file with the .class file. If the .class file is in Folder A, put the .bat file in Folder A. If you don't, it will begin to run, but it wont find the .class file.

Similar Messages

  • Sound problem and command prompt problem

    hi
    My new cq40 610tu compaq laptop works with only left side speaker is it build with only one left side speaker?  Is there no dual speaker?  But with head phone two headphone speaker works properly.  tell me details.
    another problem when we open command prompt in winxpSP2 it is not stable after few seconds it turns off automatically.  When I type large things in ms word 2003 cursor goes different place automatically.  whats the problem? 
    I purchase this laptop just 15 days ago.  What's the solutions?
    thanks
    Dhiman

    Hi kbzone,
    ... there should difinitely be no sparks  ) I recommend that you start with checking the wiring ... is the computer connected to earth, is the amplifier? Are they connected via the same power socket? Are you sure that the amplifier is OK?
    Then, will it be possible to have any sound from the card if the amplifier is not used? You can try removing cards, uninstalling drivers and then re-install ...
    It is well possible that by now you have damaged your soundcard, btw
    Hans

  • TS4123 I have problem with iTunes story (secure link to itunes store failed). I make In the "Command Prompt" screen, type in   netsh winsock reset the itune story is solve but after i close itunes the problem is back

    I have problem with iTunes story (secure link to itunes store failed). I make In the "Command Prompt" screen, type in   netsh winsock reset the itune story is solve but after i close itunes the problem is back

    The results show that you have a proxy server set and this can often cause problems with iTunes.
    The proxy setting can be accessed in Internet options>>Connections>>LAN Settings.
    Try un-checking the proxy server check box.
    It might also be a good idea to run a malware check if you didn't know you had the proxy server set.
    You can download a free version of an excellent scanner- Malwarebytes here:
    http://www.malwarebytes.org/

  • Problem in executing command prompt commands through application

    Hi,
    I am facing issue in executing commands through VC++ application.
    My application is a dialog based MFC application in VS2008.
    I want to execute below commands programmatically.
    devenv D:\TestApp\TestApp.sln /rebuild release
    devenv D:\TestApp\TestApp.sln /rebuild debug
    But I am not able to set the current directory path as "D:\TestApp\" programatically.
    Through which API I can execute multiple commands on command prompt programmatically same as  we do manually on cmd.
    Please Help.
    Thanks in Advance. 
    Thanks & Regards, Mayank Agarwal

    I want to execute below commands programmatically.
    devenv D:\TestApp\TestApp.sln /rebuild release
    devenv D:\TestApp\TestApp.sln /rebuild debug
    But I am not able to set the current directory path as "D:\TestApp\" programatically.
    Through which API I can execute multiple commands on command prompt programmatically same as  we do manually on cmd.
    Why can you "not able to set the current directory path as "D:\TestApp\" programatically"? Are you forgetting to escape the backslashes?
    Why to you need to set the current directory anyway?
    What is the problem with executing multiple commands?
    As to your basic goal, have you looked at
    system()
    ShellExecute()
    ShelExecuteEx()
    CreateProcess()
    ? Perhaps you should show us what you have tried.
    David Wilkinson | Visual C++ MVP

  • Problem during executing Command Prompt

    Hi All
    My current code is executing system commands through java programme,like �dir�,�date� itc.Whenever I run the code the desired output comes.But when I am running the code continuselly then lots of command prompt open regularlly.
    Is there any way to stop the code from execution untill unless the command prompt get closed manually?Here is my code.
    import java.io.BufferedReader;
    import java.io.InputStreamReader;
    import java.io.IOException;
    interface IPerlService
         public String BZMCreateZone(String s);
         public int BZMRenew();
    public class Sample
         public void BZMCreateZone()
              Runtime runtime;
              Process process;
              String s=null;
              String str=null;
              try
                   runtime = Runtime.getRuntime();
                   process =runtime.exec("cmd /c start dir");
                   str=process.toString();
              try
                   process.waitFor();
                   catch (InterruptedException e)
                   e.printStackTrace();
                   BufferedReader reader = new BufferedReader(
                   new InputStreamReader(process.getInputStream()));
              s = reader.readLine();
              catch (IOException ex)
                   ex.printStackTrace();
         public static void main(String[] args)
              Sample obj_Sample= new Sample();
              obj_Sample.BZMCreateZone();
    }

    I want to execute below commands programmatically.
    devenv D:\TestApp\TestApp.sln /rebuild release
    devenv D:\TestApp\TestApp.sln /rebuild debug
    But I am not able to set the current directory path as "D:\TestApp\" programatically.
    Through which API I can execute multiple commands on command prompt programmatically same as  we do manually on cmd.
    Why can you "not able to set the current directory path as "D:\TestApp\" programatically"? Are you forgetting to escape the backslashes?
    Why to you need to set the current directory anyway?
    What is the problem with executing multiple commands?
    As to your basic goal, have you looked at
    system()
    ShellExecute()
    ShelExecuteEx()
    CreateProcess()
    ? Perhaps you should show us what you have tried.
    David Wilkinson | Visual C++ MVP

  • Problem with executing java on command prompt

    Hi my program uses java mySQL connector to connect to a local host. The program works fine when i run through netbeans. But when i run through command prompt it gives in this error message
    java.lang.ClassNotFoundException:com.mysql.jdbc.Driver Can anyone help me to solve this problem

    add mysql.jar file to ur classpath, it will work fine.

  • Problem with JUnit Testing from Command Prompt

    Hi There,
    Related Info:
    OS - Windows 7 32 Bit, IDE Used: Eclipse
    I'm using the following command to compile the java file from the command prompt:
    C:\Users\J\Desktop> javac -classpath .:junit.jar check4PrimeTest.java
    I get the error: "package junit.framework does not exist import junit.framework.*;"
    How can i fix this?
    I have downloaded junit from junit.org the 'junit4.10' and extracted in my Java Folder along side jdkjdk1.7.0_03, jre6, jre7.
    I will post my code below for the 'check4PrimeTest.java' file which im trying to test from the command prompt.
    package check4prime;
    // check4PrimeTest.java
    //Imports
    import junit.framework.*;
    public class check4PrimeTest extends TestCase {
         //Initialize a class to work with.
         private check4Prime check4prime = new check4Prime();
         //constructor
         public check4PrimeTest (String name) {
              super(name);
         //Main entry point
         public static void main(String[] args) {
              System.out.println("Starting test...");
              junit.textui.TestRunner.run(suite());
              System.out.println("Test finished...");
         } // end main()
         //Test case 1
         public void testCheckPrime_true() {
              assertTrue(check4prime.primeCheck(3));
         //Test cases 2,3
         public void testCheckPrime_false() {
              assertFalse(check4prime.primeCheck(0));
              assertFalse(check4prime.primeCheck(1000));
         //Test case 7
         public void testCheck4Prime_checkArgs_char_input() {
              try {
                   String [] args= new String[1];
                   args[0]="r";
                   check4prime.checkArgs(args);
                   fail("Should raise an Exception.");
              } catch (Exception success) {
                   //successful test
         } //end testCheck4Prime_checkArgs_char_input()
         //Test case 5
         public void testCheck4Prime_checkArgs_above_upper_bound() {
              try {
                   String [] args= new String[1];
                   args[0]="10001";
                   check4prime.checkArgs(args);
                   fail("Should raise an Exception.");
              } catch (Exception success) {
                   //successful test
         } // end testCheck4Prime_checkArgs_upper_bound()
         //Test case 4
         public void testCheck4Prime_checkArgs_neg_input() {
              try {
                   String [] args= new String[1];
                   args[0]="-1";
                   check4prime.checkArgs(args);
                   fail("Should raise an Exception.");
              } catch (Exception success) {
                   //successful test
         } // end testCheck4Prime_checkArgs_neg_input()
         //Test case 6
         public void testCheck4Prime_checkArgs_2_inputs() {
              try {
                   String [] args= new String[2];
                   args[0]="5";
                   args[1]="99";
                   check4prime.checkArgs(args);
                   fail("Should raise an Exception.");
               } catch (Exception success) {
                   //successful test
         } // end testCheck4Prime_checkArgs_2_inputs
         //Test case 8
         public void testCheck4Prime_checkArgs_0_inputs() {
              try {
                   String [] args= new String[0];
                   check4prime.checkArgs(args);
                   fail("Should raise an Exception.");
              } catch (Exception success) {
                   //successful test
         } // end testCheck4Prime_checkArgs_0_inputs
         //JUnit required method.
         public static Test suite() {
              TestSuite suite = new TestSuite(check4PrimeTest.class);
              return suite;
         } //end suite()
    } //end check4PrimeTestEdited by: 963042 on Oct 3, 2012 8:57 PM
    Edited by: 963042 on Oct 3, 2012 10:07 PM

    963042 wrote:
    C:\Users\J\Desktop> javac -classpath .:junit.jar check4PrimeTest.javaThat's the Linux way to do it. On windows there is a different list separator. Use this:
    javac -cp .;junit.jar check4PrimeTest.java
    And use -cp to save you some typing ;) If you want to incorporate unit testing into your builds I would suggest looking into automating it a little more through tool such as ant, maven, etc.

  • Command prompt window problem

    Hi,
    Can anyone tell me how to open a command prompt window from a Java GUI application? The application is started as a excutable JAR file and there is no command prompt window showing up in the beginning.
    Thanks a lot
    Wenly

    Thank you guys, I have checked the doc and it seems the Runtime.getRuntime().exec(); will start a seperated process.What I need is to open a command prompt window in the same process of my application and display message on it by using System.out.println()
    Is it possible?

  • Query running on sql commands prompt not running on report region

    Hi All,
    Facing a weird issue now. I have written a report query which is running absolutely fine in sql command prompt but when i trying to run this as a report it is just processing and the report is not loading. What could be the reason behing this?
    Thanks in Advance
    Regards

    Hi,
    With no other information about the problem is hard to know what's happening. If you could at least provide us with the query then I think it would be easier for us to help you.
    Regards,
    Sergio

  • How to run a program as an administrator from within a non-elevated command prompt?

    I have a project that is going to be running on a kiosk, and the user that is running the kiosk software is going to be restricted.  I have an alternate administrator account, but I cannot seem to figure out how to open my program running as this administrator
    user.  I have tried to use runas, like so:
    runas /user:admin kiosk.exe
    However, when I try to run this command, it asks me for the password of the administrator account and my program doesn't open correctly.  It fails to open at all.  If I change the run as to a start command, then the program executes fine so its
    not a problem with my software.
    Is there a way to pass a password parameter to runas so that it will not prompt for the password every time?  If there is not, can someone think of another way for me to elevate my process to administrator without being logged in as one through the
    command prompt?

    Hi KevinGEAR,
    You want to allow the others without the administrator`s level to run this software and  meanwhile the administrator is not logged in, right?
    Here is an alternative solution :
    1.To work with this solution, a built-in administrator account should be enabled and meanwhile you can create a standard account. The built-in administrator account is different from the administrator account you created.
    To enable built-in administrator account:
    Ways to Enable / Disable the Built-In Windows 7 Admin Account
    http://social.technet.microsoft.com/wiki/contents/articles/3040.enable-disable-the-local-hidden-built-in-administrator-account-in-windows-7.aspx
    2. Use the following code
    runas /user:ComputerName\Administrator /savecred "Full path to program's exe file"
    Here is a link for reference:
    Elevated Program Shortcut - Create for Standard User
    http://www.sevenforums.com/tutorials/193743-elevated-program-shortcut-create-standard-user.html
    NOTE: This response contains a reference to a third party World Wide Web site. Microsoft is providing this information as a convenience to you. Microsoft does not control these sites and has not tested any software or information found on these sites.
    Best Regards

  • Test Execution hangs while executing a test from Command prompt option

    I have done the following
    1) Created a script Test driver
    2) Added different scripts as Script->Properties->Assets to the driver script
    3) Call each of this asset script from TestDriver using command getScript("<<ScrptName>>".run(1, true, true, true);
    4) Now calling this TestDriver script from command prompt with command
    e:\\OracleATS\\agent
    runScript.bat E:\\INTEGRATION_SERVICES\\Identity_management\\Automation\\Scripts\\MasterScripts\\TestDriver
    TestDriver.jwg
    The script execution hangs at "Initializing VU 1 for Script TestDriver. After few mintues of seeing this message i get error "Execution Timed Out".
    Do I need to keep openscript UI open for script execution from command line ?
    Is there any way to increase this Execution Time out ? May be it is taking time to load the internal script assets. AS other scripts are running fine on the same machine from command prompt itself.
    Complete error is as follows
    C:\Documents and Settings\oracle>e:\\OracleATS\\agent\\runScript.bat E:\\INTEGRATION_SERVICES\\Identity_management\\Automation\\Scripts\\MasterScripts\\TestDriv
    er\\TestDriver.jwg
    Running "TestDriver" ...
    Agent started. Available commands:
    stop - Stop the virtual user after it finishes the current iteration.
    abort - Abort the virtual user cleanly, before it finishes the current itera
    tion.
    exit - Terminate the process immediately
    You may type the above commands at any time.
    12:17:53,418 INFO [1] Initialized script service "oracle.oats.scripting.modules.utilities.api.UtilitiesService"
    12:17:53,418 INFO [1] Initialized script service "oracle.oats.scripting.modules.browser.api.BrowserService"
    12:17:53,418 INFO [1] Initialized script service "oracle.oats.scripting.modules.functionalTest.api.FunctionalTestService"
    12:17:53,465 INFO [1] Initialized script service "oracle.oats.scripting.modules.webdom.api.WebDomService"
    12:17:53,856 INFO [1] Initialized script service "oracle.oats.scripting.modules.datatable.api.DataTableService"
    12:17:53,856 INFO [1] Initializing VU 1 for script TestDriver
    Execution Timed Out.

    Hi e_raja_sekar,
    You wrote:
    public static void main(String args){should be
    public static void main(String args[]){Granted, the below code was tested on Windows XP using J2SE SDK 1.4.1_02 (and not 1.2.2 like Sridhar is using), but when I compiled and executed this code:
    public class BadMain {
      public static void main(String args) {
        System.out.println("Hello World");
    }The output I got was:
    Exception in thread "main" java.lang.NoSuchMethodError: mainSo I don't think this is Sridhar's problem (but I could be wrong) since he says that he gets no error message.
    Cheers,
    Avi.

  • Vista bootmgr compressed VISTA - need command prompt!

    I am at wit's end and even though my 8 year old bought his HP G60 with his own money, I am about to hurl it out the window as I wasn't "consulted" and would not have condoned this unfamiliar to me Vista O/S.
    All I wanted to do was reset the computer/system to factory defaults.  He is gaming now a few years later with nothing important and seemed the quickest way to clean up the PC.  I create recovery disks, a NICE LITTLE PROCESS that took 3 entire days.  NO JOKE.  I had to place every few hours COLD PACKS under and on it because this thing from day one runs hotter then heck. 
    So voila, it's done.  And reboots.  And I hope there is some other bored GEEK reading this because I can't find ONE POST on the entire Al Gore Internet that gets me to a command prompt without using install disks.  This HP shipped with no install o/s disks.  I created the recovery as a safety net, and it's starting over AGAIN and personally, I don't have 3 more days and hot pack maintenance in me before I just buy a new one.  PLEASE HELP.  It seems simple enough to get to a command prompt and uncompress something I never even intended to compress nor did in any keystroke of my imagination.
    He is losing faith in his mother who he believes created MPLS....  got a network problem, I'm your gal.  Word won't load, call IT.  Windows XP has an issue, UNIX, learning Win7... but this Vista?  grrrrrr.  Where's the wine for my WHINE?

    I guess I only said it in the subject. boot gets BOOMGR is compressed. Press Control Alt Del to restart. Tried the normal ways to boot and get into some start up, but seems I need a command prompt to uncompress...

  • Strange command prompt on iPad2 screen

    My iPad 2 has taken a battering in 2 years, but despite the cracked screen, the headphone jack that no longer works and the wifi that has to be ontop of the router to pick up the signal, it still works.  Today, one of the children dropped it on the floor (it has a hard candy case on it), I picked it up and put it back on charge (it was at 1% or so).  10 minutes, 20 minutes later it still has the battery with the red line on it, and won't do anything.  I tried turning it off, I tried the off button and home button at the same time.  Nothing.  if I pull out the cable, it registers that I need to charge the iPad and when I plug it back in, it looks like it is charging, but clearly isn't (with the ipad charger that came with it, that charges son's iPad just fine).  Then, all of a sudden the apple is on the screen and there are 4 lines of command prompt type writing in white on the screen.
    Anyone any idea at all what is going on? 
    It is regularly plugged into the TV so we can watch movies on the big screen, I wonder if the charging port has been damaged?  I had the same problem with my iPod last year, stopped being able to sync it and then not even charge it.  The TV cables came from apple.
    I've investigated getting the other problems fixed, by when I add up all the costs I'm looking at it being cheaper to buy a new one altogether!

    elizabeth160 wrote:
    Today, one of the children dropped it on the floor (it has a hard candy case on it), I picked it up and put it back on charge (it was at 1% or so).  10 minutes, 20 minutes later it still has the battery with the red line on it, and won't do anything.  I tried turning it off, I tried the off button and home button at the same time.  Nothing.  if I pull out the cable, it registers that I need to charge the iPad and when I plug it back in, it looks like it is charging, but clearly isn't (with the ipad charger that came with it, that charges son's iPad just fine).  Then, all of a sudden the apple is on the screen and there are 4 lines of command prompt type writing in white on the screen.
    Anyone any idea at all what is going on? 
    Are you familiar with the expresssion ..."the straw that broke the camel's back"? I think that the last drop of the iPad may be that straw that broke the iPad's back. I really think that it is time for a new iPad or possibly a refurb if you dont want to spend the money on a new one.

  • How to use addKeyListener in a program running using command prompt

    Does anyone have any idea how to add the addKeyListener to a program running using command prompt.
    Let me explain how the program run.
    The program is start and accept call from other program. But from time to time, I need to issue some command by pressing the keyboard, let say, ESC is closed the program, F1 is showing the stated. F2.... (This is all need to run in the command prompt windows)
    My problem is this program does not have any gui interface, so how can it be added?
    i do it this way
    public void key(){          
    addKeyListener(this);
    But it have compile error.
    mainServerImpl.java:87: cannot resolve symbol
    symbol : method addKeyListener (mainServerImpl)
    location: class mainServerImpl
    addKeyListener(this);
    I did implement KeyListener. But just don't know how to solve this error.
    can anyone tell me how to solve it or point me a source that can help.
    Thank in advance!
    Regards,
    Tai Tan

    Write your own Thread, to do this:
    public class KeyThread extends Thread {
       public void run {
          while(true) {
             int i = System.in.read();
             if(i == 123) {
                break; // to stop the thread
    // in your main:
    Thread keyThread = new KeyThread();
    keyThread.start(); // calls run() of the thread

  • I am having mac book air 2012model i had installed mavericks and use it, i long press command and power button at a same time and i saw the command prompt, from that i had formated the total hard disk. how to i want to install the OS again ?

    I am having mac book air 2012model i had installed mavericks and use it, i long press command and power button at a same time and i saw the command prompt, from that i had formated the total hard disk. how to i want to install the OS again ?
    i tryed with download mavericks but finally its saying a error message like cant conect to istore like that its saying and every thing is clear like internet and other stuf i tryed with 3times no progress same error pls help.. i bought this lap for my bro with his apple id only we use it now he got a new mac book pro so he gave to me so i formated and use it i use my apple id is that problem come because of changing apple id ? pls eplain

    Firstly, what is the source of the 10.6.4 disc? Is it the original installation disc for your MacBook, or one 'borrowed' from another computer?
    It isn't the retail version, because that's 10.6.3.
    Assuming it's the correct disc (i.e. the one that shipped with your Mac), you need to boot from it again.
    OK the language page.
    From the installer screen, ignore the continue button, go to the menu bar and choose Disk Utility from the Utilities menu.
    In DU, select your internal drive in the sidebar (the top item with the makers name and serial no.).
    Run Repair Disk. If that comes up as disk OK, click the partition tab. Select the partiton from the drop-down above the graphic; 1 partiton is all you need.
    Go to the options button and ensure that the partition scheme is GUID and the file system to Mac OS Extended (Journalled). Name the partiton (usually Macintosh HD), click Apply.
    When the Macintosh HD volume appears below the drive name, quit DU and see if you can then install.
    If the screen after the language screen doesn't show the menu bar, it may be necessary to use another Mac to do the job with the MB in Firewire Target Disc Mode. If it won't boot in TDM, or the MB doesn't have FireWire then it's getting very difficult.

Maybe you are looking for