Javac trouble

I have searched the forums and have found others with my problem but the solutions are not helping me with my problem. I am new to Java and am trying to use "Learning Java 3rd Edition" by Patrick Niemeyer & Jonathan Knudsen. The book recomends we learn to write Java using the command line and I agree with that but I am not able to do anything in my shell window because when I start my shell and type javac HelloJava.java I get a message stating
'JAVAC' is not recognizable as an internal or external command, operable program or batch file
I have installed and uninstalled JDK 5.0 many times with the same result. I have searched my disk for any javac files and I have found 5
JAVAC.EXE-042C5E09.pf path = C:\WINDOWS\Prefetch
JAVAC.EXE-1D15F5CB.pf path = C:\WINDOWS\Prefetch
javac path = C:\Java\jdk1.6.0\bin
javac path = C:\Program Files\Macromedia\Dreamweaver 8\JVM\bin
javac path = bin
When I start my shell I have to cd\ to change directories because it defaults to C:\DOCUME~1\TIMSHO~1> I don't know if that is any part of my problem but I can't find any folders with DOCUME~1\TIMSHO~1 as the name. I just cd\ to the C:\> prompt.
I have installed the JDK to my C drive and not to my program files but I have also tried installing to Program files as the default installation recomends. Neither way has had any different results.
I have seen some instructions on this forum for others with this issue that talk about setting javac's path in the control panel but I don't know what file I am trying to set the path for.
I am sorry for sounding so helpless but I have been trying to get this working for a few days now and am becoming frustraited. I do not want to use Eclipse or NetBeans for the exercises in the book. I would like to learn the hard way and then work with the different IDEs.
I have the JDK and the JRE both installed but the JRE is in my program files and JDK in my C root. I have tried to uninstall the JRE as other posts have recomended and the book's trouble shooting has mentioned but that is not doing anything for me either.
Can someone please help me through this so I can start learning Java?

.> It
has nothing to do with javac.exe being missing or
misnamed.
javac: file not found: HelloJava.java
Usage: javac <options> <source files>
use -help for a list of possible options>
I have read this but aparently what it seems to say
to me is not what it really is intending to express.It's expressing exactly what it means to. You're just not understanding it.
Looking at that error message I see it saying javac
is not found, I don't agree. It would not have displayed the "usage" message if it couldn't find javac.exe. That's what is printing the usage message.
therefore HelloJava.java is moot. Not moot - the whole point, really.
I see
usage javac. So being confused about what the message
says and not reading the message are two entirely
different things.No, it's only about one thing. You keep confusing it with the other.
.> If you would like to help me understand what is
wrong, that's wonderful and I thank you. All I can
say about this exercise is that it is the 1st thing I
am told to type into the command prompt. What it
means is not explained. I guess the author assumes
someone new to java knows what that means. This is
supposed to be a beginners book. Right, but they're supposed to be beginners who can think for themselves a bit and don't assume that they're correct in every thought they have.
I have an associates in CS. I have learned other
languages like C++, VB 6.0 and VB.NET, etc... to name
a few but I am still new to this and brand spanking
new to Java. We see that. Your associate degree in CS is meaningless here, because you're on new ground. It's valuable in the sense that it says you've learned in the past, but that's not helping you now. Leave your credentials out of this.
I have never programmed from the command
prompt. I had one course on DOS and that was over two
years ago. I am glad people want to help. Be gentile.
=) I love to learn.I think people are being gentle. This is hardly a flame job.
Right now I do not know what the solution is. I have
downloaded the JDK as directed. I learned how to set
the path, which was my origional problem. Thanks guys
for the help on that. I still can't write code in the
command prompt. Why? Because I do not have any more
instructions beyond the ones I have done thus far.
Type the given command and press enter.
C:\> javac HelloJava.java
javac: file not found: HelloJava.java
Usage: javac <options> <source files>
use -help for a list of possible optionsYes, it's appropriate for this stage.
That is better than,
'JAVAC' is not recognizable as an internal or
external command, operable program or batch fileBut the original message was appropriate for what you were doing wrong.
but still not where I need to be.
Message was edited by:
TazimshiJoe gave you a good suggestion: if you're editing with Notepad, you might have a .txt hidden at the end of the file type that keeps javac.exe from finding that HelloJava.java source file.
%

