Results 1 to 3 of 3
Thread: Organizing Java code
- 06-10-2010, 08:58 PM #1
Member
- Join Date
- Jun 2010
- Posts
- 1
- Rep Power
- 0
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
- 06-10-2010, 09:12 PM #2
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,405
- Blog Entries
- 7
- Rep Power
- 17
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
- 06-11-2010, 09:39 PM #3
Senior Member
- Join Date
- Mar 2010
- Posts
- 953
- Rep Power
- 4
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
then the JRE will find any ofJava Code:import com.mycompany.myproject.library.Utils;
That's a bad explanation, but I hope it gives you some idea. Google, study, and experiment.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.
-Gary-
Similar Threads
-
Traffic Organizing In JAVA2D Problems
By tamer in forum Java 2DReplies: 5Last Post: 04-25-2010, 11:41 PM -
Convert java code to midlet code
By coldvoice05 in forum New To JavaReplies: 1Last Post: 08-12-2009, 11:14 AM -
Convert java code to midlet code
By coldvoice05 in forum Advanced JavaReplies: 1Last Post: 08-09-2009, 01:21 PM -
organizing elements in the jpanel/jbox
By okabeer in forum AWT / SwingReplies: 7Last Post: 04-15-2009, 12:42 PM -
organizing larger application code / modules
By zenner in forum Advanced JavaReplies: 5Last Post: 07-28-2008, 09:18 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks