|
|
|
|
![]() ![]() |
Sep 24 2007, 06:28 PM
Post
#1
|
|
|
Premium Member Group: Members Posts: 219 Joined: 13-February 07 Member No.: 20,371 |
Ok, so previously I had installed the java SKD on my computer (the one that comes with netbeans), as of right now it is version 1.4.2_13 and I really didn't pay much attention to the version. Everything seemed to work ok for what I was doing, although I wasn't using netbeans, instead I have been using eclipse. (Since I am doing this for a class at school and that is their IDE of choice)
Anyway my programs have to compile at the command line (not just work in eclipse). I have been able to get them to work in eclipse fine, but I am having trouble when I go to the command line. Specifically with things such as the Scanner class (which was introduced in java 1.5), and so noticing that I have the SDK of version 1.4...I was thinking that was the problem. But what I can't figure out, is that that seems to be the latest version available on Sun's website. Do I have to download the JDK? (That is of the same version as the Java Runtime Environment). It just doesn't make much sense to me right now....why is eclipse working, but yet I can' compile at the command line? (I have gotten it a little further by including the JRE jar directory in the classpath directory, but that spits out errors about version numbers) So do I simply have to uninstall the Java SDK, and install the JDK? If so, why is it that eclipse is working just fine for me? |
|
|
|
Sep 24 2007, 09:55 PM
Post
#2
|
|
|
Premium Member Group: [HOSTED] Posts: 393 Joined: 9-March 07 From: Tucson, AZ Member No.: 20,794 |
Ok, so previously I had installed the java SKD on my computer (the one that comes with netbeans), as of right now it is version 1.4.2_13 and I really didn't pay much attention to the version. Everything seemed to work ok for what I was doing, although I wasn't using netbeans, instead I have been using eclipse. (Since I am doing this for a class at school and that is their IDE of choice) Anyway my programs have to compile at the command line (not just work in eclipse). I have been able to get them to work in eclipse fine, but I am having trouble when I go to the command line. Specifically with things such as the Scanner class (which was introduced in java 1.5), and so noticing that I have the SDK of version 1.4...I was thinking that was the problem. But what I can't figure out, is that that seems to be the latest version available on Sun's website. Do I have to download the JDK? (That is of the same version as the Java Runtime Environment). It just doesn't make much sense to me right now....why is eclipse working, but yet I can' compile at the command line? (I have gotten it a little further by including the JRE jar directory in the classpath directory, but that spits out errors about version numbers) So do I simply have to uninstall the Java SDK, and install the JDK? If so, why is it that eclipse is working just fine for me? Probably a few things. For one, eclipse manages your classpath for you so you don't need to fill your classpath with all the jars. You may be missing a jar on the commandline. Also, you may be compiling 1.5 code with a 1.4 compiler...this also will not work. Use javac -version to determine what version of the compiler you're using. If it's 1.4, you need to tweak your path so that it points to a 1.5 javac. So you know, eclipse doesn't use javac -- it uses an internal line-by-line compiler (which is why you can still run applications in eclipse if they have errors, you can't do this with netbeans. |
|
|
|
Sep 26 2007, 03:23 PM
Post
#3
|
|
|
Premium Member Group: Members Posts: 219 Joined: 13-February 07 Member No.: 20,371 |
Yep that was my problem, all I had installed was the java 1.4 compiler. So I uninstalled that and went and get the java JDK which included a newer compiler, and everything worked like a charm.
And thanks for letting me know that eclipse doesn't use javac, that now makes sense as to why it was working perfectly fine, and why the command line compiling wasn't. This is an off-topic question somewhat, but as of now I have been starting to prefer using eclipse over netbeans. However, I was wondering what IDE you recommend (if any)? (Do you like eclipse, netbeans, something else?) I am just sort of curious, since although my school chooses to use eclipse for giving examples of how to do things, you can use whatever you want to program in java with, as you simply turn in the .java source code files located in the correct directories according to their packages...and so I can really use any IDE i choose. |
|
|
|
![]() ![]() |
Similar Topics
|
Lo-Fi Version | Time is now: 8th October 2008 - 03:39 AM |