Command prompt questions

  • (2 Pages)
  • +
  • 1
  • 2

15 Replies - 1715 Views - Last Post: 01 September 2011 - 11:09 AM Rate Topic: -----

#1 TheBearKing   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 31
  • Joined: 11-February 11

Command prompt questions

Posted 31 August 2011 - 11:39 AM

Before I begin my post, I am not sure if this is the proper place to post this. I'm learning Java currently, and we have been using command prompt, so I was guessing this is where it goes. If not, feel free to move it to the proper thread.

Question 1: Every time I use command prompt, I have to change my directory to the directory where my java programs are stored.

The default directory is:
C:\Users\Owner>

I have everything store in a folder right on my C drive's immediate directory. What I'm looking to do is set my directory as a permanent default directory so that I don't have to change it every time.

Question 2: I have jdk1.7.0 installed on my computer. Before compiling my programs, I have to type the following into my command line:

set path=%path%;C:\Program Files\Java\jdk1.7.0\bin

My professor told us that our companion site for our book has instructions as to how to set this path permanently so that we don't have to input this command in every time we open a new instance of command prompt. So far, I've been looking for almost 2 weeks for the instructions on the site, but to no avail. I was wondering if someone could help me to set this up.

Any and all help will be greatly appreciated.

Thank you in advance for taking the time to read and respond.

-Russell

Is This A Good Question/Topic? 0
  • +

Replies To: Command prompt questions

#2 smohd   User is offline

  • Critical Section
  • member icon


Reputation: 1825
  • View blog
  • Posts: 4,627
  • Joined: 14-March 10

Re: Command prompt questions

Posted 31 August 2011 - 11:48 AM

I dont know the first one but I may help on the second one. What to do is copying the path, and then go to computer properties(right click on comp), then Advanced System Settings, then Advanced tab, here you will see Environment Variables, go it and edit the path to that of the JDK
Was This Post Helpful? 1
  • +
  • -

#3 Fuzzyness   User is offline

  • Comp Sci Student
  • member icon

Reputation: 669
  • View blog
  • Posts: 2,438
  • Joined: 06-March 09

Re: Command prompt questions

Posted 31 August 2011 - 11:55 AM

What program are you using to program Java in? Different programs have different set ups, especially if using a JEditor

ps. check your PM

This post has been edited by Fuzzyness: 31 August 2011 - 11:55 AM

Was This Post Helpful? 0
  • +
  • -

#4 TheBearKing   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 31
  • Joined: 11-February 11

Re: Command prompt questions

Posted 31 August 2011 - 11:56 AM

I changed it to my path, and it works fine now. Question about that though: Will changing that path cause any malfunction or error in my computer's system if all of the other paths are removed?
Was This Post Helpful? 0
  • +
  • -

#5 TheBearKing   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 31
  • Joined: 11-February 11

Re: Command prompt questions

Posted 31 August 2011 - 12:09 PM

View PostFuzzyness, on 31 August 2011 - 11:55 AM, said:

What program are you using to program Java in? Different programs have different set ups, especially if using a JEditor

ps. check your PM


We are using BlueJ in the class. He told us there are other programs we can use to write and compile Java in, but for this class we have to use BlueJ.
Was This Post Helpful? 0
  • +
  • -

#6 smohd   User is offline

  • Critical Section
  • member icon


Reputation: 1825
  • View blog
  • Posts: 4,627
  • Joined: 14-March 10

Re: Command prompt questions

Posted 31 August 2011 - 12:17 PM

View PostTheBearKing, on 01 September 2011 - 12:41 AM, said:

I changed it to my path, and it works fine now. Question about that though: Will changing that path cause any malfunction or error in my computer's system if all of the other paths are removed?

I dont expect any error message for changing the path, I did so and many of my class mates did so when studying Java and there was no one who said about errors.....
Was This Post Helpful? 0
  • +
  • -

#7 TheBearKing   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 31
  • Joined: 11-February 11

Re: Command prompt questions

Posted 31 August 2011 - 12:23 PM

Ok cool! Problem solved! Now just needing help with the first question!

Regardless, thanks a lot for the help.
Was This Post Helpful? 0
  • +
  • -

#8 Fuzzyness   User is offline

  • Comp Sci Student
  • member icon

Reputation: 669
  • View blog
  • Posts: 2,438
  • Joined: 06-March 09

Re: Command prompt questions

Posted 31 August 2011 - 12:34 PM

I haven't used BlueJ before, but have you gone into Tool>Preferences and made sure that all of the file paths are correct?
Was This Post Helpful? 0
  • +
  • -

