Results 1 to 12 of 12
  1. #1
    tyang is offline Member
    Join Date
    Jan 2010
    Posts
    44
    Rep Power
    0

    Default How can I compile and execute the Java program in a non-C drive (D or E)?

    How can I compile and execute the Java program in a non-C drive (D or E)?

    (Now, I have to save all Java programs in C drive. However, all my important stuff are in other drives.)

    Many thanks!

  2. #2
    [RaIdEn] is offline Senior Member
    Join Date
    Oct 2009
    Location
    California,US
    Posts
    201
    Rep Power
    6

    Default

    what do you mean. If i understood it correct

    Just cut and paste it from C drive to other drive , It shldnt be a problem at compiling as

    compilation and execution of java programs will be based on the Class Path.

  3. #3
    FlyNn is offline Senior Member
    Join Date
    Feb 2010
    Posts
    128
    Rep Power
    0

    Default

    If you try to run your java code through cmd, locate to the folder where the file is stored using "cd" option. Do you get any error messages?
    Measuring programming progress by lines of code is like measuring aircraft building progress by weight.

  4. #4
    pbrockway2 is offline Moderator
    Join Date
    Feb 2009
    Location
    New Zealand
    Posts
    4,574
    Rep Power
    12

    Default

    Now, I have to save all Java programs in C drive.

    Why do you have to do this?

    You haven't said what you are doing (to run programs located on other drives) or what happens when you do that: to put it bluntly, you haven't said what your problem is.

  5. #5
    [RaIdEn] is offline Senior Member
    Join Date
    Oct 2009
    Location
    California,US
    Posts
    201
    Rep Power
    6

    Default

    Quote Originally Posted by FlyNn View Post
    If you try to run your java code through cmd, locate to the folder where the file is stored using "cd" option. Do you get any error messages?
    if you want to compile it through cmd. Location is a not a factor for the failure of compilation provided your path is correct and java is installed(of course).

    1---go to the location of the java source code

    2--- javac nameoffile.java

    3--- java nameoffile

  6. #6
    tyang is offline Member
    Join Date
    Jan 2010
    Posts
    44
    Rep Power
    0

    Default

    Thank you all!
    My problem is that I am running Java on MS-DOS. Through MS-DOS, I cannot even change to D drive by typing cd D: because everything must be done on C drive!

  7. #7
    [RaIdEn] is offline Senior Member
    Join Date
    Oct 2009
    Location
    California,US
    Posts
    201
    Rep Power
    6

    Default

    in msdos you cant change the drive with cd D:

    instead do this

    cd D:\

  8. #8
    tyang is offline Member
    Join Date
    Jan 2010
    Posts
    44
    Rep Power
    0

    Default

    Hi RaIdEn,
    It does not work. I have tried.

    Thanks for your help!

  9. #9
    pbrockway2 is offline Moderator
    Join Date
    Feb 2009
    Location
    New Zealand
    Posts
    4,574
    Rep Power
    12

    Default

    Does the d: drive exist? If so use

    Java Code:
    D:\

    The cd command is different: it changes the current directory. (Each drive has a "current directory" that can be changed.)

  10. #10
    [RaIdEn] is offline Senior Member
    Join Date
    Oct 2009
    Location
    California,US
    Posts
    201
    Rep Power
    6

    Default

    sry..i seem to mistyped my answer ,

    Try this instead..

    Java Code:
    D:
    without cd

  11. #11
    tyang is offline Member
    Join Date
    Jan 2010
    Posts
    44
    Rep Power
    0

    Default

    Thank you so much! It works finally!

  12. #12
    [RaIdEn] is offline Senior Member
    Join Date
    Oct 2009
    Location
    California,US
    Posts
    201
    Rep Power
    6

Similar Threads

  1. Jcreator Compile/Execute option
    By airjohn6 in forum New To Java
    Replies: 7
    Last Post: 01-12-2010, 01:59 AM
  2. Best way to format a drive/thumb drive in java...
    By vandyke in forum Advanced Java
    Replies: 1
    Last Post: 12-09-2009, 02:32 AM
  3. Compile/Execute code in Java app
    By Doctor Cactus in forum New To Java
    Replies: 5
    Last Post: 12-16-2008, 10:58 AM
  4. Replies: 0
    Last Post: 04-04-2008, 03:40 PM
  5. Replies: 0
    Last Post: 10-04-2007, 10:33 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •