Compiling in DOS?

...ok...i am using a book to learn the basix of Java and i have come across to compiling my first program
the program is saved in the dir. C:\javawork with the file name HelloSailor.java
but in dos, the 8 character limitation of hte filename and 3 char. limitation of extension has condensed the file to HELLOS~1.jav and when i put the command
javac C:\javawork\HELLOS~1.JAV
i get
"Bad command or file name" in response...does anyone else have this problem or kno wut i'm doing and how i can fix it??

The real answer to this question is, the filename you enter after the javac command IS A PARAMETER to javac. Thus the reflected dos name you see on the screen is accessible from DOS, but the Windows long filename is acessible to javac THROUGH its parameter "filename.java".
javac -g filename.java
gives two parameters to javac
(1) -g
(2) filename.java
(3) no other parameter.
Sammi Na Boodie(java beginner)

Similar Messages

  • Compiling in dos or unix

    I wrote a program in Sun One studio and it will not compile in dos.
    i have to hand in an executable. Or something that will compile. It works fine inside One Studio. But not outside. In the folder of my project there is a .java and a .class i even tested with a simple program
    import java.io.*;
    class Test {
    public static void main(String arg[]) {
    System.out.println("Hello");
    And in dos i typed java Test.java and it gives an error saying thread main and somthing like classdefnotfound
    someone please help

    the command is java Test for running and javac Test.java for compiling, it should work. If you still get error, check your classpath varible.

  • Error compiling in DOS while creating uderdefined pakages

    well i created 2 folders in my working directory pac1 and pac2 wherein i compiled couple of programs in each folder. when i compile the main prog inmy working directory in dos prompt..its not able 2 open the pac1 folder and execute th reqd classes..also when i extend the classes from one package 2 another..it shows error tht the classes dont exist.how do i solve the prob in dos prompt

    Please read [_How To Ask Questions The Smart Way_|http://www.catb.org/~esr/faqs/smart-questions.html].
    Especially the parts that ask you to [_Write in clear, grammatical, correctly-spelled language_|http://www.catb.org/~esr/faqs/smart-questions.html#writewell].
    Also, telling us how you tried to compile your code and the exact error message you get would help tremendously with finding a solution.

  • Noob and trying to compile in Dos

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

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

  • Compiling at DOS prompt?

    When compiling at the DOS prompt one gets an error because one can only use 3 letter extensions unlike what is needed for "javac simple.java" and "java simple.class"

    One does? I suppose if you had DOS 6.0 without Windows you would have this problem... is that what you have?

  • Compile in Dos mode problem?

    After having found HelloWorldApp.java(source file in c:\windows\java\dir) and c:windows\java>(to which I add , javac)and get the message:This program cannot run in Dos mode.
    any detailed suggestions appreciated..
    (path variable correct/using Windows ME)
    cheers for all help so far!!!!!!!!!!!!!

    And you are trying to run it from a dos-console, running windoze, NOT from the 'real' dos?
    See eg. the following posts on the same problem:
    http://forums.java.sun.com/thread.jsp?forum=7&thread=12230
    http://forums.java.sun.com/thread.jsp?forum=54&thread=143153
    http://forums.java.sun.com/thread.jsp?forum=54&thread=98452
    http://forums.java.sun.com/thread.jsp?forum=7&thread=12633
    http://forums.java.sun.com/thread.jsp?forum=14&thread=23018
    http://forums.java.sun.com/thread.jsp?forum=7&thread=13371
    http://forums.java.sun.com/thread.jsp?forum=31&thread=52700

  • Report compilation in one short

    Hi,
    The following script for compiling all Oracle Reports Designer files(RDF)
    to Report executable file(REP) witin a specified directory. It works fine.
    But the problem is while executing under DOS, it takes 8bit names only
    instead of 32bit names.
    PRESENT OUTPUT : ASSETMASTER.RDF ===> ASSETM~1.REP
    (ie. If the file name is more than 8 character it consider the first 8 character only
    since it compiles under DOS)
    REQUIRED OUTPUT: ASSETMASTER.RDF ===> ASSETMASTER.REP
    Script:
    @echo off
    :: REPCMP.bat
    cls
    for %%f in (*.rdf) do c:\orawin95\bin\r30con32 USERID=XXX/XXX BATCH=YES STYPE=RDFFILE SOURCE=%%f DTYPE=REPFILE DEST=%%f
    echo FINISHED
    cls
    How to solve this problem.
    Advance Thanks..................
    null

    Thanks for the reply.
    FYI, not every month have all the columns filled up. Meaning some months may have lesser columns resulting in smaller tables. That's why some of the months, their tables will fit into one page.
    Changing width of does not solve my problem because my reports are made for A4 paper size. Printing such a report with its width altered causes some part of the table which overflows out from A4 paper size not to be printed.
    The location of the value I changed can be found here:
    Paper Layout > Main Section > Property Sheet: Width
    Please do help. Thanks.

  • Code compiling problem

    I have written a small sample code with 2 classes(Money.java and MoreMoney.java),where the latter has the main function. The problem is i cant compile and run these programs using commmand prompt in windows but they work just fine when using netbeans.
    Env. variable is not a problem as money.java compiles using command prompt. Importing is not an issue as they are in the same package. Nor is package an issue, coz i have written the package name at the start of the code. Please suggest.Thank you in advance.
    The code is as follows:
    * Money.java
    * Created on August 8, 2006, 11:09 AM
    * To change this template, choose Tools | Template Manager
    * and open the template in the editor.
    package javaapplication1;
    * @author oracle
    public class Money
    private float amount;
    private int dollars;
    private float cents;
    public Money(int amount)
    dollars=amount/100;
    cents=amount%100;
    public float getdollar()
    return this.dollars;
    public float getcents()
    return this.cents;
    public String toString()
    return("You Entered "+dollars+" dollars and "+cents+" cents");
    * MoreMoney.java
    * Created on August 1, 2006, 5:36 PM
    * To change this template, choose Tools | Template Manager
    * and open the template in the editor.
    package javaapplication1;
    * @author oracle
    public class MoreMoney
    * @param args the command line arguments
    public static void main(String[] args)
    // TODO code application logic here
    Money m=new Money(143);
    System.out.println(m);
    Any other tips on my code are also welcome since i am new to java and would like to learn good 'coding habits'.

    Hello,
    Thank you for the suggestion.
    I already have my .class files & my .java files in the JavaApplication1 folder. I have done as instructed on the webpage (http://java.sun.com/javase/6/webnotes/install/jdk/install-windows.html#Environment) and also have set the environment variable, CLASSPATH to the value:
    C:\Program Files\Java\jdk 1.5.0_07\bin\JavaApplication1\src\ JavaApplication1
    When i say env. varible it is the 'systems variable' of the env. variable category. Am i correct on that one?
    I have another piece of information. After setting the CLASSPATH to its new value and restarting command prompt, it did not automatically go to that directory/path. It instead gave me the default path(C:/Documetns and Settings/oracle>)
    I had to manually change the directory until i had the above mentioned path. Is there something fishy about my DOS-prompt or is that the way it is supposed to be?
    So inspite all this experimentation the problem still persists. Why wont my code compile from DOS-Prompt? Thank you for your patience and please advice.

  • Win XP, QT 7.0.3 and "DOS" failure

    If I install the iTunes 6/QT 7.0.3 software on my Win XP Pro machine, then I can no longer compile firmware ("DOS" command prompt window just disappears after compiling just one file). The compiler is fairly old (Win 95 days), but I have no other choices. I uninstalled iTunes 6 first, but compiling would still fail. I then uninstalled QT 7.0.3 and then compiling started working again. I restarted after each uninstall. I then tried installing again, but compiling started failing again. I did the same uninstall sequence and compiling is working again.
    I believe I had QT 7 installed before, but I don't remember. I do know I had this problem about 2 months ago, but I didn't uninstall any software. I had to modify some of the compiler executables to use a Windows 95 compatibility mode and then everything started working.
    Any ideas?

    Try the apps under a different user account. If they work as they should you've got a conflict in your other users Home folder.
    This could be software, a corrupt .plist file or even codecs you've installed.
    You should also repair permissions and run Software Update to be sure you're up to date.

  • How to find the version number of Java compiler used

    Is there a simple programatical way to extract what version of Java compiler was used to create a certain class file (the byte code) from within the program?
    Actually, by checking the file is ok too.

    Thanks for the program. I've run it and I got 1.4.2as
    an output.
    Can I assume I'me using SDK 1.4.2 through netBeansIDE
    3.5.1 (which it came with bundled)?if you would remove J2SDK 1.4.0, then you could be
    sure that your netbeans is NOT using it anymore...
    howevere, you could also set some settings inside
    netbean, and voila... you could set it to use
    whichever sdk version you want...
    but if you are not sure which one of these it
    currently uses, then i assume that it is sdk 1.4.0,
    because i have no reason to believe othervise.This is from my old AUTOEXEC.BAT:
    SET CLASSPATH=.
    SET PATH=C:\j2sdk1.4.0_01\bin
    I installed netBeans IDE 3.5.1 a few weeks ago, but did not change my AUTOEXEC.BAT file for a while.
    Then I changed AUTOEXEC file to the following:
    SET CLASSPATH=.
    SET PATH=C:\Program Files\j2sdk_nb\j2sdk1.4.2\bin
    IDE kept working, but DOS stopped recognizing javac command.
    After getting suggestions from some people here, I changed the AUTOEXEC to:
    SET CLASSPATH=.
    SET PATH=C:\Progra~1\j2sdk_nb\j2sdk1.4.2\bin
    IDE still works, and I can compile from DOS now.
    SDK 1.4.2 must have been installed (or at least unpacked) by IDE 3.5.1.
    Does anybody know how to change settings on IDE 3.5.1 to make it use whichever SDK I want to try?

  • .jar files

    Hi everybody,
    I am pretty new to programming Java and to programming. I understand how to compile .java files to convert them to a .class file and finally running the application. I also understand how applets work, but there's one thing I don't know. BTW I do all my compiling through DOS and typing out all the commands.
    My question is, how do you get those .jar files? I have just read that to run Java applets through web browsers, it is necessary to have this file type. Is there a command available through the DOS prompt Java compiler or do I have to get another IDE? Also, I downloaded my Java IDE from Sun's Java website.
    Thanks for reading, and yes I am that new to programming :)

    The tool is called, unsurprisingly enough, "jar". If you have javac installed, you probably have jar too.
    http://java.sun.com/j2se/1.4.1/docs/tooldocs/windows/jar.html
    You don't have to use jars to deploy applets, but it sure makes it easier.

  • I need an Array in my JAVA CODE

    I need an array in my java code for my last class in my Java 1 course
    my code does compile in dos using javac,....and it does work
    It is a mortgage calculator for 3 loans of 3 different years loaned,.... and each have a different interest rate.
    I need to have my code in an ARRAY for my last week .
    any help would be appreciated
    here is my code :
    import java.text.*;           //20 May 2008, Revision ...many
    import java.io.IOException;
    class memortgage     //program class name
      public static void main(String[] args) throws IOException
        double amount,moPay,totalInt,principal = 200000; //monthly payment, total interest and principal
        double rate [ ] = {.0535, .055, .0575};          //the three interest rates
        int [ ] term = {7,15,30};                        //7, 15 and 30 year term loans
        int time,ratePlace = 0,i,pmt=1,firstIterate = 0,secondIterate = 0,totalMo=0;
        char answer,test;
        boolean validChoice;
        System.in.skip(System.in.available());           //clear the stream for the next entered character
        do
          validChoice = true;
          System.out.println("What Choice would you Like\n");
          System.out.println("1-Interest rate of 5.35% for 7 years?");       //just as it reads for each to select from
          System.out.println("2-Interest rate of 5.55% for 15 years?");
          System.out.println("3-Interest rate of 5.75% for 30 years?");
          System.out.println("4-Quit");
          answer = (char)System.in.read();
          if (answer == '1')  //7 yr loan at 5.35%
            ratePlace = 0;
            firstIterate = 4;
            secondIterate = 21;
            totalMo= 84;
          else if (answer == '2') //15 yr loan at 5.55%
            ratePlace = 1;
            firstIterate = 9;      //it helps If I have the correct numbers to calcualte as in 9*20 to equal 180...that why I was off -24333.76
            secondIterate = 20;    //now it is only of -0.40 cents....DAMN ME
            totalMo = 180;
          else if (answer == '3') //30 yr loan at 5.75%
            ratePlace = 2;
            firstIterate = 15;
            secondIterate = 24;
            totalMo = 360;
          else if (answer == '4') //exit or quit
            System.exit(0);
          else
            System.in.skip(System.in.available());               //validates choice
            System.out.println("Invalid choice, try again.\n\n");
            validChoice = false;
        }while(!validChoice);  //when a valid choice is found calculate the following, ! means not, similar to if(x != 4)
        for(int x = 0; x < 25; x++)System.out.println();
        amount = (principal + (principal * rate[ratePlace] * term[ratePlace] ));
        moPay = (amount / totalMo);
        totalInt = (principal * rate[ratePlace] * term[ratePlace]);
        DecimalFormat df = new DecimalFormat("0.00");
        System.out.println("The Interest on $" + (df.format(principal) + " at " + rate[ratePlace]*100 +
        "% for a term of "+term[ratePlace]+" years is \n" +"$"+ (df.format(totalInt) +" Dollars\n")));
        System.out.println("\nThe total amount of loan plus interest is $"+(df.format(amount)+" Dollars.\n"));
        System.out.println("\nThe Payments spread over "+term[ratePlace]* 12+" months would be $"+
        (df.format (moPay) + " Dollars a month\n\n"));
        System.in.skip(System.in.available());
        System.out.println("\nWould you like to see a planned payment schedule? y for Yes, or x to Exit");
        answer = (char)System.in.read();
        if (answer == 'y')
          System.out.println((term[ratePlace]*12) + " monthly payments:");
          String monthlyPayment = df.format(moPay);
          for (int a = 1; a <= firstIterate; a++)
            System.out.println(" Payment Schedule \n\n ");
            System.out.println("Month Payment Balance\n");
            for (int b = 1; b <= secondIterate; b++)
              amount -= Double.parseDouble(monthlyPayment);
              System.out.println(""+ pmt++ +"\t"+ monthlyPayment + "\t"+df.format(amount));
            System.in.skip(System.in.available());
            System.out.println(("This Page Is Complete Press [ENTER] to Continue"));
            System.in.read();
    }

    here is what was commented from my instructor for my week 4...is what you sen in the code....but I fixed loan 2 tonight
    "Week 4 Great work, the numbers were a little off on the 1st and 2nd loans. Next time
    try putting the values you displayed in an array. "
    import java.text.*;           //20 May 2008, Revision ...many
    import java.io.IOException;
    class memortgage     //program class name
      public static void main(String[] args) throws IOException
        double amount,moPay,totalInt,principal = 200000; //monthly payment, total interest and principal
        double rate [ ] = {.0535, .055, .0575};          //the three interest rates
        int [ ] term = {7,15,30};                        //7, 15 and 30 year term loans
        int time,ratePlace = 0,i,pmt=1,firstIterate = 0,secondIterate = 0,totalMo=0;
        char answer,test;
        boolean validChoice;
        System.in.skip(System.in.available());           //clear the stream for the next entered character
        do
          validChoice = true;
          System.out.println("What Choice would you Like\n");
          System.out.println("1-Interest rate of 5.35% for 7 years?");       //just as it reads for each to select from
          System.out.println("2-Interest rate of 5.55% for 15 years?");
          System.out.println("3-Interest rate of 5.75% for 30 years?");
          System.out.println("4-Quit");
          answer = (char)System.in.read();
          if (answer == '1')  //7 yr loan at 5.35%
            ratePlace = 0;
            firstIterate = 4;
            secondIterate = 21;
            totalMo= 84;
          else if (answer == '2') //15 yr loan at 5.55%
            ratePlace = 1;
            firstIterate = 9;      //it helps If I have the correct numbers to calcualte as in 9*20 to equal 180...that why I was off -24333.76
            secondIterate = 20;    //now it is only of -0.40 cents....DAMN ME
            totalMo = 180;
          else if (answer == '3') //30 yr loan at 5.75%
            ratePlace = 2;
            firstIterate = 15;
            secondIterate = 24;
            totalMo = 360;
          else if (answer == '4') //exit or quit
            System.exit(0);
          else
            System.in.skip(System.in.available());               //validates choice
            System.out.println("Invalid choice, try again.\n\n");
            validChoice = false;
        }while(!validChoice);  //when a valid choice is found calculate the following, ! means not, similar to if(x != 4)
        for(int x = 0; x < 25; x++)System.out.println();
        amount = (principal + (principal * rate[ratePlace] * term[ratePlace] ));
        moPay = (amount / totalMo);
        totalInt = (principal * rate[ratePlace] * term[ratePlace]);
        DecimalFormat df = new DecimalFormat("0.00");
        System.out.println("The Interest on $" + (df.format(principal) + " at " + rate[ratePlace]*100 +
        "% for a term of "+term[ratePlace]+" years is \n" +"$"+ (df.format(totalInt) +" Dollars\n")));
        System.out.println("\nThe total amount of loan plus interest is $"+(df.format(amount)+" Dollars.\n"));
        System.out.println("\nThe Payments spread over "+term[ratePlace]* 12+" months would be $"+
        (df.format (moPay) + " Dollars a month\n\n"));
        System.in.skip(System.in.available());
        System.out.println("\nWould you like to see a planned payment schedule? y for Yes, or x to Exit");
        answer = (char)System.in.read();
        if (answer == 'y')
          System.out.println((term[ratePlace]*12) + " monthly payments:");
          String monthlyPayment = df.format(moPay);
          for (int a = 1; a <= firstIterate; a++)
            System.out.println(" Payment Schedule \n\n ");
            System.out.println("Month Payment Balance\n");
            for (int b = 1; b <= secondIterate; b++)
              amount -= Double.parseDouble(monthlyPayment);
              System.out.println(""+ pmt++ +"\t"+ monthlyPayment + "\t"+df.format(amount));
            System.in.skip(System.in.available());
            System.out.println(("This Page Is Complete Press [ENTER] to Continue"));
            System.in.read();
    }

  • Unchecked call to to add(E) ....... HELP

    Hi, i was doing a project in eclipse, and everything was fine (compiled and running). However, I ran into this problem when I try to compile the same code in DOS command line. Is there any ways that I can fix this problem so the same code that runs in Eclipse can compile in DOS also?
    a glimpse of the code is below:
    ArrayList best_move  = new ArrayList();
    for ( ..r... )
       for( ..c.... )
           Move  move = new Move( r, c);
           if( move is valid )
                then
                    best_move.add(move);warning: [unchecked] unchecked call to add(E) as a
    member of
    the raw type java.util.ArrayList
    best_move.add((Move) move);Appreciate your help.

    try the following
    ArrayList<class name> best_move  = new ArrayList<class name>();
    for ( ..r... )
       for( ..c.... )
           Move  move = new Move( r, c);
           if( move is valid )
                then
                    best_move.add((class name)move);in above "class name" is the class of the object which u wanna store in the collection e.g java.lang.Integer or java.lang.Float etc.
    this will not give any warnings in jdk1.5 and will help u out.

  • IDE in Jar file

    Hi all my friends!
    I want to do many Java application that requires powerful machine. Well, it is better that I can afford one but it is just a deam. Instead, my school has some very high performance machines ( P4 2.8 G). I really want to use that machine for my programming but unfortunately they do not have any editor like JCreator that I always use. Of course I can use notepad and compile in DOS but I for large project, it is a waste of resource.
    So I have an idea of having an IDE like Sun One Studio , allow me GUI , syntax, keyword highlight and allow me to compile program using button. But it should be written in Java as machine in school does not allow any INSTALATION. My question is that, theoretically, is it feasible idea ( accessing to low level of Windows machine using Java).
    Regards.

    #2 IDE of choice and strongly moving to #1 is Eclipse, created by IBM and supported by a large community including Oracle, Borland, BEA, Rationale, and over 200 others. It is open-source, free to use, highly extensible with possibly the best pluggable architecture, 100's of free plugins to add on, and works amazingly well. IDEA IntelliJ is probably the next best IDE although on JDJ Borland is rated #1 over Eclipse. Go to www.eclipse.org and get a taste of one of the most powerful java architectures you'll find, not only for IDE but their 3.0 version is soon to be used by many applications. I would get the 2.1.2 version though, as the 3.0 is not yet released and the Mx versions are mostly unstable.
    Otherwise, there is always jedit.org, which is a very good editor as well.

  • Link Error: could not initialize java VM

    When I try to run a project I get this error, I have downloaded and installed the lastest version of jre and sdk. It still will not work thought...how can I fix this (I am running windows xp)

    ok..well i can compile in dos now but when i try to
    run the class file, it says "Exception in thread
    "main" java.lang.NoClassDefFoundError:
    C:<path>studPoker/class" (it doesnt say <path>, i just
    have a really long file path. this program worked
    fine when i ran it in school, and i tried other
    programs, i get the same error.The error tells you the problem...
    ....C:<path>studPoker/class
    Java does not run files it runs classes. There is a difference. You are probably doing this at the command line....
    java c:\mydir\studPoker.class
    You should be doing this....
    java studPoker
    You need to be in the directory where the class file is.

