H8 java

Discussion in 'Scripting & Programming' started by Colin1, May 25, 2007.

  1. Colin1

    Colin1 Byte Poster

    143
    0
    38
    Hy guys can anyone help? I am in the middle of creating a program in java for an assignment in my IT degree. I have recently purchased sams programing with java and I cant for the love of god get the compiler to compile programs after I have written them.

    I have installed the JDK that comes with the book, and also the other stuff like netbeans, and Jedit. I have configured the path in my environmnet variables to get the programs from the program files were the JDK is installed and it is not having it.

    Any help pleeeasse as this second year grade goes towards my final grade at the end and I need to get working on it desperatley. Panic has set in and Ii am stressed

    Cheers folks am depending on you :(

    C :D
     
    Certifications: Cisco IT Essentials,
    WIP: IT degree, CIW (Web), A+, N+
  2. dmarsh
    Honorary Member 500 Likes Award

    dmarsh Petabyte Poster

    4,305
    503
    259
    Well you haven't really menetioned what you are doing so its unlikely you will get a helpful response !

    It sounds like its most likely a classpath issue which commonly plagues newbie Java developers.

    However from your description it could be almost anything, bad install, bad code, bad command line command etc.

    I'd look into getting a better understanding of whats happening either read up on the web or buy another book.

    This is an excellent site :- http://www.javaranch.com/

    I found this an excellent introduction and for SCJP :-

    Programmer's Guide to Java™ Certification, A: A Comprehensive Primer, Second Edition
    by Khalid A. Mughal, Rolf W. Rasmussen

    Its a little out of date now because it does not cover 1.5.

    You should be able to work things and understand them without an IDE, just use the command line to start with and write simple programs with only one class. The try something like Eclipse when you get more confident. Remember if you are having issues its normally a knowledge gap so you should make sure you've got a good foundation and go back and read more if necessary !
     
  3. BosonMichael
    Honorary Member Highly Decorated Member Award 500 Likes Award

    BosonMichael Yottabyte Poster

    19,183
    500
    414
    People in the forum are certainly helpful... but you're in a degree program. Where's your instructor in all this? Shouldn't you be leaning on him or her for advice as a first resort?
     
    Certifications: CISSP, MCSE+I, MCSE: Security, MCSE: Messaging, MCDST, MCDBA, MCTS, OCP, CCNP, CCDP, CCNA Security, CCNA Voice, CNE, SCSA, Security+, Linux+, Server+, Network+, A+
    WIP: Just about everything!
  4. hbroomhall

    hbroomhall Petabyte Poster Gold Member

    6,624
    117
    224
    You don't give us many clues as to what is going wrong.

    There is an excellent tutorial on getting started here, which I have just tried and it works.

    Give us some idea of what is going wrong and I'll attempt to help. I'm not a Java Guru - but I have used it and program for a living.

    Harry.
     
    Certifications: ECDL A+ Network+ i-Net+
    WIP: Server+
  5. Mikel

    Mikel New Member

    6
    0
    15
    I stumbled across that site a few days ago and have come across a similar problem. When compiling the HelloWorldApp.java file using the javac command, i'm told the command is not recognised. Could it be an issue relating to how JDK 6 was installed?

    Please bear in mind I am an absolute day 1 beginner in any form of programming, just trying to get a slight headstart before I begin my degree.
     
    WIP: CCNA, Computer Networking Bsc
  6. Colin1

    Colin1 Byte Poster

    143
    0
    38
    I have little experience of using C, C++, and VB.net but only through various modules in my degree. Iam not the biggest fan of programming but I can see were you are coming from. I have had trouble compiling applications written in java in both jdk 5 and jdk 6. Quite annoying :x

    If I get the problem sorted i will let you know dude.

    C :D
     
    Certifications: Cisco IT Essentials,
    WIP: IT degree, CIW (Web), A+, N+
  7. Mathematix

    Mathematix Megabyte Poster

    969
    35
    74
    You will find that when a command is not recognised that an environment variable is either not defined or is pointing to the wrong path.

    Basically, your system cannot find 'javac' because you have not told it where to find it.
     
    Certifications: BSc(Hons) Comp Sci, BCS Award of Merit
    WIP: Not doing certs. Computer geek.
  8. hbroomhall

    hbroomhall Petabyte Poster Gold Member

    6,624
    117
    224
    Did you follow the site when it talked about adding the JDK bin directory to your path? It sounds as if you missed that step out.

    If you don't add that to your path then you have to give the full path when invoking the javac command.

    Harry.
     
    Certifications: ECDL A+ Network+ i-Net+
    WIP: Server+
  9. hbroomhall

    hbroomhall Petabyte Poster Gold Member

    6,624
    117
    224
    Care to tell us just *what* errors you are getting so we can actualy help? :biggrin

    Harry.
     
    Certifications: ECDL A+ Network+ i-Net+
    WIP: Server+
  10. Colin1

    Colin1 Byte Poster

    143
    0
    38
    Hy guys I know the problem lies with the path, I need to add a classpath for the system and the user, I did not miss that step out I may have just made a typo I will go over it again and let u all know tomorow

    Many thanks for the help, much appreciated

    C :D
     
    Certifications: Cisco IT Essentials,
    WIP: IT degree, CIW (Web), A+, N+
  11. hbroomhall

    hbroomhall Petabyte Poster Gold Member

    6,624
    117
    224
    Actualy - I wasn't talking about the classpath, but the PATH environment variable, which isn't the same thing.

    PATH should be set so you can invoke javac and other tools without having to prepend the full path of the command.

    classpath is for finding classes that are not part of the JDK.

    Harry.
     
    Certifications: ECDL A+ Network+ i-Net+
    WIP: Server+
  12. Colin1

    Colin1 Byte Poster

    143
    0
    38
    ye I know my lecturer in college has sorted it out 4 me. problem solved

    C :D
     
    Certifications: Cisco IT Essentials,
    WIP: IT degree, CIW (Web), A+, N+
  13. dmarsh
    Honorary Member 500 Likes Award

    dmarsh Petabyte Poster

    4,305
    503
    259
    Sounds like you need to brush up on DOS and command line basics.

    DOS has in built commands that are part of cmd.exe, it also has extension commands that it finds through various mechanisms, the most common is the PATH environment variable that can be accessed though Control Panel, System, Settings, Environment Variables. You can also set this for a DOS/CMD session using the SET command.

    This does not explain why you could not get an IDE to work as this would not have been using the PATH variable.

    You need to know OS fundamentals really before you can program in ernest. Keep up the effort though, no one else will ever really teach you to program, they can only 'assist' you. Its also important to learn how to solve problems yourself as one day you may find yourself on your own, however if after couple days head banging best to use your lecturer, thats what they'e for !
     
  14. hbroomhall

    hbroomhall Petabyte Poster Gold Member

    6,624
    117
    224
    And what was the problem? Posting the fix info should help others who come along afterwards!

    Harry.
     
    Certifications: ECDL A+ Network+ i-Net+
    WIP: Server+
  15. Colin1

    Colin1 Byte Poster

    143
    0
    38
    Like I said, I was putting the path in the environment variables for the system but not for the user aswell. I needed to do both in order for the java compiler to see what and were my programs were to JAVAC them.

    For example if the jdk 1.5.0 was installed on the C: Drive in the program files folder then the path would be

    C:\Program Files\jdk 1.5.0\java\bin

    This would have be stated as a path for the system and the user.
     
    Certifications: Cisco IT Essentials,
    WIP: IT degree, CIW (Web), A+, N+
  16. hbroomhall

    hbroomhall Petabyte Poster Gold Member

    6,624
    117
    224
    Interesting. AFAIK if you put an update for the PATH environment variable into the System section it should carry over and be visible for all users of that machine.

    Obviously the reverse isn't true - so I assume that that was what had happened!

    Harry.
     
    Certifications: ECDL A+ Network+ i-Net+
    WIP: Server+
  17. Colin1

    Colin1 Byte Poster

    143
    0
    38
    To be honest I am not quite sure, my experience of setting up and compiling java programs is minimal to say the least. But it looks as if that is the case, I find java quite a messy language to learn at times, but once I have completed my module I can get back to what Ii enjoy doing.

    Thanks Harry Speak to you soon

    C :)
     
    Certifications: Cisco IT Essentials,
    WIP: IT degree, CIW (Web), A+, N+
  18. dmarsh
    Honorary Member 500 Likes Award

    dmarsh Petabyte Poster

    4,305
    503
    259
    Well i'm not sure what you are comparing it too ! Would you rather learn Pascal or Ada ?

    When it comes to general purpose languages I've done BASIC, Cobol, 80x86, 680x0, C, C++, Ada, Smalltalk, Fortran, Forte/TOOL and Java. As well as domain specific languages things like Prolog, JavaScript, XSLT and SQL etc.

    I think Java is an excellent choice of a beginners language at college, trust your lecturers they are not all bad !
     
  19. Colin1

    Colin1 Byte Poster

    143
    0
    38
    Oh yes I know that they are not all bad, its just that I am more interested in the hardware and networking side of IT. Programming is really something that I do when I have to, I have done and passed various modules were I have had to use C, C++, and VB.net

    If had more time I would delve deeper into programming, but my time is spent working full time in IT, studying towards a degree and cramming for A+ exams!! but I fully understand what you mean. Ii find certain aspects of java to be Ok but I prefer VB.net as I like to see what I am building in action if you know what I mean. You sound like you know your stuff my friend, is it safe to say that I can pick your brains if I have to regarding any programming stuff? I do try my best but it's not my forte

    Cheers pal hope to hear from you soon

    C :)
     
    Certifications: Cisco IT Essentials,
    WIP: IT degree, CIW (Web), A+, N+
  20. dmarsh
    Honorary Member 500 Likes Award

    dmarsh Petabyte Poster

    4,305
    503
    259
    I've also done a little bit of VB and some C# and WinForms although not enough to shout about.

    Like others have said sometimes you learn more when you struggle a bit, no one said development was easy ! Learning the peculiarities of the environment is all part of it, just like it is with networks or hardware.

    Mircosoft are very good at hiding complexity and getting you up and running very fast. They also have some advantages in this in that they generally own the entire stack of development tools, web server, os etc. This is great for getting the job done, but is generally going to mean that many things are happening 'magically' without your knowledge or control. One day this will come back to bite you !
    (Read up on leaky abstractions !)

    One of the most important things you can learn is that there is no 'magic', that computers follow instructions that they are given. Everything happens for a reason, maybe not why you think, but there will be logic in it.

    Generally introductory C/C++ classes will cover command line basics, environment variables, make files, the preprocessor, the compiler, the linker etc. This should have made you aware of things like the PATH environment variable.
     

Share This Page

Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.