Using javac command

I have created desktop gui application and I see several files created. I want to compile from the using the javac command. But I do not know which of the files I should compile first. When I build from the IDE, I get no errors. I tried compiling all of these files separartely using javac command and I got many errors.
myJavaFileView.java
myJavaFileApp.java
myJavaFile.java

Suppose you want to use these three classes.
There are two possibilities:
1. Three separate files called myJavaFile.java,myJavaFileView.java and myJavaFileApp.java. With older Java compilers, it may be necessary to compile the file myJavaFile.java first, with
javac myJavaFile.java
so that the class file myJavaFile.class is found when compiling later the file myJavaFileView.java and myJavaFileApp.java. On newer compilers, this should happen automatically when compiling myJavaFileApp.java and myJavaFileView.java.
2. Put both classes into one file. Note that then only one of these classes may have the public modifier in front of it, as in
public class myJavaFile
which then has to agree with the filename (that is, the file must be called myJavaFile.java).

Similar Messages

  • How can i run javac command in a Servlet?

    I wanna use javac command in a Servlet ,
    but it can not load the tomcat's lib.
    What can i do?

    Try out. But Iam not sure.
    Runtime.getRuntime("Cmd.Exe"). This wiil open the dos prompt.
    Create ouput stream and write in to it.Try to execute key.
    To invoke the enter key , use ascii value of the enter key

  • Unable to use javac or jar commands

    Hi all,
    I've been using my IDE to compile and run my programs. However, when I want to use -javac or -jar commands in my command prompt, it doesnt work.
    The error is :
    'javac' is not recognised as an internal or external command,
    operable program or batch file
    Same goes for jar
    -java works for me. Why is that so? I hope anyone can give me solution.
    Note : I'm on windows vista
    Another question :
    I've been using JMF (Java Media Framework) to develop a simple audio player. However it can be run on my pc. What happens if I try to run the program at another pc, will it still work? The other pc will not have JMF installed, but will have JRE to run java apps. If it cannot be run on the other pc, is there any solution?
    Thank you for your kind assistance.
    Edited by: TrAnScEnD3nT on Sep 30, 2007 10:18 PM
    Reason : Sorry I have mixed up java and javac, I've corrected it.

    Mainta? That's my favourite!This time...
    In very general terms the PATH is a system variable that is maintained and used by your operating system or shell (not Java) to locate executable files. So, for instance, if you type the command:
    >writeit will be the PATH that Windows uses to locate the write.exe word processor.
    The directory containing the Java tools - java.exe, javaw.exe, jar.exe, appletviewer.exe etc - very commonly goes into the PATH variable.
    The classpath is a list of locations that Java uses to locate classes (as you said). It is used by Java and not your operating system. It is commonly (but not always) set each time you use one of the Java tools. There is a -cp switch that lets you do this. For instance a common command to compile a file would be
    >javac -cp . HelloWorld.javaThe "-cp ." bit means "the classpath shall be the current directory".
    Setting a particular classpath does not, in general, affect the "built in" classes of Java, so you don't have to worry about this. If you search the documentation that came with your distribution you will find the exact rules for "how classes are found": but to begin with the important thing is that any classes you write must be included in the classpath which can be specified as part of the commands to compile or run your code.

  • Using the javac command

    I'm trying to create a class with the javac command. I used notepad to write the code and saved the file as .java, but when I try to use the javac command to compile it I'm told that it can't read the file. Not sure what the problem is. Any help is appreciated. Thanks.
    - rob

    Notepad will try to save any file with .txt as the extension. In the Save As dialog, even if you type factorial.java, Notepad might save the file as factorial.java.txt. If you look at the file in a Windows folder, it might display as factorial.java. To find out if this is your problem, use the DIR command in a DOS console to display the actual file name. If this is the problem you can (1) put double quotes around the file name in the Save As dialog, "factorial.java" or (2) make .java a text file type for your system.

  • JDev 10.1.3 and JDK1.2.2 use javac problem

    I have an old application that I need to compile in 1.2.2, and have tried the "use javac" checkbox on the project properties compile page. The compiler seems to run, but there is an intential error in the code. I put it there, because the class file didn't seem to get generated. I tried this on command line, and apparently '-source' is an invalid option in 1.2.2.
    E:\jdk1.2.2\bin\javac.exe -J-mx512m -verbose -source 1.2 -target 1.2 -encoding Cp1252 -g -classpath E:\jdk1.2.2\jre\lib\rt.jar;E:\jdk1.2.2\jre\lib\i18n.jar;E:\jdk1.2.2\jre\classes;E:\app\codebase;E:\oracle\jdev1013\j2ee\home\lib\ojsp.jar;E:\oracle\jdev1013\j2ee\home\jsp\lib\taglib\ojsputil.jar;E:\oracle\jdev1013\j2ee\home\oc4j.jar;E:\oracle\jdev1013\j2ee\home\lib\oc4j-internal.jar;E:\oracle\jdev1013\j2ee\home\lib\servlet.jar;E:\oracle\jdev1013\jdev\lib\ojc.jar -sourcepath E:\app\src -d E:\PTC\Windchill\codebase @C:\DOCUME~1\gteft\LOCALS~1\Temp\javac30279.tmp
    [1:53:55 PM] Successful compilation: 0 errors, 0 warnings.
    Has anyone else run into this?
    Any help or thoughts on how to adjust this behavior for 1.2.2's javac would be appreciated.

    Thank you for responding. I am aware of (and frustrated by) issues and limitations due to this application's dependancies on an aging platform, and would upgrade if it were my choice. The dependancy is in the vendor's API, and not in code that I can change.
    As the invalid option was not captured as a message or counted as an error, I thought that perhaps this could be a potential issue for using javac with any version.
    I was hoping to see if there were additional settings controlling the command line options that I couldn't find.
    Thanks,
    Greg

  • I'm new to Java and can't get javac command working

    Ok first of all hello ( i'm new to the forum ), second i'm reading a book about Java and im trying to compile a sample code from the book, but javac command gained life and it's against me. So the book i'm reading is Sams Teach Yourself Java in 21 Days (YAY), and the code i want to compile is an application that works with another bit of code that mimics what a robot could do inside a volcano. So the Volcano program code is the following ( i'll post the robot code at the end of the post):
    1: class VolcanoApp {
    2: public static void main(String[] arguments) {
    3: VolcanoRobot dante = new VolcanoRobot();
    4: dante.status = ?exploring?;
    5: dante.speed = 2;
    6: dante.temperature = 510;
    7:
    8: dante.showAttributes();
    9: System.out.println(?Increasing speed to 3.?);
    10: dante.speed = 3;
    11: dante.showAttributes();
    12: System.out.println(?Changing temperature to 670.?);
    13: dante.temperature = 670;
    14: dante.showAttributes();
    15: System.out.println(?Checking the temperature.?);
    16: dante.checkTemperature();
    17: dante.showAttributes();
    18: }
    19: }
    Ignore the numbers they are used for explaining stuff in the book, and i din't copy the indentation.
    So what i do is that i creat a file with notepad ( no fancy stuff only plain old notepad ) and i copy this code, remove the numbers and make the indents.
    After that i save as .txt file with the apropriate name ( i know it's case sensitive ). After that i open command prompt and write:
    javac VolcanoApp.java
    And it tells me that "javac is not recognized as an internal or external command operable program or batch file".
    I managed to solve that by going to the control panel and by adding to the system variables for my user in the path variable this :
    ;C:\JAVAJDK\bin
    ( C:\JAVAJDK is where JDK is installed)
    And then i modified the system variables like this:
    In the CLASSPATH i entered this .;%JAVA_HOME%\lib\tools.jar
    In JAVA_HOME i entered this C:\JAVAJDK
    Setting the variables like this made the javac error go away but now when i write in command line
    javac VolcanoApp.java
    It gives me this error
    javac: file not found : VolcanoApp.java
    Usage: javac options source files
    use -help for a list of possible options
    And then i read that i can drop my java file directly in the javac file. So i did.
    When i drop my VolcanoApp.java in the javac file it open a command line window and writes a bunch of stuff in like a milisecond and shuts down. And no file is created.
    I wanted to know what was writen in that window so i did it again and took a print screen and pasted it on paint ( it writed so much text that i only got a little bit but enough to see what hapend)
    I read it and in the print screen it said it had 15 errors ( so far ) and then it point the errors with little arrows and there were characters that weren't present in the original code.
    What hapend the compiler added wierd letters?
    SO, my real question is, how the heck do i get javac working and compiling stuff properly?
    Plz help i'm getting mad at this! ; (
    And the code for the "robot":
    1: class VolcanoRobot {
    2: String status;
    3: int speed;
    4: float temperature;
    5:
    6: void checkTemperature() {
    7: if (temperature > 660) {
    8: status = ?returning home?;
    9: speed = 5;
    10: }
    11: }
    12:
    13: void showAttributes() {
    14: System.out.println(?Status: ? + status);
    15: System.out.println(?Speed: ? + speed);
    16: System.out.println(?Temperature: ? + temperature);
    17: }
    18: }
    Again no indents and ignore the numbers. In the book it only said to compile the VolcanoApp.java , and not the VolcanoRobot.java
    Edit:
    I'm using Windows Vista Home Premium 32 bit.
    Edited by: BBlop on Dec 13, 2009 11:29 AM

    guess what it says java file. So yes i'm sure. Sarcasm. Not the best way to encourage a total stranger to help you. Then there's
    Sorry if i wasn't more clear but was that response needed?No it wasn't needed, but I'm not the one asking for help so I have the luxury of not worrying too much about it. It's extremely frustrating trying to drag relevant information out of someone, and makes one less inclined to bother.
    Anyways, there's still nothing in this thread that actually explicitly says "there is a file called VolcanoApp.java in the directory where I'm running javac from" and I really can't be bothered banging my head against the wall any longer. You've made a silly mistake, or a false assumption. We all do it from time to time. My advice is, take a break, go for a walk and re-visit this in a while. You'll probably spot the mistake right away.

  • Javac command not found

    I am new to Java programming and I wrote my first program to say "Hello World!" ...what a surprise... anyway, when I try to compile it, my command promt does not recognize the 'javac' command. I bought a book on Java that came with the J2SE Development Kit AND SDK, and they are installed to the folder it asked for, however my computer still will not recognize it... Any thoughts???
    P.S. Thanks ahead of time for any solutions... My goal is to develop a 'graphic equalizer' my March 17, 2006 - the opening of my school's musical AIDA! It seems like a far goal for a beginner, but I'm a fast learner and hope to develop one for use by our sound tech...

    Hi..
    I just installed my Java SDK&RE (1.4.2.06) and put the BIN filder in the path variable and now the compilig works but I'm getting the same message when trying to start run the "hello world" program: "Exception in thread "main" java.lang.noclassdeffounderror: Hello".
    I tried your "-cp ." method and it works perfectly, but I KNOW that last time I had Java installed I didn't have to use that option.. I know I'm forgeting something I just can'[t remember what :)
    It's been a year since I used Java and I'm trying to get back in the game now.. and this fundamental error is driving me crazy.
    I have an idea of what could cause this error.. I MOVED the entire "C:\j2sdk1.4.2_06" folder to some other location...actually I INTALLED it to some other location and I'm thinking this could be the cause..
    also, I'm looking at the WinXP Enviroment Variables and my Java installation  put here another variable CLASSPATH with value: "C:\Program Files\Java\jre1.5.0_01\lib\ext\QTJava.zip".  So I think I 'll try putting another CLASSPATH here and see what happens..
    anyway, any ideas?
    thanks in advance                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Why I can't use javac? and why my program doesn't pop up cmd window?

    I have 2 questions here:
    1) I try to compile my HelloWorld.java using command prompt,
    javac HelloWorld.java
    But it won't work; by right it should create a HelloWorld.class. When I go to Configure/Options/JDK Profile, it is already showing JDK version 1.6.0_07. My environment variables show User variables and System variables with C:\Program Files\Java\jdk1.6.0_07\bin. This is where my JDK is stored, but I don't know why I can't use javac. It keep saying
    'javac' is not recognized as an internal or external command, operable program or batch file
    2) Why is it when I run my java script using JCreator, the print out appear in the box below in JCreator and not in command prompt? How can I make it pop up on command prompt window?

    Things tend to move fasterYep... until something goes wrong... then you're completely stuffed, because you have no idea what's actually happening, because the idjit IDE is hiding all the gory details... it doesn't even tell you what it's doing, let alone how it's doing it, or what to do when it fails.
    Another argument for the command line is that it's simple. There are 16 distinct dialogues involved in adding a new jar to a library in jBuilder... There may well be less than 16 characters in the equivalent edition to the equivalent build command line. That's an extreme case, I admit, but it goes to disprove the notion that IDE's are simpler for noobs.
    Also, it's easier to get help on command line usage... because it's all text based you can just copy & paste the problematic command and it's output, and the eggspurts (tm) can do likewise with a response... and there are limited number of command lines out there... and *nix, windows, and mac cover maybe 99.5% of java users... and the eggspurts are likely to know all three (colectively if not as individuals) fairly well, because they deal with them all day every day.
    My belief is that noob's are better off at the command line until such time as they need (not just want to play with) a visual debugger... at which time its time to download netbeans and eclipse, and see which one suits you better... if you have money to splurge I'd also evaluate intelliJ... But avoid jBuilder, 2008 is total carp! The FREE eclipse is (IMHO) "nicer to use", and it has a LOT less bugs.
    Cheers. Keith.

  • How to use javac to replace deprecated wsgen or apt in JDK 7?

    I am using jax-ws RI for web service and generating web service artifacts using wsgen.
    When I use wsgen or apt to generate web service artifacts in JDK 7 with following command.
    wsgen -s src -cp CLASS_PATH -d OUTPUT_DIRECTORY  com.sun.WebServiceSEI
    displays following warning message
    The apt tool and its associated API contained in the package com.sun.mirror have been deprecated since JDK 7 and are planned to be removed in the next major JDK release. Use the options available in the javac tool and the APIs contained in the packages javax.annotation.processing and javax.lang.model to process annotations.
    How can I generate web service artifacts using javac instead of wsgen or apt ?
    Edited by: user11128702 on Feb 6, 2012 1:54 AM
    Edited by: user11128702 on Feb 6, 2012 1:57 AM

    Hi Frank
    >After correcting one error in the given source (could never run that way), I get the JCO marked as deprecated as well. So this source code there seems to be a left over from NW 2004?
    Not exactly. The deprecation means that the JCo API version is 2.X while JCo 3.0 is already available. However, this does not mean that you cannot use the "com.sap.mw.jco.JCO". I know lots of projects running even on 7.11 and 7.20 that still use the JCo 2.X.
    >Is the destination service itself also depricated?
    No, no, no.
    >So I found out JCO is now depricated and I should use SAP Java Resource Adapter instead. Can I combine it with destination service or is there something similar as in web dynpro? For Ehp 1 I found this adaptive RFC package, but seems not to be available in 7.10?
    Java Resource Adapter is just a new JEE container for JCo API. Still it's also has some problems. So I'd not recommend you to use it.
    >What I clearly want to avoid is to give any user, password or system parameters in the source code as I'm used from Web Dynpro. Can I use the web dynpro mechanism maybe somehow?
    Use JCo 2.X + Destination Service. Ignore the API deprecation.
    BR, Siarhei

  • Error while using "ant" command in weblogic6.1

    Hi,
    when I try to build the build.xml file in Weblogic 6.1 using "ant" command in
    samples\ejb20\basic\ContainerManaged
    I'm getting the following error. Pls help me out
    Error
    compile_ejb:
    [javac] Compiling 4 source files to D:\bea\wlserver6.1\samples\examples\ejb2
    0\basic\containerManaged\build
    [javac] D:\bea\wlserver6.1\samples\examples\ejb20\basic\containerManaged\Acc
    ount.java:17: cannot access java.lang.Object
    [javac] bad class file: D:\JDK1.4\JRE\lib\rt.jar(java/lang/Object.class)
    [javac] class file has wrong version 48.0, should be 47.0
    [javac] Please remove or make sure it appears in the correct subdirectory of
    the classpath.
    [javac] public interface Account extends EJBObject {
    [javac] ^
    [javac] 1 error
    BUILD FAILED
    Please Help me out
    Thanks & Regards
    Venki

    Weblogic 6.1 does not support JDK 1.4. Use 1.3

  • Syntax for javac command line in DOS

    Can anyone help me with the proper syntax fror the javac command line? Based on the Java Tutorial, I type the following line while in: C:\Program Files\Java>
    c:\progra~1\java\bin\javac hellow~1.jav
    This returns the following error message:
    javac: invalid flag: hellow~1.jav
    Usage: javac <options> <source files>
    where possible options include:
    -g Generate all debugging info
    -g:none Generate no debugging info
    -g:{lines,vars,source} Generate only some debugging info
    Rest deleted, you get the drift. A long time has passed since I have used DOS, but I thought that options were just that; they were not essential to run a program. If they are necessary, how do you set an option? for example, I have tried the command:
    C:\Program Files\Java>c:\progra~1\java\bin\javac -g hellow~1
    which gives me the following error:
    javac: invalid flag: hellow~1
    I would really appreciate any suggestions anyone out there has for solving this apparently simple & stupid problem.

    Many thanks for these suggestions. I finally got javac to work by putting the file name HelloWorldApp.java inside of quote marks (i.e. "HelloWorldApp.java"). The program compiled the file, & I now have a HelloWorldApp.class file in my java directory. Unfortunately, I am now having trouble with the next tutorial step: getting java to use the file.
    I am discovering there are some very strange things about DOS since the last time I used it. For example, the cd command recognizes either cd c:\progra~1\java OR c:\"Program Files"\java. If the quote marks are omitted a "file not found" error is returned. There seems to be some sort of problem with ways that long file names are dealt with in DOS. I notice that many contribs to this list enter long file names or directories without quote marks; indeed, this is standard format in the java tutorial. This is probably a really dumb question, but is there someway to tell DOS to recognize long names without quote marks?
    Once again, thanks for the help.

  • Error using "java" command

    I've just started trying to learn java and what is really ticking me off is that I can't get my applications to run. I use the "javac" command and it works just fine so I can get applets to work but when I use "java" to run applications I get the error message:
    "Exception in thread "main" java.lang.NoClassDefFoundError: "(class name)
    I've gone back through and checked my environmental variables and paths but get the same results. I've also tried with two versions of the SDK,
    1.2.2 and 1.4.1 and I still get the same results.
    Anyone PLEASE help, I need to get farther in learning Java!

    My First Java Program (for Windows)
    Follow these steps:
    1. Download and install the Java 2 SDK
    2. Make sure your path and classpath are set correctly
    3. Type in your first program
    4. Compile your first program
    5. Run your first program
    6. Read the Java tutorial
    1. Download and install the Java 2 SDK
    Go to the Java website and download the Java 2 SDK, Standard Edition:
    http://java.sun.com/j2se/1.4.1/download.html
    NOTE: Make sure you download the SDK (leftmost column) and not just the JRE. The JRE (Java Runtime Environment) only contains the stuff necessary to run Java programs, and not the compiler and other tools you need to develop Java programs.
    After downloading, run the installation program to install the Java 2 SDK.
    2. Make sure your path and classpath are set correctly
    After installing, READ THE INSTALLATION NOTES! Lots of people get in trouble and are asking questions in the forums because they were too lazy to read and follow the installation notes. Especially, after installing the Java 2 SDK you need to add the 'bin' directory of the SDK to your PATH, otherwise you will get an error like "javac is not recognized as an internal or external command" or something similar.
    If you've installed the Java 2 SDK in C:\j2sdk1.4.1_03, add C:\j2sdk1.4.1_03\bin to the PATH. How you should do this for different versions of Windows is described in the installation notes: http://java.sun.com/j2se/1.4.1/install-windows.html
    If you are using a version of the Java 2 SDK older than 1.4, you need to add the current directory (".") to the CLASSPATH environment variable. CLASSPATH is where Java looks for *.class files (compiled Java classes). Since Java 1.4, Java looks in the current directory automatically if the CLASSPATH isn't set, so you don't need to add "." to the CLASSPATH. Again, the installation notes explain what CLASSPATH is and how you should set it.
    3. Type in your first program
    Start Notepad and type in your first program:
    public class HelloWorld {
        public static void main(String[] args) {
            System.out.println("Hello World");
    }NOTE: Java is case-sensitive. Be careful to type in the program exactly as shown above. Don't type "Helloworld" or "helloworld" or anything else.
    Save the file somewhere in a file called "HelloWorld.java". NOTE: Again, the case must be correct. Even though Windows is case-insensitive for filenames, the case must be correct, because Java is case-sensitive. Also watch out that Notepad doesn't append ".txt" to the filename (so that you end up with a file called "HelloWorld.java.txt"). To make things worse, Windows Explorer hides file extensions by default so you don't even see that the file is actually called "HelloWorld.java.txt" instead of "HelloWorld.java".
    4. Compile your first program
    Open a command prompt, CD to the directory that contains your source file and type:
    javac HelloWorld.java
    NOTE: Again, the case must be exactly right.
    If all goes well, you'll not get any error messages and a file "HelloWorld.class" is generated.
    5. Run your first program
    To run your program, type:
    java HelloWorld
    NOTE: Don't type "HelloWorld.class". You are specifying the class name here, not the filename. Ofcourse, the case is important again.
    6. Read the Java tutorial
    Go to the Java website and follow The Java Tutorial:
    http://java.sun.com/docs/books/tutorial/
    The chapter "Your First Cup of Java" also explains in detail how to start with Java.
    Jesper

  • Error Using java command. Please help!

    Ok, I'm having problems running my java programs. I use the javac command, and it compiles it right, and makes the class file. But if I type
    java anything
    It won't work. It comes up with the error message:
    Exception in thread "main" java.lang.NoClassDefFoundError: BigDebt
    With BigDebt as the class file. That error message comes up if I type:
    java anything
    java blah.class
    I have version 1.3.
    It would be GREATLY appreciated if someone could help.

    It appears you are using the right command, "java BigDebt" if your class is called BigDebt and the compiler produced a file named BigDebt.class. (This assumes that your source code doesn't start with a "package xxx;" line.) Your problem is likely a Classpath problem. Make sure you have CD'd to the directory where BigDebt is located. Then try:
    java -classpath . BigDebt

  • Help! Can't use java command to execute application

    I can compile using the javac command and that works fine. But then it can't seem to find the class that was just created.
    I get this message:
    "Exception in thread "main" java.lang.NoClassDefFoundError: HelloWorld"
    Please help!!!
    Thanks!

    The file is saved as the class name.
    Here's what happens:
    C:\jdk1.2.2\bin>javac HelloWorld.java
    C:\jdk1.2.2\bin>java HelloWorld
    Exception in thread "main" java.lang.NoClassDefFoundError: HelloWorld
    Here's the code that I'm trying to get to run:
    The HelloWorld application program
    public class HelloWorld
         public static void main(String argv[])
              System.out.println("Hello World!");
    }

  • Using javac and XP

    Hello,
    I am using Windows XP Home Edition and j2sdk1.4.1_01.
    I am getting the following error message upon trying to use javac from the command prompt:
    'javac' is not recognized as an internal or external command,
    operable program or batch file.
    Below is my output upon trying to use javac. I have also provided my current path. Also, as you can see javac.exe is present in the bin directory.
    How do I enable javac from any directory? The instruction Sun provides doesn't seem to work for XP!
    Microsoft Windows XP [Version 5.1.2600]
    (C) Copyright 1985-2001 Microsoft Corp.
    C:\Documents and Settings>path
    PATH=C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\j2sdk1.4.1_01\bin
    C:\Documents and Settings\>javac
    'javac' is not recognized as an internal or external command,
    operable program or batch file.
    C:\Documents and Settings\>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 and exit
    -showversion print product version and continue
    -? -help print this help message
    -X print help on non-standard options
    Here is my <C:\j2sdk1.4.1_01\bin> directory below. As you can see javac.exe is present in the bin directory:
    C:\Documents and Settings>cd ../j2sdk1.4.1_01\bin
    C:\j2sdk1.4.1_01\bin>dir
    Volume in drive C is IBM_PRELOAD
    Volume Serial Number is 6C67-7C74
    Directory of C:\j2sdk1.4.1_01\bin
    01/16/2003 03:21 PM <DIR> .
    01/16/2003 03:21 PM <DIR> ..
    09/30/2002 02:08 AM 28,794 appletviewer.exe
    09/30/2002 02:08 AM 28,792 extcheck.exe
    09/30/2002 02:08 AM 16,384 HtmlConverter.exe
    09/30/2002 02:08 AM 28,794 idlj.exe
    09/30/2002 02:08 AM 28,775 jar.exe
    09/30/2002 02:08 AM 28,796 jarsigner.exe
    01/16/2003 03:21 PM <DIR> java
    09/30/2002 02:08 AM 24,672 java.exe
    09/30/2002 02:08 AM 28,789 javac.exe
    09/30/2002 02:08 AM 28,795 javadoc.exe
    09/30/2002 02:08 AM 28,789 javah.exe
    09/30/2002 02:08 AM 28,785 javap.exe
    09/30/2002 02:08 AM 24,674 javaw.exe
    09/30/2002 02:08 AM 28,798 jdb.exe
    09/30/2002 02:08 AM 28,792 keytool.exe
    09/30/2002 02:08 AM 28,788 kinit.exe
    09/30/2002 02:08 AM 28,788 klist.exe
    09/30/2002 02:08 AM 28,786 ktab.exe
    09/30/2002 02:08 AM 28,806 native2ascii.exe
    09/30/2002 02:08 AM 28,811 orbd.exe
    09/30/2002 02:08 AM 28,798 policytool.exe
    09/30/2002 02:08 AM 28,780 rmic.exe
    09/30/2002 02:08 AM 28,786 rmid.exe
    09/30/2002 02:08 AM 28,798 rmiregistry.exe
    09/30/2002 02:08 AM 28,797 serialver.exe
    09/30/2002 02:08 AM 28,823 servertool.exe
    09/30/2002 02:08 AM 28,813 tnameserv.exe
    26 File(s) 728,003 bytes
    3 Dir(s) 21,616,312,320 bytes free
    C:\j2sdk1.4.1_01\bin>
    As you can see javac.exe is present in the bin directory. How do I enable javac from any directory? The instruction Sun provides doesn't seem to work for XP!
    Thanks, Harvey

    These 2 tests have different errors, and therefore have different solutions.
    I either get:
    C:\Documents and Settings\SHEILA.IBM-IDIYAYPGDZV>cd
    ../../j2sdk1.4.1_01\bin\java
    c hello.java
    The system cannot find the path specified., The error message indicates that MSDOS can not find ../../j2sdk1.4.1_01\bin\javac. Perhaps this is just a typo in your post, but ../../ won't work in MSDOS, at least on my machine. It has to be ..\..\ but when I try the same command adapted for my system and correct the /, it works. (By 'works' I mean the javac.exe is found.)
    C:\Documents and Settings\Walt>..\..\j2sdk1.4.0\bin\javac
    or
    C:\j2sdk1.4.1_01\bin>javac hello.java
    error: cannot read: hello.java
    1 error
    when everything is C:\j2sdk1.4.1_01\bin.In this case, MSDOS found the javac.exe file and executed it. The error message is from the javac compiler and it means the compiler looked in C:\j2sdk1.4.1_01\bin and could not find a file named hello.java. Use the command "dir" and make sure that the file hello.java exists in this directory - especially make sure that the file is not named hello.java.txt
    Going back over your posts, it appears that you have set your Path correctly, so perhaps the "cannot read:" error was the main problem.

Maybe you are looking for