Results 1 to 6 of 6

Thread: Java problem(s)

  1. Default Java problem(s)


    I'm in my last chapter of Java up at Francis Tuttle. For this chapter, I was taught how to make a stock-checking program with a password interface, database manipulation via JDBC-ODBC and all that jazz. The book provides all the code and I basically copy it down while reading about how that particular chunk of code works. Weird thing is, I'm getting a weird 'no connection' issue whenver I try to run the program. Its not seeing the database, which is in the same place the program and all its components are in. I asked my teacher for help, and he copypasta'd the de-facto files and whatnot to my folder. It worked for that day and I got started on the next project. Next day I try to run the original program and I get picture related.

    I've got to make 6 different programs using this program as a base, but I can't do jack until I figure out why
    the program isn't working right. My google-fu is weak, so I come to SP for help.

    Information


    Bonus issues - Edit 1
    Last edited by Piggy 2.0; 2012-12-18 at 07:52 PM.

  2. Default Re: Java problem(s)


    I think it's some pathing issue where your program is not seeing the database. Are you using 32-bit JDK or 64-bit?

  3. Default Re: Java problem(s)


    32 I think. I'm not really sure, its been a while since I've checked.

  4. Default Re: Java problem(s)


    You may be better off using Eclipse or a similar IDE (NetBeans is another one. I personally prefer Eclipse). Eclipse is 100x better, in my opinion, especially when it comes to file management.

    I think the issue is simply that everything isn't properly managed in TextPad. Eclipse should help with that.

    That's just my opinion, I could be completely off with it being the issue, however I think getting off of TextPad now will help you in the future. I've made this recommendation to many people in my own classes, and most of them have thanked me afterwards.

    About the bonus issue: Honestly, programming is a major example of "learn by doing." You can look at books and copy book code all day, but it doesn't help if you don't do anything yourself. Even these examples that you have from books, manipulate them. Do things to them that are not part of the project. Anything you can think of, even if it sounds simple in your head.

    Then, after you've done a decent amount of manipulating other people's codes, try making your own projects. Think of something random, it doesn't need to be something super cool or something super sophisticated. Just make a program that does something, takes user input, uses files, etc. Then, when you get it all working, think about how you can make it more efficient code. For example, if you have the same code multiple times, wouldn't it be better to separate this code into a single method and just call that method multiple times instead of copying the same code over and over? Always think about error checking. All that kind of stuff.

    One of the great things about Java is that it has a TON of two things: Information and Libraries. Java Commenting has the ability to work in comment resource pages in them (/** initiates this). Anyone who makes anything important that they release to other people make use of this. Why is this helpful? Well... There's a library for just about everything, the hard work is often done for you by someone else already. Make use of that. It's a powerful resource in Java. If you don't understand what something is doing or does, you open the comment resource page, and it's all described (hopefully in a helpful way).

    Hope this helps.

  5. Default Re: Java problem(s)


    A friend mentioned Eclipse to me as well last year. He gave me the files for it, but I lost them due to last-minute-shenanigans. I only work in TextPad because thats what I use up at my class, and I dunno if Eclipse stores or converts the files differently since I have to send them to my teacher when I'm done with all the projects. I'll definitely start using it at home, however.

    Other than that, holy hot damn is that helpful.

  6. Default Re: Java problem(s)


    Glad I could help.

    Eclipse doesn't really store them differently, other than giving some structure to your project. For example, all your java files end up in a src folder, and all your class files(compiled code, not what you want to give to your teacher) end up in a bin folder.

    If you want a file to be run directly in the project without a path, you would put it in the main folder.

    So for example, let's say your project folders are in "C:/Java/Workplace/ProjectNameHere/".
    Your Source (.java) files would be in "C:/Java/Workplace/ProjectNameHere/src"
    Your Compiled (.class) files would be in "C:/Java/Workplace/ProjectNameHere/bin"
    Typically, libraries you add would be in a lib folder so: "C:/Java/Workplace/ProjectNameHere/lib"
    And any files you want to execute directly would be in the base folder, "C:/Java/Workplace/ProjectNameHere/whatever.extension".
    I imagine that's where you would put your database information and what not. Then you can just access it by "whatever.extension" in your code.

    In the future, if you wish to add a library to Eclipse, it's EXTREMELY easy.
    All you do, is add said library to your project, and as specified earlier, preferably in a lib folder. Then, when you refresh the tree path in the project explorer on the left of Eclipse, you will see that folder. Open it, select the library, right click it, and hit Build Path -> Add to Build Path. It does all the work for you in configuring it correctly. Then you can just import it like a regular library, and you're good to go.

    You can always look up file access stuff on the web if you want further details on how Eclipse manages files, but if you just put everything in the root directory of your project, you should be perfectly fine when your teacher tries to access it if s/he uses TextPad.

    As for your new question: Good luck...I haven't exactly been lucky with schools myself so I have no recommendations. Sorry.

  7.  

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •