Run java in dos

anyone can tell how to use dos to run Java program?
I learn Eclipse few month, so I dont know how to run java in dos. I did follow the install guide to set the PATH like that
C:\Program Files\Java\jdk1.5.0_02\bin in "Path" in the User Variables
but I type to run by typing "
*c:>javac welcome1.java*
it says "javac is not in internal or external command to execute this file.
Did I miss something in that?
Please kind help!!!

did you have any luck in figuaring out how to use the dos compiler. You have to use a simple text editor like WordPad and then you save all your files in the same dir. I have been using a dos compiler for school, even thought I don't really care for them. It has been great practice getting around in dos again. And you don't have to access the Run Time Enviroment to get your program to run. just complie then first with javac filename.java and then run them with java filename.

Similar Messages

  • Running java fro DOS windows

    Hi, can somebody tell me how to run java files from the DOS window, in windows??? thanks

    joej wrote:
    ok, thanx, i did and i found i should write this javac javafile.java, but when i did i got this error "javac is not recognized as an internal or external command, operable program or batch file, what does that mean or what could it be causing it?In the dos-shell, when you type "javac" or any other commands, the shell searches it's available path for the command. In this case, "javac" was not included as part of the path that the does shell searches and therefore it returned that error.
    Go to google and search for how to add javac to source path.

  • Filepath probs running Java w/ DOS and Java 2 SDK

    Please help! I have been trying to get a .class file to run for the past four days, using DOS to run the file. I have tried to enter every filepath I can -think- of, and the program still will not run. I have even tried running the file on others' computers that also have a Java 2 SDK...and still cannot get the file to run. However, I know for certain that the file is correct and is able to be run....so that means that somehow I am not putting in the right filepath. I guess my question is....what's the file path?
    Here's what I was told to do...which has not worked thus far...
    My Java SDK filepath is: C:/Java2SDK1.4.0
    I was instructed to open DOS, then, to get to here:
    C:\Documents and Settings\Administrator\Desktop>I did so, and as instructed entered the filepath to the javac file inside the java sdk and after it, to put the filename with a .java extension. However, I ONLY have a class file. I don't have the .java file, nor was it ever handed to me.That filepath requested is: C:/Java2SDK1.4.0/bin/javac MathPrac.java
    I entered the filepath, so my DOS prompt looked like this before I hit the enter key:
    C:\Documents and Settings\Administrator\Desktop>C:/Java2SDK1.4.0/bin/javac MathPrac.javaI hit enter, and it gives me a LONG list of garbage. I even tried reversing the slash marks. Please help? This thing is due Monday and my instructor is refusing to return my emails. I don't want to fail this course due to an instructor being unwilling to assist a student, and a student having tried just about everything she could think of before finally coming here and asking for help.
    Would it matter if the SDK for some reason won't recognize my .java files either? I even tried doing the filepath with a file I KNOW should work...and on computers it should have worked on...and could not get it to accept my filepath.
    Any help would be very very very highly appreciated. Thanks!

    Author: philip_ross
    To run a .class file you have to use the java command (javac is the compiler which creates .class files from .java files). Try running
    C:\Java2SDK1.4.0\bin\java MathPrac
    Thank you for the suggestion, however when I attempted to run it, I got an error that said: Exception in thread "main" java.lang.NoClassDefFoundError: MathPrac
    Isn't this an error that states that the name of the file and the class name inside the file are not the same? And if so, how can I check to see if they are the same if I don't have the .java file? I did double-check my spelling, tried it four times just to be sure.
    To ChuckBing:
    Hey, thanks for the tutorial! I'll take a look at that, too. It always helps to have other resources.
    To jwenting:
    <Grin>. Duly noted, and thanks. I was trying to keep from being -too- technical in my explanation of what was going on.

  • How to run Java on Dos prompt

    HI~~
    I am new to Java and really need help.
    I have a program which requires a file as an argument and the file name should be provided as a command line argument.
    In dos prompt, how do I tell computer which file is the input file for the program to take as an argument?
    Thank you very much for helping me out.

    suppose your file in java is Hello.java
    Compile it(javac Hello.java) . u get Hello.class
    Now suppose your input file is file.txt
    So at the command prompt
    type
    c:\>java Hello file.txt
    This will cause the args[0] to be initialised to file.txt
    How to use it , u have to figure out.
    Regards
    Manoj.

  • Can't get java to run in MS-DOS

    Can someone out there, help me with a execution problem, am having in running java. I install jdk1.3 from a CD in a book(Java 2 by Andy Harris). I,am running under window98, with lots of spaces and memory. Each time I would try to execute a java module, the DOS screen would come up and then drop away. I have re-install the software. same problem, I have try run under DOS(coming out of window and restarting in DOS), same problem, so I log on the SUN web site and downloaded j2se1.4 install it try running it and still got the same problem, The screen up with data on it and just go away. What is wrong here!! [email protected]

    Yes! They are right.. We should run java in on windows, not on pure DOS. So restarting in DOS mode would not help.
    1. Start windows
    2. Click on Start -> Run
    3. Type Command and hit enter
    4. This should bring up DOS command prompt.
    5. Type "java" in at the command prompt
    6. If it gives you some suggestions about how to run java. If it says "Bad command" java.exe is not in the path. Find java.exe and append it to PATH environment variable.
    7. Once you get java working - open the command prompt as told earlier and run the java program by typing the command
    java <Main Class Name>
    8. Doing it this way would help you find out if there are any error messages.
    Your DOS window is closing because there was an error or your program finishes running. If you open DOS prompt first and then run java program it would not close the window and you will be able to see the error messages in the same DOS windows.
    Hope this helps..

  • Running java command from DOS prompt

    Hi,
    When I run java from the DOS prompt (NT) in any other location than the JDK bin directory, I get the following error:
    Error opening registry key 'Software\JavaSoft\Java Runtime Environment'
    My understanding is to be able to run this from anywhere you need to add the tools.jar file to the CLASSPATH, which I have done.
    There is no entry in the Registry for Software\JavaSoft...etc, has anyone any idea what my problem is and how I can solve it?
    Thanks in advance

    Hi,
    I am running Java 2 SDK, Standard Edition Version 1.2.2 running on NT. It was installed as part of Oracles JDeveloper IDE and is running on NT.
    All I want to be able to do is run java from the command line e.g. 'java myclass', to run a standalone Java program. I can run 'javac myclass.java' to compile the program without any problems, but my understanding is that to do this all I need is to have the '.../java1.2/bin' directory included in the 'PATH' variable, whereas to run the java runtime you need to include the tools.jar in the CLASSPATH variable.
    As I said previously I can run the 'java myclass' command from the '../java1.2/bin' directory, just not from anywhere else. As for whats in the code, does not matter you should be able to type just java on the command line and it will come back with an error prompting for the class name. Here is an example of what happens:
    I:\>java
    Error opening registry key 'Software\JavaSoft\Java Runtime Environment'
    However if I change to the correct directory, I get:
    D:\oracle\JDev32\java1.2\bin>java
    Usage: java [-options] class [args...]
    (to execute a class)
    or java -jar [-options] jarfile [args...]
    (to execute a jar file)
    where options include:
    -cp -classpath <directories and zip/jar files separated by ;>
    set search path for application classes and resources
    -D<name>=<value>
    set a system property
    -verbose[:class|gc|jni]
    enable verbose output
    -version print product version
    -? -help print this help message
    -X print help on non-standard options
    The contents of my PATH and CLASSPATH variable are shown below, Thanks again.
    I:\>PATH
    PATH=D:\oracle\BIN;D:\oracle\Apache\Perl\5.00503\bin\mswin32-x86;C:\Program Files\Oracle\jre\1.1.7\b
    in;D:\oracle\ora8i\bin;C:\DMINT40\Win32\Bin;C:\WINNT\system32;C:\WINNT;C:\Program Files\Symantec\pcA
    nywhere;d:\oracle\jdev32\java1.2\bin;d:\downloads\oraxml\bin;d:\oracle\jdev32\java1.2\lib\tools.jar
    I:\>echo %CLASSPATH%
    d:\oracle\jdev32\java1.2\lib\tools.jar;d:\oracle\apache\apache\htdocs\web-inf\classes;d:\oracle\apac
    he\jserv\servlets

  • Win2000 NoClassDefFoundError running java.exe from DOS prompt

    I am using Windows 2000 with J2SE v 1.3.1_02 and have a problem when I run java.exe from the command line for classes that are defined to be in a package. I can both compile and run this program from the TextPad editor but when I run it from a DOS prompt I get the error "Exception in thread "main" java.lang.NoClassDefFoundError: MyClass"
    My CLASSPATH is set to D:\
    The files MyClass.java and MyClass.class are in the directory D:\MyProject
    here is the source:
    package MyProject;
    public class MyClass
         public static void main(String[] args)
              System.out.println("MyClass main");
    Note that if I comment out the package statement and add "." to CLASSPATH then it runs from the DOS prompt. Why does the program run from inside TextPad but not from the DOS prompt? Seems to be some type of bug in java.exe on Windows 2000 when the keyword package is used.

    It turns out that if you use the main method in a class that declares the package statement you need to use the fully qualified name to run the program. Using this statement works for this problem:
    java MyProject/MyClass
    the forward slash is required even though is a Windows system.

  • Running java program from DOS

    I have just installed JDK 5.0 (update 4) and have tried writing a small demo program. The .class module is created ok but when invoking java I get "Exception in thread "main" java.lang.NoClassDefFoundError. I am running java from a DOS batch file with one command of c:\progra~1\java\jdk15~1.0_0\java %1. A similar batch file is used to invoke javac which works.
    Any ideas what I'm doing wrong? Thanks.

    You can't run a Java program from DOS, in fact you can't even install a JRE under that old operating system as Java requires a 32 bit or 64 bit operating system architecture which DOS never offered.
    But on the off chance you mean a command prompt from Windows...
    Check your classpath, most likely you forgot to add the current directory to that.

  • Running java through MS-DOS on a win98 system

    i'm using MS-DOS on windows 98 to compile and run my programs and would love to know how to view one screen at a time when i compile my programs. (so i can see the long list of error messages ;-) i don't know DOS at all and so far have tried piping it to more like so:
    javac Pair.class | MORE
    but that didn't work. also, my "page up/down" and arrow keys don't work -- they are linked to my command line because i permanently set the doskey. any ideas?
    thanks,
    .yolanda

    http://www.textpad.com/
    Nice alternative to running from the DOS command line. You can go into the TextPad options panel and set the java compiler and run applet/run applications options to come up as part of the tools menu.
    I used to run from the command line in '98 when I started, and still do so in AIX, but I really like TextPad. You get all your error messages with line numbers in a scrollable document that is separate from your source file, so you can flip back and forth and fix things. For some diagnostic things I even prefer it to more expensive IDEs. There is a trial period and then a very nominal fee to TP.
    You can also download lots of IDE's out there for free.
    http://www-106.ibm.com/developerworks/
    That's the main link to IBM's developer works, which gives you links to their alphaworks and downloads links. Check out Eclipse. My company is moving to it, after a long and tedious relationship with Visual Age for Java. You can download both, or order the java tools cd which includes them.
    Also look at Forte. My shop is pretty into IBM, so I've only played with Forte, but liked it. That's another freebie. Ask around, there's lots I've not used.
    I'd only run from the command line unassisted long enought to be sure I knew how to do it... Anything else is self abuse <g> not really... well maybe...

  • Error while running Java Application as NT Service using INSTSRV

    Hi,
    I am trying to run Java Application as an NT Service using Instsrv.But when i start the service It works fine.when i stop the service it does not stop and it continues to run the application.When i uninstall the service It still executes.When i reboot my machine it stops .Is there any solutions for this.Any help is greatly appreciated.
    Thanks.

    I actually had similar situation. I used autoexnt.ext tool (it creats a service that can be called when rebooting) to start a batch file which in turn run a java program. After the program starts, it can only be stopped through Task Manager or Ctrl-C at the dos window (it creats a dos window) or close the window directly. Stopping the service has nothing to do with the program. I feel this is reasonable because the only function of the service here is to start the application. After that the service does not (very likely) have any connection with the program so whatever you do with the service will not affect the program itself. I wonnder if you are in the same situation.
    PC

  • Closing Console window while running Java application from Batch file

    Hi all,
    I have made a small application using Java swings,now i have made a jar file of my application and calling this jar file through batch file,when user clicks on that batch file it runs "java -jar applicationname.jar" command,but problem is that when i run that file from batch file it opens Dos console window at baclk of the screen which looks weird for a desktop application,i dnt want that Dos console window visible at the backend while my application is running,i have searched regarding this on google but found nothing usefull,if anybody can please help regarding that it will be a great releif for me,i have been stuck on this problem from last two days.
    Thanks.
    Simer

    warnerja wrote:
    georgemc wrote:
    warnerja wrote:
    start java -jar applicationname.jar
    That'll pop up another consoleI'm under the impression that the console window he is seeing is the one which cmd.exe opens when it is executing the batch file. And that batch file won't return until the java process has completed because he didn't start it in the background to let the batch file continue and terminate.
    So I don't think just simply substituting java with javaw will do much good either. Still think he needs a "start" command in that batch file.
    So now he can try:
    start java -jar ...
    or
    start javaw -jar ...Fair point

  • How can i run java file by double click like Visual basic

    i have to run java file by giving a command on DOS promtp.But in Visual basic i easily make a .exe file to run my program. Does java provide this thing?
    please help me.

    If you have intaled a JRE in your computer, at leasrt in windows, the .jar files are asociated with the VM, so a double click on them will execute the, thats how things work on my computer, with jdk 1.4 installed.
    Abraham.

  • Using the command "java" with DOS

    Hey, until yesterday, I was able to simply use the commands "java, or javac" to run, or compile java in DOS. But now for some reason I can't use these commands. I have to use the full addresses of the java and javac.exe files. How can I fix this? Do I have to be in the \bin folder to use these with the command name only? It's a pain to store my files in the bin folder. Any help would be appreciated.

    See here: http://java.sun.com/j2se/1.4/install-windows.html#Environment

  • Running Java applications as "standalone"

    I am curious as to how to run Java apps in a "standalone" manner. By "standalone", I mean like SUN Java One Studio, where the Java app behaves like a standard executable file.
    Currently, I use batch files to call the Java interpreter to run my program; when the program exits, the batch file closes. The main problem with this approach is that the batch file window remains open, and anyone who closes the window closes the program itself... which is not good.
    Is there a workaround for this?

    Of course there is a workaround for this:
    Make a new shortcut on your desktop and as the target use the javaw.exe file. Using this and not java.exe does open qour application without any DOS window! For sure you have to add the class name to load in your shortcut target (e.g. "C:\jdk1.4.1\bin\javaw.exe MyClass").
    Voila - the application behaves as a standalone program now.
    nocomm

  • Windows xp runs java application but does not compile it - urgent please

    Hi
    My new PC(portable) does not compile my java progran:
    'javac' is not recognized as an internal or external command, operatable program or batch file.
    If you have any suggestion, please let me know!
    Aria

    Thanks anyhow;
    The following information is sent to beginners site.
    I have talked to british, belgian and others regarding this problem. They said it is very expensive and we laughed.
    Hi,
    Windows XP runs java application but does not compile it. I get following message:
    'javac' is not recognized as an internal or external command, operatable program or batch file.
    MS-DOS does not exists but a command line edits autoexec.nt having allinformation regarding installed jdk5. I run my java applicat
    ion from here. But no compilation.
    Environment variables has following information.
    JAVA_HOME C:\jdk5.0
    CLASSPATH C:\jdk5.0\myPrograms
    path %JAVA_HOME%bin
    All information in autoexec.nt exists as windows 98 and I run it from command line.
    Would you please tell me what is wrong?
    Thanks
    Aria

Maybe you are looking for

  • Views on CF Report Builder and Crystal Report

    Dear all, I would like to get your opinions on CF Report Builder and Crystal Report. As we all know, CF Report Builder is a new reporting tool. But I find it very difficult to design a complex report maybe due to limitation in its functionalities. So

  • Pls send Some good question and answer related to FI

    Hi Gurus, Pls. send some <b>good question and answer</b> .i need urgently. Pls help me. regds Mahesh K Singh

  • How to enable a reminder for when a shared review has reached its end date?

    I thought Acrobat will send the initiator of a shared review a reminder before the "end review" date is reached. This will allow him/her to check with the reviewers how they are going. It seems we aren't receiving that reminder anymore. When I setup

  • Imac &  connecting to PC's

    my imac cant seem to connect to my PC despite using the correct log on commands.My PC can log on to the imac however. Can anyone help? I use airport and a netgear 614 wireless router. The imac and the PC can accsess the internet with no problem.

  • ITunes Scrolling

    Does anyone else notice that scrolling vertically in iTunes on your iPhone 4 (Model MC922LL running version 6.0.1) is really...sticky?  Or clunky? It never used to this, that I remember.  My 3GS didn't do this, either. Thanks!