Where is my javac ?

Hi, everybody. I just downloaded and installed J2SE Development Kit.
Now I tried to call Java compiler "javac" from command prompt but it says : "javac is not recognized as an ... operable command". What could be a problem?

Need to set your path to the folder you are writing
your programs in.Nope, he needs to set it to the bin folder inside the jdk folder. For example:
PATH="C:\Program Files\Java\jdk1.5.0_08\bin\"Just adjust it to where your bin folder is.

Similar Messages

  • Where to find javac RPMS for RedHat Linux7.3

    I want to do programming in java on linux platform but I don't know how to start. I have Redhat Linux 7.3 installed on my computer. I have Celeron 1.2Ghz processor with intel chipset board.
    I searched for RPMS of Java compiler on various sites but as I dont know the exact name of RPM to install for J2EE, I could'nt install it.
    Can you please help me?

    "Javac" is a part of the J2SE SDK which you can download from http://java.sun.com/j2se/1.4.2/download.html
    For Linux there are two formats: RPM and .tar.gz-packed binary. Remember to follow the installation instructions (there's a link to them on the page I mentioned above).

  • Javac : command not found ?? A simple question.

    Hello.
    I need to somehow tell linux where to find javac so that I don't need
    to type in /usr/local/jdk1.4/javac HelloWorldApp.java every time I need
    to run javac. I have seen how to do this in windows but I don't know how to do it in Linux
    I know it's a simple question, I'm just new to Linux.
    Your help is appreciated.

    The answer depends on the shell you use.
    The default on linux is bash, so do this: In your home directory there is a file with the name .bashrc. Commands in that file are performed every time you start the shell.
    In that file, add the command "export PATH=/usr/local/jdk1.4/bin:$PATH". Then "source .bashrc" so that the change takes effect. You can verify that the directory has been added with "echo $PATH".
    If you want to set the path for all users and not just yourself, make the change in the system startup files. This depends on your distro; the right file might be /etc/profile or /etc/profile.local or /etc/bashrc.

  • How do I configure Windows 7 to recognize javac as a command?

    I can write, compile and run a very very simple java program on Eclipse. When I attempt to compile the same program using the cmd interface, I find that javac is not recognized. So, I change the CLASSPATH, system environment variable to: "C:\Program Files\Java\jdk1.6.0_20\bin\javac" exactly, without quotes. This does not change results. Eclipse must know where to find javac else the program won't compile. Changing the CLASSPATH has no effect of the Eclipse compilation that continues to compile and run! HELP! How do I configure Windows 7 to compile this program using the cmd interface?

    Reply #1 is correct. You must not have done it correctly if it didn't work for you. Maybe you got the path wrong.
    Or... did you close the console window and open a new one? If you didn't, then you didn't get the new PATH value.
    Try that.

  • Javac string concatenation desugaring

    Where in the JDK7 javac source does string concatenation using pluses (e.g., String s = string1 + string2 + int1;) get desugared into an instantiation of a StringBuilder, with subsequent calls to append, ending with a call to toString? (if this is not actually currently done, what is the equivalent, and where in the javac source does it occur?)
    Thanks.
    FYI: I know that consecutive concatenated literals are combined into a single literal in com.sun.tools.javac.parser.JavacParser.foldStrings(JCTree), but I do not know where the desugaring involving non-literals occurs.
    As a side question, does the compiler also combine non-literals whose values are definitely known, e.g.:
    int i = 0;
    String s = "1";
    String t = i + s;
    t will always be set to "01", but neither of the two arguments to + are literals.

    Okay. Any particular problem you're looking to fix, or just picking this particular area out of general interest?No particular area, just whatever I see. It started out with investigating String/Builder/Buffer inefficiencies, because I noticed them a while ago, but it's grown to anything that I happen to notice.
    Add an instance field named currentDeterminantValue of type Object to whatever class represents a variable in javac. Also add a final static byte[] named NONDETERMINANT. If an assignment is to something that is known at compile time (e.g., a literal, a final variable (i.e. a constant), a determinant return of a final, private, or static method, etc.), then set currentDeterminantValue = <object or boxed primitive>. If the assignment is to something that is unknown at compile time, set currentDeterminantValue = NONDETERMINANT. Also add a method named isCurrentlyDeterminant() to the aforementioned class that performs {return currentDeterminantValue != NONDETERMINANT}. Whenever isCurrentlyDeterminant() is true, perform appropriate optimizations. A similar mechanism can be used for private, static, or final methods, as long as you cannot use reflection or some other weird mechanism to change their behavior. e.g., if the whole body of a final method is {return "ABC";}, then the currentDeterminantValue of the instance that represents that method in javac can be set to "ABC".I forgot to mention that NONDETERMINANT = new byte[] {}; It should also be private. Nothing special about byte[]. It could be an int[], an Object, etc, just an object that will never be used in a real call. An empty array should be the most memory-efficient way to create such a sentinel.
    Not really following that, but it sounds like this applies specifically to member variables, not locals. I don't think what you're suggesting can work for members. To recap your previous example:This would not apply to member or static variables, unless the assignment and use are in the same synchronized block, and all assignments to the variable are synchronized on the same object, and you can somehow disable or ignore the nefarious combination of java.lang.reflect.Class getDeclaredField and Field methods setAccessible and set, and any other similar sneaky tricks if they exist (using those three methods, you can even mutate “immutable” Strings). This would obviously be more difficult to detect than the case of local variables, but member / static variable determinacy determination could be implemented as a later improvement.
    String x = "1";
    int y = 2
    String z = x + y;If x, y, and z are member variables, then between the first and second or between the second and third assignment, another thread can modify x or y, so there's no way that the compiler can know that z will be "12", unless x and y are compile-time constants, and in that case, it already sets z to "12" at compile time.In my example that you've quoted above, the variables are all local.
    There are many complex additional optimizations that javac could perform, but they are probably more easily and comprehensively performed by the jvm given that it knows what other classes have been loaded and their bytecode.

  • My first step in Java, please help me.

    I've just installed J2SDK1.4.0_03 and I'm reading the first pages of the Java tutorial.
    I've created a work folder : C:\Java
    I'm working with an msdos session of windows 2000
    I've created my first example class, prthello.java with NotePad :
    class prthello{
    public static void main(String args[]) {
    System.out.println("Hello World!");
    I've successful compilated it (javac prthello.java) and generated the prthello.class
    I've tried to execute it (java prthello) but it doesn't work and i receive the following message :
    Exception in thread "main" java.lang.NoClassDefFoundError: prthello
    The path should be correct (C:\Programmi\j2sdk1.4.0_03\bin) ,
    any suggestions would be appreciate.
    Thanking in Advance
    Andrea Giussani
    Milano, Italy

    Thank you for your suggestions, but i have already checked.
    The path is ok, i've installed jsdk under folder "programmi" and the path is :
    C:\>set path
    Path=C:\WINNT\system32;C:\WINNT;C:\WINNT\System32\Wbem;C:\PROGRA~1\IBM\CLIENT~1;
    C:\PROGRA~1\IBM\CLIENT~1\Shared;C:\PROGRA~1\IBM\CLIENT~1\Emulator;C:\Programmi\F
    ile comuni\Autodesk Shared\;C:\Programmi\j2sdk1.4.0_03\bin
    PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH
    prthello.java and prthello.class are in the same folder (C:\java) where i executed javac with success and java with the error above mentioned.
    Any other suggestions ? Should I reinstall the JSDK ?
    Thanking in advance,
    Andrea Giussani

  • "Java file" & "Jsp file" compilation issues in Eclipse

    Hi,
    Eclipse
    Question 1:
    I have set the value for preference->java->Installed JREs as : j2re1.4.2_07 not to jdk
    When I write a java file, its compiling, how? From where its using "javac" exe file for compilation.
    Question 2:
    Whereas in prefrence->Tomcat->JVMSettings -> JRE(drop down box) set value as j2re.1.4.2_07
    When I write a jsp file as follows
    index.jsp
    <html>
    <body>
    <%java.util.Date d = new java.util.Date();%>
    Todays date is <%= d.getDate()%> and this jsp page worked!
    </body>
    </html>
    when i try to save this file & strat tomcat I got exception as follows:
    Exception:
    org.apache.jasper.JasperException: Unable to compile class for JSP
    An error occurred at line: -1 in the jsp file: null
    Generated servlet error:
    [javac] Compiling 1 source file
    Please clear my doubts.
    Thanks,
    Hari

    Try going into your TOMCAT_HOME/conf/web.xml and look for this section:
    <servlet>
    <servlet-name>jsp</servlet-name>
    <servlet-class>org.apache.jasper.servlet.JspServlet</servlet-class>
    <init-param>
    <param-name>logVerbosityLevel</param-name>
    <param-value>WARNING</param-value>
    </init-param>
    <init-param>
    <param-name>fork</param-name>
    <param-value>false</param-value>
    </init-param>
    <load-on-startup>3</load-on-startup>
    </servlet>
    Change the <param-value> for fork from false to true and see if that helps.
    Otherwise it's a problem with your JSP.

  • Importing 'my' packages

    My name is John and I an new to this forum.
    Would like some input from someone on importing user defined packages - something which I am having difficulties with.
    As of yet - I have been unable to import any of my packages successfully. Javac cannot find them.
    They are in a directory with the same name as the package, all package members are in that directory and the directory path just below my package directory is in the Classpath variable in autoexec.bat which the computer started up from. The package declaration is the first line in package member files and the import statements are 'import packagename.membername(or *);'
    I am using J2SDK 1.4.2_06 and have had no other problems with it. As long as any .java files are in the current directory as where I use javac from, everything compiles normally.
    I need to start organising my classes into packages and directories but so far have been unable to do so.
    If you think you know why or just have any suggestions about how to do this please reply.
    Regards
    John

    They are in a directory with the same name as the
    package, all package members are in that directory
    and the directory path just below my package
    directory is in the Classpath variable in
    autoexec.bat which the computer started up from.There's your problem. The CLASSPATH should contain the directory which contains your uppermost package, e.g. if you have package com.ejp and /usr/ejp/projects/src/com/ejp then CLASSPATH should contain /usr/ejp/projects/src.

  • Package javax.swing not found in import!

    I recently installed JDK 1.3.1_02 on WinNT4.0 and I cannot compile javax
    packages without getting the following error:
    Package javax.swing not found in import
    I've tried every combination of modifying the CLASSPATH system variable
    I can think of. I have no problem compiling java packages but not
    javax packages. I followed the installation instructions to the letter.
    What am I missing? Surely someone is running the same version of
    the JDK I am on WinNT 4.0.

    Thanks again!!! I had an older version of javac running on my system any time I ran
    outside of the bin where the latest javac was installed. I removed the older version
    of the jdk and now I can compile from any directory. I really appreciate the help,
    I was wracking my brain.
    By the way, -version is not a valid flag for javac.exe, although it is for java.exe.
    signed,
    grateful in cyberspace

  • I have started but have some problems

    hi :)
    Heloo,
    1) I downloaded the j2sdk1.4.1
    2) I wrote the code in a text file and save it wit the extension .java
    3) I wrote this command :
    C:\j2sdk1.4.1\bin>javac HelloWorldApp.java
    4) this error appeared to me:
    error: cannot read: HelloWorldApp.java
    5) I tried to remove the ".java" from the command but another error appeared whic is:
    javac: invalid flag: HelloWorldApp
    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
    -nowarn Generate no warnings
    -verbose Output messages about what the compiler is doing
    -deprecation Output source locations where deprecated APIs are u
    ed
    -classpath <path> Specify where to find user class files
    -sourcepath <path> Specify where to find input source files
    -bootclasspath <path> Override location of bootstrap class files
    -extdirs <dirs> Override location of installed extensions
    -d <directory> Specify where to place generated class files
    -encoding <encoding> Specify character encoding used by source files
    -source <release> Provide source compatibility with specified release
    -target <release> Generate class files for specific VM version
    -help Print a synopsis of standard options
    So .... what is the problem ???
    Question: Isnt there a java coder to avoid dealing with DOS, I hope so.. If yes ..where can I get it ?? "the link and the name fro the s/w plzzz".
    Thank you very very much....

    I want to tell you the complete dtory and tell me the solution for this problem
    1) I create a folder, C:java , I intended to save all my java code files inside it.
    2) I tried to compile my first java program by writing this command:
    C:\java>javac HelloWorldApp.java
    3)but this error occured.
    'javac' is not recognized as an internal or external command,operable program or batch file.
    4) You have gave me this link: http://java.sun.com/docs/books/tutorial/getStarted/cupojava/win32.html, I found the following note:
    The name specified is not recognized as an internal or external command, operable program or batch file (Windows NT)
    If you receive this error, Windows cannot find the Java compiler, javac.
    Here's one way to tell Windows where to find javac. Suppose you installed the Java 2 Software Development Kit in C:\jdk1.4. At the prompt you would type the following command and press Enter:
    C:\jdk1.4\bin\javac HelloWorldApp.java
    5) I did as the note in the above link says and I changed the old command to this new one:
    C:\j2sdk1.4.1\bin>javac HelloWorldApp.java
    6) but this error has been occured
    error: cannot read: HelloWorldApp.java
    1 error
    7) AFTER ALL THIS DTORY , HOW CAN I START RUN MY FIRST PROGRAM ????

  • Command line tools for xcode??

    I am used to compiling code much like the java sdk works from terminal where I say javac the filename and then i get a .class file that i can run by doing the command java and then the .class file after. I am now wanting to learn c++ and I dont feel like installing xcode all i want is a compiler that can run from terminal. i found command line tools for xcode on the apple developers site and i was wondering do i need xcode for this to run and after that what the commands are and how i compile/run the code. But my biggest question is still wether or not i need xcode to let command line tools work. ive read in a couple places i dont need it but in other ive read you do can i get help?!

    You don't need Xcode to compile your apps with; just the compiler/linker.
    Xcode is Apple's IDE.  One could write the same code in TextEdit but that wouldn't be easy nor fun.
    (Missed it by THAT much!) 

  • How to run java program created in Sun Java Studio

    Hi All,
    sorry for easy question. I'm new in java.
    I have created Swing/AWT application with Sun Java Studio. I can run it using Sun Java Studio and it works properly. How to run this application in DOS-promt using "java ....."? I think, I shall define all classpathes but I dont know exactly.
    Enviroment:
    WinXP
    Sun Java Studio (C:\Sun\studio5u1_se)
    SDK (C:\Sun\j2sdk1.4.2_04)
    Application files (C:\Sun\My)
    Thanks.

    change this to yours
    set path=c:\j2sdk1.4.1_01\bin;c:\j2sdk1.4.1_01\jre\bin;%path%
    set classpath=c:\j2sdk1.4.1_01\lib;c:\jdk1.4.1_01\jre\lib;%classpath%
    go to directory where code is
    javac CLASSNAME.java
    then to run it
    java CLASSNAME
    note also look at executable jar files

  • How to complile java programs?

    Hi, everyone
    I have a problem.I am working with eclipse and i have never tried to compile a java program with the dos. i think that the steps to do this are:
    "I have a project on Desktop in a folder named Tdma.There are some java files in this folder(each for a class) and the Tdma.java has the main method.Then i open a cmd window and i am doing the 2 steps bellow "
    1.javac -classpath C:\Documents and Settings\p@ly\Desctop\Tdma Tdma.java
    2.java Tdma
    But in the 1st step i get this output: ' javac is not recognised as an internal or external command...'
    Can anyone help me?
    thanx

    you need to set your path variable so the windows knows where to find javac.exe Here is where you can read how to do it
    http://java.sun.com/docs/books/tutorial/getStarted/problems/index.html

  • My compiler wont run

    I have been creating programs at school for the last year or so. Now i try to do one at home but i cant even get the compiler to work. i just get an error that says:
    --------------------Configuration: j2re1.4.1_01 <Default>--------------------
    Invalid command line. Error : Invalid path
    Command : "C:\Program Files\Java\j2re1.4.1_01\bin\javac.exe" -classpath "C:\Documents and Settings\Owner\My Documents" -d "C:\Documents and Settings\Owner\My Documents" "C:\Documents and Settings\Owner\My Documents\Account.java"
    Directory : C:\Documents and Settings\Owner\My Documents
    Process completed.
    i dont understand, do i have to save my program to a different file? or change my compiler path?? Please help

    I'm not sure i understand what u mean by where i call
    javac from. I found the file, in
    C:j2sdk1.4.1_01/bin/javac.exe but i cant seem to find
    a way to change the path so that my compiler goes from
    there.Your compiler, javac.exe, is there.
    Are you confusing the compiler with your editor?
    What editor are you using?

  • Generics: compiler bug or not?

    Hi.
    I faced with some strange issue, which may be described as follows:
    import java.util.Collections;
    import java.util.List;
    public class Test<T> {
        public List<String> getStrings() {
            return Collections.emptyList();
        public static void main(String[] args) {
            Test test = new Test();
            for (String s : test.getStrings()) { // first
                System.out.println(s);
            Class aClass = test.getClass();
            Deprecated annotation = aClass.getAnnotation(Deprecated.class); // second
    }The lines commented as "first" and "second" cause compilation error "incompatible types". The problem can be fixed the following way:
            Test<?> test = new Test();
            for (String s : test.getStrings()) { // first
                System.out.println(s);
            Class<?> aClass = test.getClass();
            Deprecated annotation = aClass.getAnnotation(Deprecated.class); // secondBut why does it appearat all?
    Regards,
    Maxim

    Might be better off sticking this in the generics
    forum, since Mr von der Ahe hangs around there so
    much. Although I'm not convinced he'd concede that
    ECJ got it right where his beloved javac didn't :-)Ok, I will cross post (and flag it as a cross post). I remember that I had another thread there, a long time ago, and Eclipse was correct at that time :)
    Kaj

Maybe you are looking for

  • Ati drivers no longer work after upgrade

    I was trying to mount a vfat partition the other day, to copy files from a friends USB drive. It would not mount no matter what I did. I had found out that for some reason, the last kernel that I updated to did not have the proper character set enabl

  • WMF format equations available/missing fonts not displayed/alerted

    WMF format equations fonts are not displayed in the applications, If any fonts used on that equations is missing in the system the indesign will not show/alert any missing font warring to the user and the substitute fonts replaced automatically for t

  • Stumped the Tech Guys...

    Alrighty, I just spent 1 hr 45 min on the phone with an Adobe Tech named Dan, and didn't get this problem solved. If anyone on this forum knows the solution, you would be a living god to me. (Brand New) HP xw8600 Workstation Intel Xeon 3.00 GHz Proce

  • How to determine patch bundle level?

    Hi, there, Newb to Exadata here (apologies if this is obvious). We're looking to upgrade our Exadata machine (v2) from 11.2.0.1 to 11.2.0.2 and we need to know which patch bundle we're currently on. I tried figuring it out myself and I can't find how

  • Managing apps via iTunes 12 causes crash

    When installing apps via iTunes 12, opening the graphic view of the destination page and either clicking on the "install" button for the app or attempting to drag the icon from the list to the desired page on the device usually causes iTunes itself t