Similar Messages

  • Trouble making path work for 'javac' is not recognized as an intern...

    Hi -
    I am trying to compile my HelloApp.java program and I get this message: 'javac' is not recognized as an internal or external command, operable program or batch file
    I know to go into the system and change my Environment Variable, but I'm not sure what to change it to. Right now I have it as: ...ger\;C:\foo\bar\> C:\java\samples\bin\javac Filename.java
    I've just installed java_app_platform_sdk-5_01-windows.
    Will you please give me step-by-step instructions to make my compiler work?
    Thank you.

    Its already solved: i installed with de windows installer (jdk-1_5_0_10-windows-i586-p.exe) jdk and jre in the same folder. With another installer (jdk-6-rc-windows-i586), in separate folders: no problem. Thank you.

  • Trouble with adding javac.exe to PATH

    I saw a few similar posts, but none seem to help me fix this. I have updated my Environmental Variables >> PATH to include the C:\Program Files\Java\jdk1.6.0_14\bin directory.
    When I am in C:\Program Files\Java\jdk1.6.0_14\bin directly, both java - version, and javac -version commands return appropriate results.
    When I shell back to C:\>, java -version works fine, however c:\>javac -version yields the following error:
    'javac' is not recognized as an internal or external command, operable program or batch file
    Any thoughts? Are there programs that will get me straight to an environment where I can code and compile in windows without having to worry about where to compile in the windows shell? Maybe one of those programs will automatically correct for this situation? (It might also help me with my sytax dyslexia as well!!)
    Thanks in advance!!
    Don

    Sounds like,
    1)PATH is still not set properly. or
    2)You have not restarted cmd prompt after setting path.(type "set" in cmd prompt and confirm if it is set or not).
    Any thoughts? Are there programs that will get me straight to an environment where I can code and compile in windows without having to worry about where to compile in the windows shell? Maybe one of those programs will automatically correct for this situation? (It might also help me with my sytax dyslexia as well!!)Well you could use an IDE but it is better to know these things first IMHO.
    tommickey

  • Trouble starting javac on Macintosh

    I'm absolutely new to Java, but need to get to know it for a scholl project. Here is my problem:
    Having downloaded MRJ and MRJ SDK 2.2 from the web I tried to start it on our G3 Mac. But I always get an error message:
    The main class "com/apple/mrj/sdk/apps/Javac" could not be loaded. Either it is not in the calsspath, or it has a static initialiser not in the classpath."
    How do I go about getting javac to open???
    Please help.
    Laura Pennington

    How exactly are you trying to invoke javac? I use MPW on Mac OS 9.1 and so I have shell script that invokes javac for me. Works like a charm.

  • Javac not found in cygwin

    Hi,
    I'm relatively new to Java. I've been using NetBeans to run my programs. I'm having trouble running java applications from cygwin. When I type:
    javac Main.java
    in the directory containing my source files, I get the following error message:
    bash: javac: command not found
    I don't understand this because I have javac installed in
    C:\Program Files\Java\jdk1.5.0_07\bin
    Could it be because I'm one of several users on this machine and need to have Java installed on my personal account?
    Thanks,
    Malcolm

    You need to add C:\Program Files\Java\jdk1.5.0_07\bin
    to your PATH environment variable, which is best done
    in your .bashrc file.Completely personal prefrence I know, but I'd do it in the System control panel.
    It will only piss you off when you use Window Shell, and javac is not in the PATH.
    Screen shot HOWTO

  • Trouble with class

    I am unable to figure out what I am having trouble with this, here is the code
    public class Tools3
        protected long item_number;
        protected String product_name;
        protected long units_in_stock;
        protected double price_of_each_unit;
        protected static double total_price_of_inventory;
    public Tools3( long pitem_number, String pproduct_name, long punits_in_stock, double pprice_of_each_unit)
       item_number = pitem_number;
       product_name = pproduct_name;
       units_in_stock = punits_in_stock;
       price_of_each_unit = pprice_of_each_unit;
       total_price_of_inventory = punits_in_stock * pprice_of_each_unit;
    // Overloaded constructor for empty balance
    public Tools3()
       item_number = 0;
    public void set_item_number( long pitem_number )
       item_number = pitem_number;
    public void set_product_name( String pproduct_name )
       product_name = pproduct_name.toString();
    public void set_units_in_stock( long punits_in_stock )
       units_in_stock = punits_in_stock;
    public void set_price_of_each_unit( double pprice_of_each_unit )
       price_of_each_unit = pprice_of_each_unit;
    public long get_item_number()
       return item_number;
    public String get_product_name()
       return product_name;
    public long get_units_in_stock()
       return units_in_stock;
    public double get_price_of_each_unit()
       return price_of_each_unit;
    public double calculate_total_price()
       return units_in_stock * price_of_each_unit;
    public double calculate_total_price_of_inventory(Tools3[] mytools)
       double rettotal = 0;
       for (int i = 0; i < mytools.length; i++)
        rettotal = rettotal + (mytools.get_units_in_stock() * mytools.get_price_of_each_unit());
       return rettotal;
      public void sort_by_names(Tools3[] mytools)
      int a,b;
      int sortTheStrings = mytools.length - 1;
      String tempproduct_name;
      long tempitem_number;
      long tempunits_in_stock;
      double tempprice_of_each_unit;
        //need to implement a bubble sort here
        for (a = 0; a < sortTheStrings; ++a)
      for (b = 0; b < sortTheStrings; ++b)
      if(mytools.product_name.compareTo(mytools[b + 1].product_name) >0)
        //move name
        tempproduct_name = mytools.product_name;
        mytools.product_name = mytools[b+1].product_name;
        mytools[b+1].product_name = tempproduct_name;
        //move item_number
        tempitem_number = mytools.item_number;
        mytools.item_number = mytools[b+1].item_number;
        mytools[b+1].item_number = tempitem_number;
        //move units_in_stock
        tempunits_in_stock = mytools.units_in_stock;
        mytools.units_in_stock = mytools[b+1].units_in_stock;
        mytools[b+1].units_in_stock = tempunits_in_stock;
        //move price_of_each_unit
        tempprice_of_each_unit = mytools.price_of_each_unit;
        mytools.price_of_each_unit = mytools[b+1].price_of_each_unit;
        mytools[b+1].price_of_each_unit = tempprice_of_each_unit;
    //end of tools3.java class

    Results from javac
    C:\Java>javac Tools3.java
    Tools3.java:77: cannot find symbol
    symbol  : method get_units_in_stock()
    location: class Tools3[]
        rettotal = rettotal + (mytools.get_units_in_stock() * mytools.get_price_of_e
    ach_unit());
                                      ^
    Tools3.java:77: cannot find symbol
    symbol  : method get_price_of_each_unit()
    location: class Tools3[]
        rettotal = rettotal + (mytools.get_units_in_stock() * mytools.get_price_of_e
    ach_unit());
                                                                     ^
    Tools3.java:94: cannot find symbol
    symbol  : variable product_name
    location: class Tools3[]
      if(mytools.product_name.compareTo(mytools[b + 1].product_name) >0)
                ^
    Tools3.java:97: cannot find symbol
    symbol  : variable product_name
    location: class Tools3[]
        tempproduct_name = mytools.product_name;
                                  ^
    Tools3.java:98: cannot find symbol
    symbol  : variable product_name
    location: class Tools3[]
        mytools.product_name = mytools[b+1].product_name;
               ^
    Tools3.java:101: cannot find symbol
    symbol  : variable item_number
    location: class Tools3[]
        tempitem_number = mytools.item_number;
                                 ^
    Tools3.java:102: cannot find symbol
    symbol  : variable item_number
    location: class Tools3[]
        mytools.item_number = mytools[b+1].item_number;
               ^
    Tools3.java:105: cannot find symbol
    symbol  : variable units_in_stock
    location: class Tools3[]
        tempunits_in_stock = mytools.units_in_stock;
                                    ^
    Tools3.java:106: cannot find symbol
    symbol  : variable units_in_stock
    location: class Tools3[]
        mytools.units_in_stock = mytools[b+1].units_in_stock;
               ^
    Tools3.java:109: cannot find symbol
    symbol  : variable price_of_each_unit
    location: class Tools3[]
        tempprice_of_each_unit = mytools.price_of_each_unit;
                                        ^
    Tools3.java:110: cannot find symbol
    symbol  : variable price_of_each_unit
    location: class Tools3[]
        mytools.price_of_each_unit = mytools[b+1].price_of_each_unit;
               ^
    11 errors

  • Trouble compiling package with JDK 1.4

    Hi,
    I just installed JDK 1.4 on a new machine, now I have trouble running compile scripts that used to work on my old machine. The old an new are configured with Win 2000. The following compiles without problem:
    javac -classpath "..." -d "..." "c:\.....\com\...\some package\MyClass.java"
    Changing this statemetn to:
    javac -classpath "..." -d "..." "c:\.....\com\...\some package\*.java"
    should compile all Java files in 'some package', instead what I get is the following error message:
    error: cannot read: c:\.....\com\...\some package\*.java
    The documentation says that this should still work. Anyone aware of changes in 1.4 that could cause this problem?
    Thanks for responding

    As a work-around, you can use some Unix-styled shell (that is, command processor) which expands the *.expression into the list of the matching file names, thus releaving javac from this task. (Caveat: directory names with a space inside will cause problems.)
    I can recommend the Cygnus package (including the command processor "bash") or "MinGW", the Minimalist GNU For Windows with its simpler sh:
    http://www.mingw.org/
    ftp://ftp.franken.de/pub/win32/develop/gnuwin32/mingw32/porters/Mikey/

  • Computer restarting when running javac.exe

    Hi...i am new to Java.
    I have a problem, when I compile my java file using javac myfilename.java then suddenly my computer restarting itself...
    This happens many times on my computer...Is there anybody know the reason?
    Thanks

    This is an odd problem. Apart from viruses, the usual reason for an unexpected restart is some kind of driver problem, since in XP this often triggers an automatic restart instead of a blue screen (what a creative approach to ridding the world of the BSOD ;-)
    It doesn't seem likely to be a graphics problem, since it occurs with non GUI apps, but just so you know, ATI cards are particularly prone to trouble.
    Install any pending service packs, and update your SDK to 1.4.1_02 if you haven't done so already. Change your graphics drivers to the newest available set.
    That should knock the problem on the head, hopefully.

  • Having trouble compiling

    I am a total newbie at programming and I am having trouble compiling. In the MS-DOS prompt, I located the folder where my .java file is located and typed the following:
    javac SampleProgram.java
    I received a "Bad command or file name" error. I am typing the names correctly. I am using Java 2 SDK, Standard Edition Version 1.3.1. Am I doing something wrong?
    Thanks for any help.

    That should fix it. The problem is that DOS needs to know where to find the executable files like javac.exe
    You can either set the path temporarily by typing
    SET PATH=.;c:\jdk1.3.1\bin
    at the command prompt each time you open a command window, or you can set it more permanently by adding it to your startup config. This will depend on your OS. On win 98 for example, there is an AUTOEXEC.BAT (usually with a SET PATH command already present). You could open this in notepad to add/change:
    SET PATH=C:\WINDOWS
    to
    SET PATH=C:\WINDOWS;.;C:\JDK1.3.1\BIN
    Reboot to make the changes take effect. Other OS's may have a special dialog to set this kind of command.
    Hope this helps some.

  • Javac message question

    Hi,
    I'm having trouble understanding why the compiler is refusing my code. I think the reason might be in how I've set up the classpath, but anyway there is a message I don't understand. Here is the message:
    [javac] C:\surveys\mbq3_03\misc\mb_javascript\src\UrlManager.java:85: inco
    mpatible types
        [javac] found   : java.sql.Connection
        [javac] required: Connection
        [javac]                     con   = DriverManager.getConnection(dbUrl);
        [javac]                                                            ^Why is it not accepting the java.sql.Connection? (The dbUrl above is String)
    Bellow is how my class starts and also the complete output from the compiler.
    Thank you.
    Dimitre
    =======================
    import java.util.*;
    import java.util.regex.*;
    import java.io.*;
    import java.sql.*;
    import org.apache.log4j.*;
    //A simple application to manage the trigger urls for the
    //mb survey. The urls come with some additional parameters.
    //No multythreading.
    public class UrlManager {
         private static Logger log;
         static{
              PropertyConfigurator.configure(System.getProperty("LOG4J_PROPS"));
              log = Logger.getLogger("debug");
         public static void main(String[] args){
              //args[0] should be the full name of a tab delimited file
              //with the new and updated urls
              //When split into String[] this is what each line should be like:
              //[0] - nothing
              //[1] - module id
              //[2] - module name
              //[3] - nothing
              //[4] - rate
              //[5] - nothing
              //[6] - expiration
              //[7] - url_address
              //[8] - isDynamic
              //[9] - isLive
              //args[1] if present should be un output file for a report
              int MODULE_ID_INDEX = 1;
              int MODULE_NAME_INDEX = 2;
              int RATE_INDEX = 4;
              int EXPIRES_INDEX = 6;
              int URL_ADDRESS_INDEX = 7;
              int IS_DYNAMIC_INDEX = 8;
              int IS_LIVE_INDEX = 9;
              if(args.length < 1){
                   System.out.println("args[0] must be a tab delimited file with the urls.");
                   System.out.println("Fix the 'argument01' in the build.properties file.");
                   return;
              PrintStream report = null;
              if(args.length < 2){
                   System.out.println("Using System.out for report output.");
                   report = System.out;
              }else{
                   try{
                        report = new PrintStream(
                                                 new BufferedOutputStream(
                                                      new FileOutputStream(args[1])));
                        System.out.println("See log information in: " + args[1]);
                   catch(IOException e){
                        System.out.println("Using System.out for report output. See log for info.");
                        log.info(e.toString());
                        report = System.out;
              log.info("Updating the mb urls with the data in: " + args[0]);
              System.out.println("Updating the mb urls with the data in: " + args[0]);
              try{
                   Class.forName("com.mysql.jdbc.Driver").newInstance();
              catch(ClassNotFoundException e){log.info(e.toString());}
              catch(InstantiationException e){log.info(e.toString());}
              catch(Exception e){log.info(e.toString());}
              //the 'mb_urls' is the name of teh database that holds the urls
              String dbUrl = "jdbc:mysql://localhost/mb_urls?user=mitirino";
              Connection con  = null;
              Statement stmnt = null;
              try{
                   con   = DriverManager.getConnection(dbUrl);
                   stmnt = con.createStatement();
    .......====================
    And here is what I get when I try to compile...
    ====================
    C:\surveys\mbq3_03\misc\mb_javascript>ant clean compile run
    Buildfile: build.xml
    init:
         [echo] ------- TriggerUrl -------
         [echo] JAVA_HOME: C:\j2sdk1.4.1_01
         [echo] CLASSPATH: .;C:\jakarta-log4j-1.2.7\dist\lib\log4j-1.2.7.jar;C:\jai-
    1_1_2-rc\lib\jai_codec.jar;C:\jai-1_1_2-rc\lib\jai_core.jar;C:\jai-1_1_2-rc\lib\
    mlibwrapper_jai.jar;C:\java\MachineVision\neatvision.jar;C:\java\MachineVision\d
    eveloper.jar;
    clean:
       [delete] Deleting directory C:\surveys\mbq3_03\misc\mb_javascript\classes
    init:
         [echo] ------- TriggerUrl -------
         [echo] JAVA_HOME: C:\j2sdk1.4.1_01
         [echo] CLASSPATH: .;C:\jakarta-log4j-1.2.7\dist\lib\log4j-1.2.7.jar;C:\jai-
    1_1_2-rc\lib\jai_codec.jar;C:\jai-1_1_2-rc\lib\jai_core.jar;C:\jai-1_1_2-rc\lib\
    mlibwrapper_jai.jar;C:\java\MachineVision\neatvision.jar;C:\java\MachineVision\d
    eveloper.jar;
    prepare:
        [mkdir] Created dir: C:\surveys\mbq3_03\misc\mb_javascript\classes
    compile:
        [javac] Compiling 1 source file to C:\surveys\mbq3_03\misc\mb_javascript\c
    lasses
        [javac] C:\surveys\mbq3_03\misc\mb_javascript\src\UrlManager.java:85: inco
    mpatible types
        [javac] found   : java.sql.Connection
        [javac] required: Connection
        [javac]                     con   = DriverManager.getConnection(dbUrl);
        [javac]                                                            ^
        [javac] C:\surveys\mbq3_03\misc\mb_javascript\src\UrlManager.java:86: cann
    ot resolve symbol
        [javac] symbol  : method createStatement ()
        [javac] location: interface Connection
        [javac]                     stmnt = con.createStatement();
        [javac]                                    ^
        [javac] C:\surveys\mbq3_03\misc\mb_javascript\src\UrlManager.java:115: can
    not resolve symbol
        [javac] symbol  : method close ()
        [javac] location: interface Connection
        [javac]                                     con.close();
        [javac]                                            ^
        [javac] C:\surveys\mbq3_03\misc\mb_javascript\src\UrlManager.java:159: can
    not resolve symbol
        [javac] symbol  : method prepareStatement (java.lang.String)
        [javac] location: interface Connection
        [javac]             PreparedStatement addUrl = con.prepareStatement("" +
        [javac]                                               ^
        [javac] C:\surveys\mbq3_03\misc\mb_javascript\src\UrlManager.java:164: can
    not resolve symbol
        [javac] symbol  : method prepareStatement (java.lang.String)
        [javac] location: interface Connection
        [javac]             PreparedStatement addModule = con.prepareStatement("" +
        [javac]                                                  ^
        [javac] C:\surveys\mbq3_03\misc\mb_javascript\src\UrlManager.java:230: can
    not resolve symbol
        [javac] symbol  : method prepareStatement (java.lang.String)
        [javac] location: interface Connection
        [javac]             PreparedStatement getUrls = con.prepareStatement("" +
        [javac]                                                ^
        [javac] 6 errors
    BUILD FAILED
    file:C:/surveys/mbq3_03/misc/mb_javascript/build.xml:29: Compile failed; see t
    he compiler error output for details.
    Total time: 9 seconds

    No (I think so). But it doesn't matter see...Yes, it does matter. The compiler is saying "Look, on the right-hand side of the = you have a java.sql.Connection reference, and on the left-hand side you have a Connection variable, and you can't do that assignment."
    That means the compiler has decided that Connection does not mean java.sql.Connection, it means something else in the classpath. If there was another Connection class in a named package, you would be getting messages about conflicts (like if you import java.util.* and java.sql.* and then try to use Date). So this other Connection class must be in an unnamed package.

  • Compiling trouble

    I am currently reading "Thinking in Java" 3rd edition by Bruce Eckel but am having trouble compiling his source code. I think it has something to do with path or classpath.
    Here is the source and compiler errors.
    import com.bruceeckel.simpletest.*;
    class Number {
    int i;
    public class Assignment {
    static Test monitor = new Test();
    public static void main(String[] args) {
    Number n1 = new Number();
    Number n2 = new Number();
    n1.i = 9;
    n2.i = 47;
    System.out.println("1: n1.i: " + n1.i +
    ", n2.i: " + n2.i);
    n1 = n2;
    System.out.println("2: n1.i: " + n1.i +
    ", n2.i: " + n2.i);
    n1.i = 27;
    System.out.println("3: n1.i: " + n1.i +
    ", n2.i: " + n2.i);
    monitor.expect(new String[] {
    "1: n1.i: 9, n2.i: 47",
    "2: n1.i: 47, n2.i: 47",
    "3: n1.i: 27, n2.i: 27"
    } ///:~
    G:\javaTutSource\c03>javac Assignment.java
    g:\javaTutSource\com\bruceeckel\simpletest\Test.java:9: package java.util.regex
    does not exist
    import java.util.regex.*;
    ^
    g:\javaTutSource\com\bruceeckel\simpletest\TestStream.java:9: package java.util.
    regex does not exist
    import java.util.regex.*;
    ^
    g:\javaTutSource\com\bruceeckel\simpletest\Test.java:24: cannot resolve symbol
    symbol : method getStackTrace ()
    location: class java.lang.Throwable
    new Throwable().getStackTrace()[1].getClassName();
    ^
    g:\javaTutSource\com\bruceeckel\simpletest\TestExpression.java:6: package java.u
    til.regex does not exist
    import java.util.regex.*;
    ^
    g:\javaTutSource\com\bruceeckel\simpletest\TestExpression.java:9: cannot resolve
    symbol
    symbol : class Pattern
    location: class com.bruceeckel.simpletest.TestExpression
    private Pattern p;
    ^
    g:\javaTutSource\com\bruceeckel\simpletest\Test.java:44: cannot resolve symbol
    symbol : constructor RuntimeException (java.io.IOException)
    location: class java.lang.RuntimeException
    throw new RuntimeException(e);
    ^
    g:\javaTutSource\com\bruceeckel\simpletest\Test.java:67: cannot resolve symbol
    symbol : constructor RuntimeException (java.lang.InterruptedException)
    location: class java.lang.RuntimeException
    throw new RuntimeException(e);
    ^
    g:\javaTutSource\com\bruceeckel\simpletest\TestStream.java:50: cannot resolve sy
    mbol
    symbol : constructor RuntimeException (java.io.FileNotFoundException)
    location: class java.lang.RuntimeException
    throw new RuntimeException(e);
    ^
    g:\javaTutSource\com\bruceeckel\simpletest\TestExpression.java:19: cannot resolv
    e symbol
    symbol : variable Pattern
    location: class com.bruceeckel.simpletest.TestExpression
    this.p = Pattern.compile(expression);
    ^
    9 errors
    Any help will be appreciated as i really want to lean java!!!

    See if this helps with how packages are structured.
    Assume that your programs are part of a package named myapp, which is specified by this first line in each source file: package myapp;
    Also assume that directory (C:\java\work\) is listed in the CLASSPATH list of directories.
    Also assume that all your source files reside in this directory structure: C:\java\work\myapp\
    Then a statement to compile your source file named aProgram.java is:
    C:\java\work\>javac myapp\aProgram.java
    Explanation:
    Compiling
    A class is in a package if there is a package statement at the top of the class.
    The source file needs to be in a subdirectory structure. The subdirectory structure must match the package statement. The top subdirectory must be in the classpath directory.
    So, you generate a directory structure C:\java\work\myapp\ which is the [classpath directory + the package subdirectory structure], and place aProgram.java in it.
    Then from the classpath directory (C:\java\work\) use the command: javac myapp\aProgram.java
    Running
    Compiling creates a file, aProgram.class in the myapp directory.
    (The following is where people tend to get lost.)
    The correct name now, as far as java is concerned, is the combination of package name and class name: myapp.aProgram (note I omit the .class) If you don't use this name, java will complain that it can't find the class.
    To run a class that's NOT part of a package, you use the command: java SomeFile (assuming that SomeFile.class is in a directory that's listed in the classpath)
    To run a class that IS part of a package, you use the command java myapp.aProgram (Note that this is analogous to the command for a class not in a package, you just use the fully qualified name)

  • 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.

  • Compiling troubles

    I'm working on a project to help out with school. I have 2 files: TextPad.java and Editor.java. Both are in the package "textpad". TextPad.java will compile w/o any troubles however when I try to compile Editor.java, javac states that it cannot resolve the symbol:
    Symbol : class TextPad
    location : class textpad.Editor
    JFrame window = new TextPad();
    TextPad DOES have a constructor and the class extends JFrame. Both files are in the same directory and package but Editor will not compiler. Does any one have any ideas?
    Thanks
    MT

    Hi, I am working on rmi but with similiar compilation error as the first post.
    I�@am following the example used in TRAIL: RMI of the Java Tutorial. It worked very well on compiling client classes, ie, ComputePi.java and Pi.java.
    But, I just use another java program to replace Pi.java and modified the corresponding computePi.java as follows and name it as ComputeProgress.java:
    package client;
    import java.rmi.*;
    import compute.*;
    public class ComputeProgress {
    public static void main(String args[]) {
    if (System.getSecurityManager() == null) {
    System.setSecurityManager(new RMISecurityManager());
    try {
    String name = "//" + args[0] + "/Compute";
    Compute comp = (Compute) Naming.lookup(name);
    ConeYoyoApp task = new ConeYoyoApp();
    comp.executeTask(task);
    } catch (Exception e) {
    System.err.println("ComputeProgress exception: " + e.getMessage());
    e.printStackTrace();
    Actually, I place both ComputerProgress.java and ConeYoyoApp.java in e:\thesis\client but errors occured as unsolve symbol for ConYoyoApp when compile ComputeProgress.java.
    Can any body tell me if I need to compile ConYoyoApp.java before ComputeProgress.java? (but even I did that, it did not work!) Actually, any expert can tell me how the javac locates those classes referred in the java file?
    Thanks very much in advance!

  • Javac and tools.jar

    I'm having real trouble upgrading from 1.1.8 and getting on with tutorials. In summary SuSE 7.3 said it was installing java 1.2 however -version said I was running 1.1.8. I could not use swing components so I tried installing 1.4. I had problems getting that going but have now managed to sort out the classpath so that -version is 1.4.0.
    Unfortunately now javac now gives me command not found. I have had a read of material and see I should have a path to tools.jar. There is one in 1.3.1 should I also set a path to that but more importantly have I not got all that I need by downloading 1.4.0, if not what else should I have downloaded and installed.
    Help please all I wanted to do was learn java but I can't get going
    Richard

    Hi, how silly of us not to notice... that PATH command needs to point to the /bin directory in your jdk... /usr/java/j2re1.4.0/bin ...So sorry not to noticed that right off!
    Its good to set a JAVA_HOME environment variable, and then you can just use:
    export JAVA_HOME=/usr/java/j2re1.4.0
    export CLASSPATH=$CLASSPATH:$JAVA_HOME/lib/tools.jar
    export PATH=$PATH:$JAVA_HOME/bin
    Other things (like tomcat and stuff) will find that JAVA_HOME variable and things will install better in the future. Watch too, you had a space before /lib (likely a typo in the post?) If that fails ...cd into that bin directory ...if still there is no javac ...something went wrong with the install!
    Good luck with this, we will watch for your success.

  • 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.

Maybe you are looking for

  • Can I disable plugin-container.exe in 20.0.1 and still stream video?

    When I try to stream TV shows with Firefox, I receive high Firefox disc usage warnings from my Norton antivirus. I believe this is due to the gigantic plugin-container.exe that Firefox apparently runs the Flash player inside of. When I look at it in

  • Wrong Plant in the follow on document(PO) of SC in SRM

    Hi Experts, I need urgent input for this issue, We have SRM 7.0 and ECC 6.0 EHP5 with Classic scenario, We have created FO SC in SRM for the Plant A, After creating PO through SOCO, PO has wrong plant with the same company code, This issue is only in

  • Object file handling giving java.io.StreamCorruptedException

    Hi All, I am storing and retriving objects from a file. but when i write multiple objects then while reading objects from the file its giving java.io.StreamCorruptedExceptionPlease advice. Here's the code import java.io.*; class Person implements Ser

  • Can't open documents or blank.template

    I have an older MacBook with Pages 1.0.2. It can't open a new document, saying that Blank.template cannot be found. I downloaded Pages docs from Dropbox and from Pages on my iPod, and it won't open those either. Help?

  • Check boxes

    I know that if I uncheck the box next to a song in iTunes it will not be updated when I update my iPod, but if I uncheck the box next to a song on my iPod will it be updated when I run and update? I have much more music on my iPod than on my computer