Maybe you are looking for

  • Steel Industry Business Scenario  and Requirement

    Dear Experts, Business Scenario: Material is procured and made Goods Receipt ,Material is issued to Shop floor. Shop floor records the number of cycles or heats the material has under gone  and gives a report to finance . based on report finance inti

  • Flash can't do even basic tasks

    1. these forums are slow a skit. Quit using CF on top of J2EE, the performance sox azz. 2. Typing this post over because of being "censored" it refarded. Answer, or flame, I don't care. I'm having my company use AJAX/Web2.0/or Lazlo. I'm so fed up wi

  • How do you limit the amount of digits in a text field?

    If a user was to input 9 digits into a text field. How do you make it so that an error message would appear if the user inputs more than 9 digits

  • MTL_ONHAND_QUANTITIES strange issue

    Hi, The scenario is as under We have 3 POs all having line for same item say ITEM A PO 1 with ITEMA qty 160 PO 2 with ITEMA qty 200 PO 3 with ITEMA qty 24 In MTL_ONHAND_QUANTITIES we maintain information for In Transit Subinventory along with On Hand

  • Finder closes when I click "Sites"

    When I click "Sites" on the sidebar of Finder, Finder closes and closes -- or eliminates -- all the shortcuts on the desktop, then it reopens but not on Sites, just on any other folder within the sidebar. I have to open a second Finder window and cli