Results 1 to 7 of 7
  1. #1
    rothe is offline Member
    Join Date
    Dec 2013
    Posts
    13
    Rep Power
    0

    Default How to start build a project (using netbeans)

    I am totally new in Java. I needed a program language that is fast not like PHP/Javascript that have I used so far.

    I have downloaded NetBeans and tried some simple things like different loops, arrays, reading image file width/height inside one function. Now I'd like to create project where images in one folder will be read into memory and analyzed maybe saved into DB. My question is - this all stuff will not be written into one class? Other way it will be a veeeeery long page to scroll. Is there any help online how the projects must be build up (classes, packages, functions, methods) how this communication is made.

  2. #2
    KevinWorkman's Avatar
    KevinWorkman is offline Crazy Cat Lady
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    3,864
    Rep Power
    8

    Default Re: How to start build a project (using netbeans)

    If you're just starting out, I recommend using a more basic editor and compiling with the command prompt.

    I'm not sure what your question is, but no, you shouldn't put all of your code in a single class file. You should split your functionality up as appropriate.
    How to Ask Questions the Smart Way
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  3. #3
    rothe is offline Member
    Join Date
    Dec 2013
    Posts
    13
    Rep Power
    0

    Default Re: How to start build a project (using netbeans)

    Quote Originally Posted by KevinWorkman View Post
    If you're just starting out, I recommend using a more basic editor and compiling with the command prompt.

    I'm not sure what your question is, but no, you shouldn't put all of your code in a single class file. You should split your functionality up as appropriate.
    No, NetBeans is file. It points to my mistakes before I start to compile the code and it seem like all-in-one tool.

    Yes, my question was a bit messy but will try to make myself more clear with the help of example. This is right now main class.

    Java Code:
    package ristojob;
    
    import java.awt.Image;
    import java.io.File;
    import java.io.IOException;
    import javax.imageio.ImageIO;
    
    public class RistoJob {
        public static void main(String[] args) throws IOException {
            File file = new File("C:\\work\\java\\test.png");
            Image image = ImageIO.read(file);
            int width = image.getWidth(null);
            int height = image.getHeight(null);
            System.out.println("w = " + width+ ", h = "+height);
        }
    }
    Now if I want to add something that reads directory and enumerates the .png files inside it then what would it be - a function, class, method ??? and where I should place that - inside the main function, separate function inside the class, separate .java file, separate package?
    Last edited by rothe; 12-11-2013 at 09:16 PM.

  4. #4
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,800
    Rep Power
    19

    Default Re: How to start build a project (using netbeans)

    Quote Originally Posted by rothe View Post
    No, NetBeans is file. It points to my mistakes before I start to compile the code and it seem like all-in-one tool.
    Until you come on here and start asking questions about class paths because you haven't had to deal with them because Netbeans has hidden (most of) the details of how they function and what they are.
    Which is why we usually suggest starting with a text editor and the command line, at least for the first few weeks. Something like Notepad++, which at least has syntax highlighting.
    Quote Originally Posted by rothe View Post
    Yes, my question was a bit messy but will try to make myself more clear with the help of example. This is right now main class.

    Java Code:
    package ristojob;
    
    import java.awt.Image;
    import java.io.File;
    import java.io.IOException;
    import javax.imageio.ImageIO;
    
    public class RistoJob {
        public static void main(String[] args) throws IOException {
            File file = new File("C:\\work\\java\\test.png");
            Image image = ImageIO.read(file);
            int width = image.getWidth(null);
            int height = image.getHeight(null);
            System.out.println("w = " + width+ ", h = "+height);
        }
    }
    Now if I want to add something that reads directory and enumerates the .png files inside it then what would it be - a function, class, method ??? and where I should place that - inside the main function, separate function inside the class, separate .java file, separate package?
    Depends what your code is supposed to do.
    The above would simply be a piece of test code in my hack project where I test out basic concepts, like reading files, processing things in certain ways.

    The real code for an application will be structured based on the needs of the application.
    So a bit of code for listing all the png's in a directory, including their details (eg height, width) would probably be in a class, consisting of 2 or 3 methods, and some attributes (folder location, list of pngs, which themselves may be a class).

    And Java had methods...it does not have functions.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  5. #5
    KevinWorkman's Avatar
    KevinWorkman is offline Crazy Cat Lady
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    3,864
    Rep Power
    8

    Default Re: How to start build a project (using netbeans)

    Quote Originally Posted by rothe View Post
    No, NetBeans is file. It points to my mistakes before I start to compile the code and it seem like all-in-one tool.
    It also has you completely confused about how to use multiple classes. If you want to continue down this dead-end road because it seems easier now, the best I can do is wish you good luck.
    How to Ask Questions the Smart Way
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  6. #6
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    3,673
    Rep Power
    5

    Default Re: How to start build a project (using netbeans)

    Both points of view are true though; Netbeans is a wonderful tool for learning the language syntax. But it sucks for learning the Java platform and tools because it hides (or tries to hide) way too much from you.

    My opinion, which has molded into its current shape through many changes over the past few years, is that you should start with an IDE like Netbeans to learn the language syntax so you can benefit from the useful error reporting. When you're ready to learn things like the classpath, using packages and multiple classes and how to use the java, javac and jar tools, that you need to let go of Netbeans for a while and learn how to do all that from the command line yourself, and when you understand switch back to Netbeans (or another IDE) and learn how to do all that again using the IDE. That will also give you an appreciation for how much easier the IDE makes your life.

    But if you don't know WHAT it does and HOW it does it, you will not know how to work together with it and will almost always start to work against it. This thread is proof of that.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  7. #7
    rothe is offline Member
    Join Date
    Dec 2013
    Posts
    13
    Rep Power
    0

    Default Re: How to start build a project (using netbeans)

    Thanks! I have to do first simple things to learn and understand what I am doing. It is probably more easier when I have less flashing lights and huge number of options jumping around. I will install JDK7 SE and continue with Editplus3 and javac.

Similar Threads

  1. Replies: 3
    Last Post: 03-16-2012, 10:47 AM
  2. can eclipse use makefile to build the project ?
    By Baseer in forum Advanced Java
    Replies: 1
    Last Post: 03-16-2012, 07:29 AM
  3. How can I change a project's build directory?
    By sylvpan in forum NetBeans
    Replies: 11
    Last Post: 02-03-2011, 06:18 AM
  4. when i build my project it give following error
    By enggvijaysingh@gmail.com in forum Advanced Java
    Replies: 0
    Last Post: 11-18-2010, 11:02 AM
  5. know about how to build JSF app in NETBEANS IDE
    By vasanthathatha in forum JavaServer Faces (JSF)
    Replies: 2
    Last Post: 05-06-2009, 11:26 AM

Posting Permissions

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