Liteboxweb - Tutorials

Just another WordPress weblog

About Litebox Tutorials

Just another WordPress weblog

Paths in OSX Terminal

Recently, I began testing eclipse with JAVA so I could start working with Google Web Toolkit (GWT). I have had a history of being hindered by using uber technical programming interfaces due to problems getting paths to work properly in terminal. Why would you need to know this? Well, if you’re going to ever use Python, Django, GWT, ECLIPSE, or anything else, you need to be able to use your terminal to run scripts.

Q: What were all of those?

A: Python: a programming language that has been a major part of Google’s products. Django: a framework that uses python language. Meebo.com is built from Django, for example. Google Web Toolkit: it is a newly created Google product that makes cross-browser-compatible javascript and css output just from purely Java based web applications. You’d use this if you were planning on making a crazy webapp. ECLIPSE: its a programming interface that allows you to write code and manage file trees in an orderly little set of windows. Its typically used for more advanced stuff, such as C++ and beyond.

Ok. Now for the how-to.

In OSX, you have a command line program that Google Web Toolkit requires you use if you’re going to work on projects in Eclipse. A little background on Terminal, it is UNIX based and is the direct line of communication to your system, in the same way MS-DOS would for a PC. This was probably introduced around the time the apple guys came out with the Unix based version of their operating system, which got nicknamed OS X.

PATHS

This is by far the most frustrating part of using terminal. If no one has properly explained what path refers to what, then you’re going to be sitting there all night. By default, the path is set to your home directory. The home directory would be, for example, your name, if you were to open finder and select your name in the list on the left column. The contents of the yourName folder is Home.

Lets say your GWT folder is located at:

/John Doe/Documents/myBusiness/GoogleWebToolkit/

So in order to access any of the commands in GoogleWebToolkit, you’d have to navigate to that directory first by typing the following command (change directory):

cd "/John Doe/Documents/myBusiness/GoogleWebToolkit/"

Hit enter. You will notice that the command prompt will have changed to show that you are now in that directory. To view what is in the directory, type the list command:

ls

BTW, that was an L. You should see a list of all the things you have in the directory. So lets say you are in fact creating a new project in eclipse for GWT. You’d say this:

./projectCreator -eclipse myNewProject

Note: “./” comes before the text in this case because there is a projectCreator script that lives in that specific directory, therefore, we want the command to be executed WITHIN that directory (./ denotes this). If you were using a global command, you wouldn’t be using it. Project Creator is the name of the script that creates a new GWT project. “-Eclipse” refers to the fact that you want to create it inside the eclipse program, rather than another program. If you were going to use something else, specify in that space. Lastly, “myNewProject” refers to the name of your project. If you want to put it in a special directory, you can put the path before the name:

folder/subfolder/myNewProject

Of course, this is very basic stuff, but if you were anything like me, you were confused about it. Afterall, it doesn’t work the same way as MS-DOS did, so your knowledge of that must be ignored.


RSS feed for comments on this post

Share your comments





Related Tutorials

Subscribe to RSS

Search

Pages

    Meta