Results 1 to 3 of 3
  1. #1
    PeterTaps is offline Member
    Join Date
    Jun 2010
    Posts
    1
    Rep Power
    0

    Default Organizing Java code

    Folks,

    We plan to convert all our .NET C# code into Java. It is about 900K lines of source code and is organized under various projects. While programming in Java itself would most likely not be an issue, organizing the code would be important. I would appreciate your help in enlightening a .NET guy into Java world.

    Under .NET, reusable code is stored in "DLL" type projects. You can create multiple applications (.exe files) that may reference one or more of your DLLs.

    If you use Visual Studio, all your projects (those that build DLLs and those that build EXEs) can be grouped into what is called as a "solution." When you build a solution, all the projects are built in the proper dependency order.

    I am guessing the equivalent of a DLL is a .jar file under Java.

    Q1. Under Eclipse, do you create one project for each "jar" type output?
    Q2. Under Eclipse, is "workspace" the closest to .NET "solution?"
    Q3. We we install the application, all the jar files will not be copied in the same directory. Depending on the purpose of jar files, they will get copied to various subdirectories under installation folder. Is there a config file that can be created to let the main application know the location of various jar files?
    Q4. Is there a good book on organizing Java projects (with or without Eclipse)?
    Q5. Are there any articles on Java programming best practices?

    Thank you in advance for your help.

    Regards,
    Peter

  2. #2
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,447
    Blog Entries
    7
    Rep Power
    20

    Default

    Quote Originally Posted by PeterTaps View Post
    Q1. Under Eclipse, do you create one project for each "jar" type output?
    Q2. Under Eclipse, is "workspace" the closest to .NET "solution?"
    Q3. We we install the application, all the jar files will not be copied in the same directory. Depending on the purpose of jar files, they will get copied to various subdirectories under installation folder. Is there a config file that can be created to let the main application know the location of various jar files?
    Q4. Is there a good book on organizing Java projects (with or without Eclipse)?
    Q5. Are there any articles on Java programming best practices?
    A1. Not necessarily: Eclipse allows you to stick in a .jar file whatever you want. By default it assumes that you want to jar your entire project but you can click on the changes you want.
    A2. sort of; you can have multiple workspaces but only one of them is 'active' at the time.
    A3. This doesn'y really make sense in Eclipse: it copies whatever is needed to run a 'configuration' (that's an Eclipsism) but this is more of an installation issue.
    A4. Eclipse has some nice tutorials around on the net.
    A5. Check James Gosling's "The Java Programming Language".

    kind regards,

    Jos

  3. #3
    gcalvin is offline Senior Member
    Join Date
    Mar 2010
    Posts
    953
    Rep Power
    5

    Default

    Quote Originally Posted by PeterTaps View Post
    Q3. We we install the application, all the jar files will not be copied in the same directory. Depending on the purpose of jar files, they will get copied to various subdirectories under installation folder. Is there a config file that can be created to let the main application know the location of various jar files?
    You'll want to get familiar with the concepts of CLASSPATH and package in Java.

    CLASSPATH is an environment variable (or a command-line option) that contains a delimited list of directories that the JRE will search for Java bytecode in the form of .class files or .jar files.

    A package is essentially a unique namespace. Typically, for code you write yourself, you will want to use a registered domain name for your package name. For instance, if you have registered the domain name mycompany.com, you might have packages named com.mycompany.myproject.library and com.mycompany.myproject.client and com.mycompany.myproject.server. If you have 'C:\javacode\' on your CLASSPATH, and your main class attempts to
    Java Code:
    import com.mycompany.myproject.library.Utils;
    then the JRE will find any of
    Java Code:
    C:\javacode\com.mycompany.myproject.library.jar
    C:\javacode\com.mycompany.myproject.library\Utils.class
    C:\javacode\com\mycompany\myproject\library\Utils.class
    etc.
    That's a bad explanation, but I hope it gives you some idea. Google, study, and experiment.

    -Gary-

Similar Threads

  1. Traffic Organizing In JAVA2D Problems
    By tamer in forum Java 2D
    Replies: 5
    Last Post: 04-25-2010, 11:41 PM
  2. Convert java code to midlet code
    By coldvoice05 in forum New To Java
    Replies: 1
    Last Post: 08-12-2009, 11:14 AM
  3. Convert java code to midlet code
    By coldvoice05 in forum Advanced Java
    Replies: 1
    Last Post: 08-09-2009, 01:21 PM
  4. organizing elements in the jpanel/jbox
    By okabeer in forum AWT / Swing
    Replies: 7
    Last Post: 04-15-2009, 12:42 PM
  5. organizing larger application code / modules
    By zenner in forum Advanced Java
    Replies: 5
    Last Post: 07-28-2008, 09:18 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
  •