About "javac" in MS-DOS

i tried to use comand "javac" to compile my program in MS-DOS,but the system tell me that is an invalid command,why?then i compiled the program in JCreator,it generated a ".class" file in the directory,and then I can use "java" command to run the program.so what's wrong with the "javac" command?
by the way,when i tried to use JCreator to compile a project which has several program files,it doesn't generate the ".class" files for each every one of them,i have to compile the program files one by one in JCreator in order to see the programs' ".class" files in MS-DOS directory.why?
Thanks!

javac compiles files containing sourcecode (*.java). This tool requires minimally one java file as its parameter.
java executes a java class. Therefore it requires a full qualified class name to search for.
The "full qualified" class name is a combination of the class name itself and the class' package name.
e.g.:
for your HelloWorld class the class name is HelloWorld
for the Vector class (java.util.Vector) the class name is java.util.Vector
to get more information about all the tools you might execute them without any parameter (this prints out a help message with a parameter description and a list of supported options) or have a look to your jdk documentation (e.g. http://java.sun.com/j2se/1.4.2/docs/tooldocs/tools.html)

Similar Messages

  • Easy question about 'javac'...

    Yeah, at school, we're so used to using a program like CodeWarrior or NetBeans to do all our programming with. However, here at home, I'm trying to code simply in Notepad, and I'm having a little trouble.
    Basically, I'm getting the NoClassDefFound error. The problem is, though, that I can't actually COMPILE the .java file I wrote in notepad - whenever I try to use the 'javac' command, it gives me an error saying it's not recognized as an external command, blah blah blah. So, there's no .class file.
    Yeah, before this, I had downloaded the runtime environment, and it all went fine, but there still isn't any 'javac' command. :/

    You know how states are always debating whether we (Americans)
    should have the ten commandments carved in stone in front
    of our courthouses? - or something like that...
    Well i think someone needs to carve the god-d@mned classpath
    instructions beside the heads at Mt Rushmore, lol.
    Darkslime, dont feel bad everyone has this problem when they
    start (at least the people that dont read the installation instructions).
    This is what you do.
    Install the SDK (not the JRE)
    Take note of the installation folder.
    Recent installations (1.5) seem to be in:
    C:\Program Files\Java\jdk1.5.0_06\
    Find the \bin folder. it contains the "javac.exe" and "java.exe".
    these are the 2 exes responsible for compiling and running
    java programs.
    the final path should be:
    C:\Program Files\Java\jdk1.5.0_06\bin
    go to MY COMPUTER
    right click
    go to PROPs
    ADVANCED tab
    ENVIRONMENT VARIABLES button
    Under SYSTEM VARs:
    "CLASSPATH" - i keep this empty
    "PATH" - add your installation path
    (i.e.: C:\Program Files\Java\jdk1.5.0_06\bin )
    make sure to add a semicolon " ; " to separate it from the last entry.
    SAVE all of this.
    when you compile "cd" into the directory your project is in.
    try compiling. if it doesnt work try:
    javac -cp . Program.java
    and
    java -cp . Program
    NOTE: you can add other folders to the classpath by using a
    semicolo ";" ....
    java -cp .;Folder1;Folder2 Program
    NOTE: the " . " means "this folder"
    If this doesnt work read the BILLIONS of threads about this
    subject all over these forums and the net.
    Good Luck
    oh - and for gods sake use TextPad and not NotePad.
    TextPad has a "compile" button for Java.

  • Unable to run JAVAC command at DOS prompt

    I installed JDK1.3.1 I gave the pathas
    C:\JDK1.3.1 and changed the Autoexec.bat file to have
    Set Path=C:\JDK1.3.1\Bin;
    When I am trying to run command javac it gives me this message
    This program cannot be run in DOS mode
    I cant start, Please help
    Thanks
    Ehsan

    Did you reboot the system after the install -- what you put in the autoexec.bat doesn't become effective until the system has been rebooted.
    If you don't want to reboot, you can try this:
    C:\JDK1.3.1\Bin\javac -classpath C:\JDK1.3.1 HelloWorld.java
    V.V.

  • About javac.exe log

    I want to know Can i change the output log language to some specific language like "English"
    The problem is that i am using a Traditional Chinese Windows System...
    The log output from javac.exe is in Tranditional Chinese, but i don't know why it always give some "???" in it.
    Some words is missing...so i decide to use English as the output..
    Can anyone help me on this ? THANKS

    only some characters changed to ????Is there anything common with those characters, what comes to eg. their unicode or MS950 values?
    and i just want a solution...You originally wanted to replace the current traditional chinese with english in compiler messages?
    Then, let's just do it. We will extract the files from tools.jar, replace the chinese property files with with english ones and re-create tools.jar.
    In command prompt, go to the jdk installation directory (commonly none as java_home) Then do the following:
    cd lib
    jar -xvf tools.jar
    You should get a long list of files that are at the same time being extracted from tools.jar. After it has finished, you'll see that there are three directories under the jdk's lib directory that weren't there before: META-INF, COM and SUN. These directories contain the sun's jdk classes and the property files they need.
    Now comes the funny part: determining what files to modify. To make this easier, let's make a java app that does not compile:
    // file Proptest.java
    public abstract class Proptest {
    public abstract Class Proptest() {}
    The compiler will complain about the abstract method having a body. The error message is stored in the property "compiler.err.abstract.meth.cant.have.body". Search for files having that string in them; you might find several.
    To identify which of the property files is used by javac, add a unique identifier to the compiler.err.abstract.meth.cant.have.body of each property file. Also take notice which file contains the English "abstract methods cannot have a body" - you'll need this info later. (The files are text files and you can use just about any text editor to modify them - windoze's notepad may not be a good one, though, since the line separator the files have is \n and not \r\n, windoze's the default.)
    I'm sorry I can't post a sample of the file here; I'm afraid it would be against the sun lisence agreement :-(
    Then "rebuild" tools.jar (yes, still in the java_home\lib directory) with the command
    jar -cvf tools.jar com sun
    This time you should see a list of files that are being included in the jar file (the list is the same one you saw before).
    Now try compiling the app written above:
    javac Proptest.java
    From the identifier you just added to the error message you can deduce what was the property file javac used. Rename that particular file to something else, make a copy of the file that contains the error messages in English, and rename the copy so that it'll have the name of the file that javac uses.
    Again, rebuild tools.jar (you can omit the "v" in -cvf if you don't want to see the file list) and compile the app. Do you see the error message written in English?
    The rest of the jdk tools still use Chinese; you might want to do the above hack to them, too.

  • Question about javac -source -target

    Hello:
    I am using JDK 1.8.0-ea and I want to compile my sources for 1.7 (compatibility with previous VM: 1.7 is the latest official release)
    C:\Users\admin>javac -target 1.7 prg.java
    javac: target release 1.7 conflicts with default source release 1.8
    C:\Users\admin>javac -source 1.8 -target 1.7 prg.java
    javac: source release 1.8 requires target release 1.8
    Is there some way I could compile for previous VM or will 1.8 classes NOT be compatible  with previous VMs?

    Thanks: Actually the code was compiled for JDK7, (it can be compiled even with jdk6).
    Huh? I read your post to mean that you can NOT compile it for JDK7 using JDK8. But my point was that if you use JDK8-specific features then the code isn't backward compatible.
    The main problem is that when JRE 8 is available for public,  many systems will still have older JREs, thus JDK8 bytecode would not run in them.
    Although I can compile it with JDK7 tools, I thought that JDK8 could compile for backwards compatibility, if new features were not used in code.
    Normally new versions support some limited number of previous versions using the -target and -source parameters.
    You may have found a bug - you can report it using the 'Report Bugs' link on the JDK8 download page.
    https://jdk8.java.net/download.html

  • Cant get javac on my win98 computer

    I've downloaded just about everything on this site by now, and I've read just about every help page. All I want is to be able to write some simple little java programs, and then save them and compile them using javac at the dos prompt and then run them using java at the dos prompt.
    Can anyone help me please???
    Thanks.
    [email protected]

    Me again, doing some more explaining:
    I haven't even got a file called javac anywhere on my computer. NO matter what I install, I haven't got the javac command. How and where do I get it from?
    Thanks,
    Monicque.

  • Javac / Manifest Class-Path

    Hi guys,
    I have problems with javac not finding classes when I use the extension mechanism.
    I have several jars: abc.jar def.jar ghi.jar ...
    To simplify the classpath when trying to compile another project with these jars, I use the extension mechanism and create a new jar (alphabet.jar) containing only a manifest file:
    Manifest-Version:1.0
    Class-Path: abc.jar def.jar ghi.jar ...The following works fine (assuming for example that abc.jar contains org/alphabet/Abc.class):
    > java -classpath alphabet.jar org.alphabet.AbcBut this fails:
    > javac -classpath alphabet.jar Test.java
    Test.java:1: package org.alphabet does not exist
    import org.alphabet.Abc;
    1 errorTest.java:
    import org.alphabet.Abc;
    public class Test {}I've searched on google and co. for more information but could not get anything. Sun's documentation http://java.sun.com/j2se/1.4/docs/tooldocs/findingclasses.html doesn't mention anything about javac not using the extension mechanism.
    This seems to happen on all JDKs (1.2.2, 1.3.1, 1.4 at least).
    Thanks in advance for your help!

    hi again,
    the next what you should know is that a package has to really exist as directories on your harddisk by compile- and runtime and the name of the class-file needs to be the same name as the class-name in it.
    example:
    c:\javalib\org\alphabet\Abc.java
    c:\javalib\Test.java
    compile both with 1 javac-command
    c:\>cd c:\javalib
    c:\javalib\>javac Test.java
    all imported libs (c:\javalib\org\alphabet\Abc.java) will be automatically compiled with this command. you will have now 2 class-files:
    c:\javalib\org\alphabet\Abc.class
    c:\javalib\Test.class
    now you make a 'manifest'-file for creating a autostartable jar-file:
    create a textfile 'mymanifest.txt' (name is not important) in the root of your projekt with the following content:
    c:\javalib\>mymanifest.txt
    Manifest-Version: 1.0
    Main-Class: Test
    Created-By: Your Name
    (if the start-class is in a package you have to write:
    Main-Class: mypackage.Test)
    now you can make a executable jar (a jar with a manifest) with the command:
    c:\javalib>jar cvfm alphabet.jar mymanifest.txt .
    (dont forget the last point!)
    now you can run the jar simply with:
    (it's now a java-executable)
    c:\javalib>java -jar alphabet.jar
    hope to help
    cu
    oliver scorp
    ps: a jar-file is nothing other than a zip-file, rename it and try it out. you will see that the pathes still exist in the compressed file.
    pps: plz dont forget my dukes!

  • Noob and trying to compile in Dos

    When I try to use the javac command in dos to compile my program I always get this message "this program cannot be run in dos mode". I set all the paths and correctly and am just using notepad to write the code. How can I fix this problem. Please help!!! Thanks

    Are you restarting your Windows system in DOS mode just to compile your programs? Don't do that. Just look for either "MS-DOS" or "Command Prompt" in your start menu. That will open a DOS box where you can compile and run your programs.

  • Failure to use javac j2sdk1.4.2_04

    My laptop has installed on it Windows XP SP2. J2sdk1.4.2_04 ikons some shows instability. Jdb DOS command is stable and I am able to use it. Javac and appletviewer DOS command prompts are
    unstable and as soon as I click their ikons their DOS command is seen momentarily and then
    closes spontaneously. The Windows System Environment variables relating to j2sdk have all been set including JavaHome, path, javac options etc.
    I wonder if there is a step that I have not done that is necessary for proper function of javac and appletviewer?

    From your description it sounds like you've opened an Explorer window to C:\j2sdk1.4.2_04\bin\ and are clicking on the javac.exe and appletviewer.exe listings. If so, that's not correct - the expected result of that action is as you describe.
    Open a Command Prompt window - usually done by clicking on the Start Menu > Programs > Accessories > Command Prompt shortcut. In that, type the commands with their arguments.
    Java is a commandline environment, not a Graphical User Environment (GUI).
    As jsalonen suggested, the tutorial has detailed instructions for beginners.

  • 2 questions about program HelloJava3Da

    1. I read Chapter 1 of Java 3D API Tutorial: "Getting started with the Java 3D API". I want to get or downloaded the source codes of "HelloJava3D". But how can I find these source codes?
    2. I input the source code of HelloJava3Da by hand. But how can I run it?
    Using "javac" command under DOS? I tried it, but there are 17 errors appeared!
    Using J Builder 4.0? One error is appeared: Error# 202: 'class' or 'interface' expected at line 14, column 15. Line 14 of HelloJava3Da is: public static void main (String[] args)...
    So, what can I do now?

    Hi there
    I had the same struggle too but eventually I have found the place where the source code is at:)
    Go here:
    http://java.sun.com/products/java-media/3D/collateral
    Greetz,
    Gijs
    (If you want more info lemme know: [email protected])

  • Why is it that i bought my music on my ipad and i want to download it to my phone and its saying something about 90 days

    i spent hours picking out the music on my ipad so that i can use my computer to download to my phone so i can workout with it. Then now i come on my computer in the morning an it says something about 90 days, so dose this mean that i have to wait 90 days to listen to my new music on something else other than my ipad?
    if that is so than that is BS

    It may not be much to worry about. See HT4627 - iTunes Store: Associating a device or computer to your Apple ID.
    It helps to write down the exact error or warning message.
    tt2

  • Help, Javac comes up as "bad command"

    I installed j2rel1.4.0_03 - by default, it fell under program files->Java->j2rel1.4.0_03 . I tried javac under the dos prompt, and got "bad command". So I modified the path to this in my autoexec.bat:
    PATH=c:\windows;c:\windows\command;c:\ibmtools;c:\;c:\PROGRA~1\Java\j2re14~1.0_0\bin
    The command "java" is recognized, but "javac", even when issued from the bin subdirectory, still gets "bad command". I have spent a few hours on this already (and did the same when I tried on another pc 6 months or so ago). Is there some easier way of getting to first base that I am missing?
    G

    You might check to make sure the path is actually in the system path. Adding it to the autoexec.bat will only add it to the path when you restart. Type path at the prompt and make sure it is there. Also what os are you running. In winNT sometimes (depending on the configuration) the autoexec.bat does nothing, you might need to change autoconfig.nt, or just set it in the environment Variables. check if java -version works, this should let you know if it is set up right.

  • I can't install sdk properly

    Hi all
    I am absolutely new to java and I have been trying to install jdk1.3.1.04. I go through all the steps to install it but when I use javac it gives a message " bad command or file name" what is happening?
    It is installed in C:\sdk1.3.1.04 directory. I changed the autoexec.bat file to read: SET PATH=C:\WINDOWS;C:\WINDOWS\COMMAND;C:\JAVA\BIN; as I understand it should be. The prompt starts at C:\Windows> , I changed the directory to C: and then try javac and I get the message above "bad command...."
    I hope someone can help me get started with this.
    just one extra comment. I seem to have 2 autoexec.bat files the 1st is in C: and the 2nd is in C:\windows\command\ebd. The one I changed is the one in C:
    God Bless Java
    tongf

    public static void main (string[] args)
    /\As Sum-shusSue said, String with a capital S
    ===============================
    system.out.printIn("hello Eddie");
    /\As Sum-shusSue said, System with a capital S
    ==================================
    I checked the .txt and resaved it so that it only
    reads .java nowGlad I guessed right about Notepad...
    ==================================
    One point: I went into system information in system
    tools and I was looking to see if I could see
    anything. The following code is in there twice
    java runtime environment 1.3.1_04 damaged 1,3,1,4There is nothing wrong with the download. It should be there twice. The following information is from http://java.sun.com/products/plugin/1.3.1_01a/faq.html
    Q: The file Java Runtime Environment 1.3.1_0x (an ActiveX Control) in the WINNT/Downloaded Program Files directory says it's "Damaged." What does this mean? What can I do about it?
    A: This is a cosmetic bug; you won't run into any actual problems with the Java Runtime Environment. It does not mean that anything is damaged or that the installation failed. However, if you would still like to make it read "installed" instead of "damaged", you can edit the windows registry. First double-click on the ActiveX Control that is "damaged" (Java Runtime Environment 1.3.1_0x) and check the ID value. Go to Start->Run, type regedit and hit "Ok". Traverse to the following registry key: HKEY_LOCALE_MACHINE//Software//Microsoft//Code Store
    Database//Distribution Units//{ID}//DownloadInformation, where ID is the value of the ID. Double click on the INF registry string, delete the string contents, and hit "Ok". The status of the previously "damaged" ActiveX control should now say "installed".
    ================================
    When I put in javac at the dos prompt it shows all the
    options so that part works.At this point you seem to be ok; watch your capitalization and other programming errors.
    Good Luck

  • 100 is too many error messages

    I use windows for javac and the DOS-Prompt screen can handle about 10 errors. The limit in javac seems to be 100. is there a way to change the limit to 10?
    dewayne

    Thank you two for responding. I really don't know that there is a limit of 100. But statistically the number comes out to be 100 far more often than numbers close to 100. And I don't remember ever getting more than 100. I have found over the years with compiler messages that if you fix the first one or two or three or so, and compile again, that progress is faster. Yes, there is useful information in almost all of them, but it's better to go for the early ones. It has been a little while now, but I believe I tried early on to get them to a file, but I will try again. I think they won't go.
    dewayne

  • How do I set up SATA HD without any IDE HD?

    Hi.
    I'm a newbie in the process of building a new computer.
    It's been fun -putting together components physically- but...
    ...I'm stuck here ---> My plan is to use just one HD for now -Raptor 36.7gb- along with a 3.5" floppy diskette drive and a DVD Recorder.
    The 3.5" drive is connected.
    My Raptor HD is connected to "SATA1" on the board.
    But I'm a little puzzled when trying to figure the IDE cable placement for my DVD Recorder- Do I connect it to "PRI IDE" or "SEC IDE"?
    And does it matter that I will not have an IDE HD installed?
    (And I'm guessing the IDE LED on my case will never be lit?)
    I thank you in advance for any help.

    Don't worry about the lack of DOS prompt - XP doesn't use DOS at all!    That's why you boot straight from CD; in the old days you'd have to boot to DOS from a floppy to load CD drivers, and only then could you start Wndows setup from CD.
    You don't need to press F6 to load drivers, the SATA controller should just work, and you can load all the chipset drivers, etc, that you need from the motherboard CD or whatever once XP's in.    XP has a lot of drivers in it anyhow, I think that's partly why the install's four times bigger than 98!
    Why is the setup not working?   Is is not recognising the hard drive?   It should say something like "Checking drive XXXX on XXX", and it'll say how big the drive is and that, and a yellow bar goes across!
    I've got my Seagate SATA HDD on the same controller as you (SATA 1), and XP Pro saw it no problem.
    If Setup just isn't seeing the HDD, you may want to check in the BIOS and make sure the SATA controller is enabled:
    - under "Integrated Peripherals", select the "On-Chip IDE configuration" menu
    (... er .... hang on, got to reboot my machine to check - I'll get back and edit this! ....)
    Okay, back now, where was!?   Ah, yes.   Basically there's a number of configurations of this, and it also depends which BIOS version you've got.   With XP you can use either Legacy or Native mode - Native uses extra interrupts which older OS's can't handle, so as I'm running 98 as well, I use Legacy.   I'll give you my settings, using BIOS 1.7:
    Mode - Legacy
    Configuration - P-ATA+S-ATA
    P-ATA keep enabled - Yes
    Combined modde option - S-ATA 1st channel
    Configure S-ATA as RAID - No
    I've got a feeling this disables one of the normal IDE channels though ... anyway persevere with various combinations until both the DVD drive and the HDD appear on the "Standard CMOS Setup page of the BIOS.
    Try searching the forum for older posts on this - this has been a hot topic of discussion, there are many posts describing the various combinations!
    Then, it'll also be worth checking "Boot device select" under "Advanced BIOS features", and make sure the HDD is set as a boot device in there.    Once you've got past the initial Setup stages, you can remove the CD from the boot list again.
    Let us know how it goes, don't hesitate to keep asking questions!

Maybe you are looking for

  • Problem with Nightly, Aurora, and 4.01, what should I do?

    I had Firefox 4.01 installed on my PC, and I recently updated it to get the Aurora which I noticed allows you to change between Aurora, the Beta, and the Release, which I loved, but I also downloaded Nightly too. Nightly works great and I was able to

  • FU 065:-Document belongs to cross company- code transaction(error massage)

    Hi expert, I am going to reverse a document (after resetting through LSMW,useing -F.80 as for mass reversal) and getting a error massage below(this document has been generated after F110) FU 065:-Document belongs to cross company- code transaction(er

  • Extended Transport Control Usage??

    Hello All,                "Extended Transport Control is another way to set up the Transport Route so that the route is system and CLIENT specific"..I m not able to understand this concept so unable to implement Extended Transport Control in my SAP L

  • I can't open Lightroom 5 on my iMac -- receiving 1712 message

    I can't open Lightroom 5 on my iMac -- receiving 1712 message

  • IDOC REduction to !

    Hello Experts my Questions are as follows... I am planning to use  basic Idoc type             MATMAS04 1. I want to reduce it Coz it has too many segments in it ( will i have to attach a new msg type to IDOC again or i just reduce it ) 2. I want to