#9 TheBearKing   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 31
  • Joined: 11-February 11

Re: Command prompt questions

Posted 31 August 2011 - 12:40 PM

Well, I'm currently not learning to do it on BlueJ. He wants to teach us the Command Prompt way of running Java programs. We aren't starting with BlueJ for another 2 or 3 weeks. It's not a big deal (regarding the default directory), since it's just a simple change directory at the start. I was more annoyed with having to set the path every time. I suppose I can deal with it for now. I appreciate all the help from any body! Don't be surprised if I return before December with some stupid mistakes made in my programs.

Thanks again!
Was This Post Helpful? 0
  • +
  • -

#10 Fuzzyness   User is offline

  • Comp Sci Student
  • member icon

Reputation: 669
  • View blog
  • Posts: 2,438
  • Joined: 06-March 09

Re: Command prompt questions

Posted 31 August 2011 - 12:46 PM

Aah ok sorry I was under the impression you were already using BlueJ and just trying to set file path through Command Prompt, my apologies.

Well have any issues just post them, I can definitely help with those! :^:

Cheers mate, Happy Coding! :cheers:
Fuzzy
Was This Post Helpful? 0
  • +
  • -

#11 NeoTifa   User is offline

  • NeoTifa Codebreaker, the Scourge of Devtester
  • member icon





Reputation: 4933
  • View blog
  • Posts: 20,259
  • Joined: 24-September 08

Re: Command prompt questions

Posted 31 August 2011 - 01:23 PM

I know in Linux you can set an alias so you can do cd C:\\... in your alias but I dunno about Windows. Hopefully that should help you look in the right direction.
Was This Post Helpful? 0
  • +
  • -

#12 Gorian   User is offline

  • ninja DIC
  • member icon


Reputation: 156
  • View blog
  • Posts: 1,856
  • Joined: 28-June 08

Re: Command prompt questions

Posted 01 September 2011 - 07:38 AM

View PostTheBearKing, on 01 September 2011 - 12:41 AM, said:

I changed it to my path, and it works fine now. Question about that though: Will changing that path cause any malfunction or error in my computer's system if all of the other paths are removed?

This depends on what you mean. If you edit the path so the only thing remaining in it is C:\Program Files\Java\jdk1.7.0\bin, then yes, it will cause some issues. Append or prepend to the path. I.E. ...
C:\Windows;C:\Windows\Systems32;C:\Program Files\Java\jdk1.7.0\bin;
Was This Post Helpful? 0
  • +
  • -

#13 TheBearKing   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 31
  • Joined: 11-February 11

Re: Command prompt questions

Posted 01 September 2011 - 09:38 AM

I added the path to the Environment Variables, and also for good measure added the C:\Windows;C:\Windows\Systems32; in as well. I should be good for now, that is until I encounter an issue.
Was This Post Helpful? 0
  • +
  • -

#14 jon.kiparsky   User is offline

  • Beginner
  • member icon


Reputation: 12350
  • View blog
  • Posts: 20,984
  • Joined: 19-March 11

Re: Command prompt questions

Posted 01 September 2011 - 09:50 AM

Quote

C:\Users\Owner>

I have everything store in a folder right on my C drive's immediate directory. What I'm looking to do is set my directory as a permanent default directory so that I don't have to change it every time.


I'm not a windows guy, but if you want to set up a standard default directory, you can probably do it with a batch file. There's probably a pointy-clicky way of doing it as well, but if you're going to program on a machine you should know the scripting languages available to you, and for windows the native ones are batch files and powershell, I think.

Mouses are for users, not for programming. Anything that you can express with a mouse, you can express faster and easier with the keyboard, once you know how to use your computer.
Was This Post Helpful? 0
  • +
  • -

#15 g00se   User is offline

  • D.I.C Lover
  • member icon

Reputation: 3744
  • View blog
  • Posts: 17,121
  • Joined: 20-September 08

Re: Command prompt questions

Posted 01 September 2011 - 10:53 AM

Quote

What I'm looking to do is set my directory as a permanent default directory so that I don't have to change it every time.


I thought i was lazy, which is a good quality in a programmer, but i don't think i'd ever go that far ;)

As someone said above, a batch file will do it. Save the following as something like 'cdj.bat' in %PATH%

REM Set the default project directory
set default_project_directory=C:\Users\Owner\jprojects
cd %default_project_directory%

This post has been edited by g00se: 01 September 2011 - 10:54 AM

Was This Post Helpful? 0
  • +
  • -

  • (2 Pages)
  • +
  • 1
  • 2