Computer Science Canada Java on mac |
Author: | peanut [ Fri Apr 14, 2006 8:45 am ] |
Post subject: | Java on mac |
Hey guys, I'm doing some classes of Java programming in my university. And I work on a mac at home. From the university I got a element package with some classes that I need to use from my programming. I'm using right now xcode for mac, and well my question is how do I import the classes? I tried javac -classpath <path> but it doesnt seems to work. Thx |
Author: | wtd [ Fri Apr 14, 2006 11:52 am ] |
Post subject: | |
Can you place the classes in the existing classpath (as specified by the CLASSPATH variable that I'm assumign exists)? |
Author: | peanut [ Fri Apr 14, 2006 12:51 pm ] |
Post subject: | |
well I must say that I'm totally new with computer language. Java is actually my first computer language that I'm learning. I read that I can put the element that I'm trying to load in each file, or load it in my classpath. However don't know what's my classpath. |
Author: | wtd [ Fri Apr 14, 2006 1:53 pm ] | ||||||||
Post subject: | |||||||||
Your classpath is where Java looks for classes. Let's say I have a Java source file Test.java in my home folder (~):
Now, I have Foo.java in ~/projects/java/
When I compile Test.java from the commandline...
And then to run it:
|
Author: | peanut [ Fri Apr 14, 2006 2:29 pm ] | ||
Post subject: | |||
Yes I understand that, I don't use the terminal though to compile or execute the program. I'm using xcode, and well my question was more for the import of classes. Example:
And the ConsoleWindow class has been put in the element package that I got from school (element.jar). Now I don't know how to import this file. |
Author: | wtd [ Fri Apr 14, 2006 2:33 pm ] |
Post subject: | |
For simple projects, you will likely find the command-line a simpler working environment than Xcode (or most other IDEs). |
Author: | wtd [ Fri Apr 14, 2006 2:36 pm ] | ||
Post subject: | |||
As for using a JAR archive "element.jar" with classpath:
Hopefully I'm remembering that correctly. |
Author: | rizzix [ Fri Apr 14, 2006 4:24 pm ] |
Post subject: | |
Or simply drop the jar in /Library/Java/Extensions |
Author: | peanut [ Sat Apr 15, 2006 6:45 am ] |
Post subject: | |
Thank you guys! ![]() |
Author: | Justin_ [ Sat Apr 15, 2006 7:04 pm ] |
Post subject: | |
So you have no previous experience with programming and you're taking it in university? Is computer science your major? I'm not trying to sound pejorative, but it seems ridiculous that somebody would study CS in university and not have a background in the subject. I mean, who pays money to learn about something they aren't familiar with? Won't it be a waste of money if you find out you don't like it? |
Author: | wtd [ Sat Apr 15, 2006 7:17 pm ] |
Post subject: | |
One goes to a university to learn what's available. The vast majority of students will change their major at least once. A good portion of those will change majors three or more times. |
Author: | peanut [ Sun Apr 16, 2006 10:11 am ] |
Post subject: | |
Actually I'm studying Aerospace Engineering. And a subject that I get is JAVA programming. Somehow (in the near future), I'm going to use then my skills, that I'm learning now with JAVA, to program some things. What I know, is that next year I will be programing a flight simulator as a project ![]() |
Author: | md [ Sun Apr 16, 2006 9:21 pm ] |
Post subject: | |
I know a whole lot more about CS then many people here; and yet I've decided to switch out of CS. Clearly what you study has little to do with what you know and more to do with what interests you. I know lots of people who knew very little or nothing about programming who are in CS now, and many people who knew lots about CS who are no longer in it after a year or two of it at university. |
Author: | peanut [ Sun Apr 16, 2006 10:18 pm ] |
Post subject: | |
lol, well yes, I am really interested in Java atm and I'm going to learn it on my free time, even if, at my university, we only learn the basics. |
Author: | wtd [ Mon Apr 17, 2006 11:04 am ] |
Post subject: | |
I'd suggst you look into other languages as well. There are other languages that are easier and possibly more fun to experiment with, and Java as a language is pretty mundane. ![]() Oh, and good luck in your academic endeavors. |
Author: | peanut [ Mon Apr 17, 2006 11:17 am ] |
Post subject: | |
thank you ![]() |
Author: | wtd [ Mon Apr 17, 2006 11:32 am ] |
Post subject: | |
I'm a big fan of Ruby, and that certainly has gotten a lot of attention lately. Blocks alone would be quite an eye-opener. A fucntional language would also provide quite the contrast to Java and expose you to a lot of new concepts. I firmly believe, by the way, that learning other languages, even if you eventually go back to something like Java, will make you a better programmer and benefit you regardless of the language you end up using most of the time. For fucntional programming languages, Haskell is really interesting, but you would probably find that O'Caml offers a more gentle introduction. |
Author: | wtd [ Tue Apr 18, 2006 4:58 pm ] |
Post subject: | |
Oh, additionally... you should check out Scala (http://scala.epfl.ch). It permits use of java's vast libraries, and incorporates a lot of neat features. |