aspose file tools*
The moose likes Beginning Java and the fly likes Environment setup/configuration Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Environment setup/configuration" Watch "Environment setup/configuration" New topic
Author

Environment setup/configuration

Phill Fisk
Greenhorn

Joined: Dec 12, 2006
Posts: 3
Greetings all...a rather complicated question for the beginner forum, but I wasn't quite sure where to start.

My company is currently ramping up to begin Java development for one of our clients. We have been doing work for them in .NET/SQL2000 for about 2 years now, but they have decided at a corporate level to make the move to Linux/Oracle. Being that our current evnironment is configured to support standard .NET development, I'm saddled with the task of learning and planning out our environment for Java development.

To that end, I've been researching the various tools, environments, applications, etc., that we should be using in our environment. I've sketched out a plan that I think will work, but I wanted to run this past some experts and see if there's anything I'm missing, or if I'm completely off-base and this crazy thing won't work.

On to the good stuff...

My current understanding of how a standard Linux server configured to run a Java-based web site goes like this:

- Linux as the OS
- Apache as the base web server
- Tomcat/Jboss as your Java handler (the processor that brings Java to the user through Apache if you will)
- Tools like Websphere/Weblogic that provide an additional application layer/set of tools for developing more robust applications
- Oracle (10g in our case) providing database support, using JDBC to access the database from the application layer.

So I guess my first question is, am I right in my understanding here? Is there anything I've left out or misunderstood?


On to the next bit...

Assuming my above understanding is correct, each developer is going to need a development environment. Since we're also supporting several other clients in a Microsoft-world, I don't think that changing our local machines over to Linux is a realistic option. To that end, we're looking at a couple of options.

1) Do all Java development locally, trusting that when we move the code base to the Linux server, all will go well (which I somehow don't believe)

2) Do all Java development using local tools, but connecting to the server remotely through something like a Samba share. I've been looking at tools like Netbeans and Eclipse, and based on what I'm seeing, they can be configured in such a way that they can actually build and debug on the remote server without any issues. To facilitate this we would do the following:

- Set up a machine running Linux, apache, tomcat, cvs, samba, etc. To serve as a centralized file and web server.
- Each developer would have their own apache site and file space where they would develop
- All work would be done locally, with files/builds/etc on the remote server

So I guess the big question is...is this possilbe? And if it is possible, is it a good idea? I have tons more questions, but I figure I need to start somewhere.

Thanks for any help in advance!
Edwin Dalorzo
Ranch Hand

Joined: Dec 31, 2004
Posts: 961
Hi, Phill. Welcome to Java Ranch!

I am relatively new to Java and actually have little experience working on Web development with it, but I will tell you what I understand, and maybe others can add to my comments or even correct my understanding.

I am currently developing Java applications under Linux OS (Ubuntu) so I am pretty sure it is very similar to developing applications under Windows. Altough some tools, like the application servers, above all, may have different system requirements depending on the OS. So be careful about this.

Now, Tomcat Server can stand on its own feet. Therefore, if you are thinking of just running Java applications you will not need the Apache Server itself. But if you are running applications developed with scripting languages like PHP or PEARL as well then you can use mod_jk plugin in Apache in order to handle the communication between the two servers: Tomcat and Apache Server.

Now, Tomcat is just capable of handling Servlets and JSPs, therefore if you want to work with EJBs and Web Services then you may need to consider other options. Like JBoss, Geronimo, Jonas, Sun Application Server. Or commertial application servers like BEA WebLogic and Websphere.

Now, commertial versions of the application servers typically provide integrated development tools to facilitate the software development. Some of these tools are based on opensource IDEs. For instance, the IDE provied by WebSphere is a commertial version of Eclipse, or the Sun Java Studio seems to be based on NetBeans.

BEA Weblogic provides a set of plugins for Eclipse that can be used to make the application development easier and you can always get very nice plugins with additional tools from third-party vendors. For instance, if you want to use Jasper Reports to develop reports, you can get a Jasper Assistant plugin for Eclipse in order to develop you report graphically using drag-and-drop tools.

When it comes to Java it is very different than developing in .Net or other Windows propiertary languages. I come from the Windows environment too, and it was a real impact to me, because with Java there are plenty of options. It takes a while to make a nice configuration for your team, so you better taste most of them and see what you like and what it is really helpful to you.

For instance, when it comes to IDEs there are plenty of options:

Eclipse (free by Eclipse)
NetBeans (free by NeatBeans)
Sun Java Studio (free by Sun MicroSystems)
JDeveloper (free by Oracle)
Sun Java Studio Creator (free by Sun MicroSystems)
JBuilder (commertial by Borland)
IntelliJ Idea (commertial by Jet Brains).

...etc,etc.

When it comes to application servers there are plenty of options either. Take a look at this Java Server Matrix published by The Server Side.

It will be, likewise, difficult to pick the right development frameworks, depending on your needs.

Now, about sharing software components, you can set up a CVS or Subversion server in Linux. Practically all Java IDEs I know are capable of working with any of these tools. And they are relatively easily configured.

Now, I have always worked in such a way that every developer has its own application server working locally. They deploy locally and test, once the code is free of bugs, then they synchronize it with the CVS os SVN server. If you want to share files between developers, you could use the same CVS or SVN server. If you want to share files with the other terminals in the Windows OS, but not through the CVS or SVN then you can use Samba (SMB).

Although Java is multiplatform, it does not mean that you can develop without care about your OS. For instance, paths are written different in Windows than in Linux. If your developers work under Windows and write the paths with back slashes (\) there are good chances that this code will not work under Linux.

Also, it is very important not to use platform-dependant code. For instance, if you use System.exec() method to invoke an OS command, it will probably not work under Linux.

Be careful also with frameworks you use, make sure they are platform-independant, and when they are not, then make sure they have distributions for both: Windows and Linux (i.e Standard Widget Toolkit aka SWT).

Also, if you use Java Native Interface, you are running a great risk that your code will not work under Linux unless you recompile the underlying libraries for the new OS.

What I do is that I have two environments. It could be either by means of having the two OS installed in the machine or by means of using a virtual machine to run the other operating system. For instance, VMWare Virtual Machines can run either in Linux or Windows. You could use VMWare to run a Window OS from Linux or a Linux OS from Windows. But it is always better to test you code in both environments in order to spot this kind of mistakes I just told you.

And of course, when it comes to unit testing, it could be a good idea that your tests are run in as many environments as those you pretend to support.

I hope this helps.
[ December 12, 2006: Message edited by: Edwin Dalorzo ]
Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
Hi, good discussion!

Our team has had good luck developing on Windows, running local copies of the app, and then moving a complete EAR or WAR to a UNIX environment (Solaris & AIX) for testing and production. About the only problems were around paths to files, eg C:\path\file on windows and whatever path on UNIX and we quickly learned to get those out of the code.

At a glance, your tech stack looks reasonable. Using Servlets and JSPs is pretty much a given, but don't jump into EJB without checking the alternatives. Google for people who like "POJOs in Action" and the Spring framework. An EJB container has some benefits, but a ton of complexity that may not balance out depending on your requirements.

Keep us posted as you get going!


A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24183
    
  34

Note that JBoss, Websphere, Weblogic, and Tomcat are alternatives; you won't use more than one of these four. Apache may be used in addition, but in many cases you can simply let your app server (i.e., the four things above) serve all your Web content, and not use Apache at all.


[Jess in Action][AskingGoodQuestions]
Phill Fisk
Greenhorn

Joined: Dec 12, 2006
Posts: 3
Wow...that certainly is a lot of really good information. I really appreciate your detailed responses.

I've done a bit more poking around, and have gratuitously taken advantage of my local Borders to read up a little more on EJB's, Eclipse, and a touch of CSV.

Just to spit back a bit of what I'm understanding first though. Based on what I'm seeing here, and what I'm reading, we really only need to choose one application/web server platform. Basically, anything we go with will be a pretty much stand-alone system. Since most of my experience has been with PHP and Apache (at least in the non-microsoft world), I always assumed that Tomcat/Jboss were simply extensions/stand alone apps that took advantage of Apache for basic "web server" tasks, and then added their own special application processing to the mix. I think I'm a little clearer here, but I did have one question to tie this up. If we were to go with Weblogic, Jboss, etc., would we be able to set up PHP as well, if for some reason we felt we wanted to do a bit of PHP work on the site as well? I know this is a little off topic for this forum, but it did come to mind.

I guess first I'd like to talk a little more about the environment itself.

I've read a little more about Eclipse (and reading your sage advice), and since we're somewhat leaning towards WebLogic at this point, it sounds like Eclipse is the de-facto standard for developing with WebLogic. Now, maybee to clarify a little bit more about how I was trying to set up the environment and why.

We have, in fact, discussed a VMware solution, and are actually planning on running the primary Linux box (we're using Redhat Enterprise BTW) and the Oracle box as virtual machines on a VMWare platform. Now, we could potentially set each developer up with their own VMWare develpment environment, in addition to their local Windows development machine, but that does bring up some issues with maintaining two separate development machines for each developer (we're a little short on IT resources). Also, we're trying to stick with Redhat Enterprise licenses, instead of falling back to the freeware Fedora stuff, but of course, there is a financial component to this that I have to evaluate, and having to purchase a slew of extra Redhat enterprise licenses for each developer is something we'd like to avoid if possible.

Which brings me to how I was trying to solve the problem. What I would like to do is have a separate web site/filespace for each developer, that they would access remotely using Eclipse on their local desktop. This way, all the files are located on a centralized machine, and we only have to maintain that one environment. In addition to the developer environments, we would also have a separate "build" environment that would be used for testing/staging/production builds before moving out to those separate environments. We, of course, would use CVS in this process, as a repository for all source files, allowing developers to check-in/out as necessary, just as we currently do with VSS.

So I guess this part of the discssion boils down to one question...will this work? Is it possible to develop using local tools, but a remote (via FTP, samba, etc) filespace and web server, and still be able to take advantage of the various debug and build features of the tool (Eclipse most likely) that we're using?

And on to the second bit...

As I mentioned earlier, I've been poking around in books trying to understand the difference between Servlets, JSP's, and Javabeans/EJB's. I think I have a pretty good understanding of how Servlets and JSP's relate, and what they do, but the whole EJB thing is sort of escaping me.

First, let me just quickly outline my understanding of JSP's and Servlets. The way I'm understanding it is that Servlets are the moral equivelant of code-behinds in .NET, while the JSP's are the ASPX's of the world. I know this isn't quite an accurate representation of things, but it's close. Now, I'm a little fuzzy on EJB's. Based on what I'm reading, they essentially provide all of the other tools that we're used to having with .NET. For instance, EJB's essentially provide things like session mangement, database connectivity, and other standardized classes/objects that we would normally see in a fully-developed toolset. Is this a pretty accurate representation of this? Am I missing anything blatant?

I guess that being said, it sounds more and more like we should lean towards something like WebLogic. We could certainly go with something like Jboss (as long as it supports everything we need), and then look around for various EJB implmementations (if that's the right word), and go from there, but I'm more and more inclined to go with a single solution for everything. This would allow us to simplify things out of the gate for us, and get us up and running much more quickly.

And again (and as always) I really appreicate any help you guys can provide.

Thanks!
Edwin Dalorzo
Ranch Hand

Joined: Dec 31, 2004
Posts: 961

If we were to go with Weblogic, Jboss, etc., would we be able to set up PHP as well, if for some reason we felt we wanted to do a bit of PHP work on the site as well? I know this is a little off topic for this forum, but it did come to mind.


I do not have any experience doing this. I know PHP has certain extensions that can be used to execute Java code from within a PHP script. I also know that some Java application servers offer extensions to execute PHP code within Java code.

Take a look a these sites:

1. PHP and Java Integration
2. PHP/Java Bridge
3. PHP Integration Kit for WebSphere Application Server Community Edition

I daresay, however, that this looks to me more as integration mechanism than as a way to do things.

And, of course, there is nothing that prevents you from running an Apache Server and a Java Application Server in the same network, even in the same machine if that is what you want. The servers could communicate in the traditional way: sending requests to each other.


We have, in fact, discussed a VMware solution, and are actually planning on running the primary Linux box (we're using Redhat Enterprise BTW) and the Oracle box as virtual machines on a VMWare platform. Now, we could potentially set each developer up with their own VMWare develpment environment, in addition to their local Windows development machine, but that does bring up some issues with maintaining two separate development machines for each developer (we're a little short on IT resources).


You may as well develop everything under a Windows platform as long as you take into account all the platform-depedant issues that we already discussed. This way you just need to invest only in the testing of code in order to guarantee it really runs on all platforms.

Now, if all the Linux terminals that you need are not for production purposes you actually do not need to invest in commertial distributions. I have run application servers like Websphere and JBoss in Ubuntu, as well as Database Server like Sybase SQL Anywhere and Oracle XE.

Take a look at this article: Ubuntu On The Business Desktop.

If you were pretending to mount a production server, then you may consider a commertial distribution that offers better support and stability, but for development purposes, do you really consider necessary to invest money in the OS that you yourself consider a secondary option and that you are just acquiring in order to finish this project?

I may be wrong on this, but what if you develop all the code under Windows and have a couple of testing servers, one running under Windows and other under Linux in order to guarantee the code compliance?


What I would like to do is have a separate web site/filespace for each developer, that they would access remotely using Eclipse on their local desktop. This way, all the files are located on a centralized machine, and we only have to maintain that one environment. In addition to the developer environments, we would also have a separate "build" environment that would be used for testing/staging/production builds before moving out to those separate environments.


In the traditional way, the developer typically have an instance of the application server, downloads the code from the CVS or SVN to his/her local SandBox in the hard drive, do the work and once the code is free of bugs, uploads it to the code repository again.

You do not need a remote filespace for this. All you need is server running CVS or SVN where the code will ultimately reside.

If you want to have the code repository under Windows, you can use CVSNT. Or you set up CVS or SVN server under Linux.

You do not need SMB, FTP or NFS to do any this. Simply install and configure the version control system, and that's it.


First, let me just quickly outline my understanding of JSP's and Servlets. The way I'm understanding it is that Servlets are the moral equivelant of code-behinds in .NET, while the JSP's are the ASPX's of the world. I know this isn't quite an accurate representation of things, but it's close.


I do not know .Net, but that way I see it: a servlet is the way to embed HTML code into Java code, and JSP is a way to embed Java code into HTML.


We could certainly go with something like Jboss (as long as it supports everything we need), and then look around for various EJB implmementations (if that's the right word), and go from there, but I'm more and more inclined to go with a single solution for everything.


You will need to look more into the significance of EJBs. I have worked very little with them. As an unexperienced developer I felt they could be a extremely powerful technology, but yet very complicated to understand. An unexperienced team may commit many serious mistakes while learning to harness this technology. Therefore, be careful about this, because this is not the only way to do things.

I hope this helps!
[ December 13, 2006: Message edited by: Edwin Dalorzo ]
Phill Fisk
Greenhorn

Joined: Dec 12, 2006
Posts: 3
First, I just wanted to say thanks again for all the great information.

In the traditional way, the developer typically have an instance of the application server, downloads the code from the CVS or SVN to his/her local SandBox in the hard drive, do the work and once the code is free of bugs, uploads it to the code repository again.


This is identical to how we do things in .NET, so the methodology at least is very familiar to all of us. I think my largest hang up is that I'm still not sold on the whole cross-platform thing. I've seen that claim so many times, and been burned by it so many times, that I'm allways a little gunshy when developing on a different platform from the hosting platform. That being said, I certainly recoginze that this has been the mission of Java from Day 1, so I guess I'm just looking for a thumbs up from someone who's been-there-and-done-that with a Windows to Linux project before.

If you were pretending to mount a production server, then you may consider a commertial distribution that offers better support and stability, but for development purposes, do you really consider necessary to invest money in the OS that you yourself consider a secondary option and that you are just acquiring in order to finish this project?


I think we're trying to keep everything as close to production as possible, to avoid any snags with code developed on one version of Linux (or even the freeware distro vs. the enterprise one) not working on another. I realize that if we do go with the Windows-to-Linux process, this is sort of moot however. Also, this project is likely to last several years, since we're also going to be maintaining the site for the forseeable future, so I'd rather set it up right in the beginning.

I think that beyond all of this I guess I need to spend a little more time looking at the specific features of Weblogic, and trying to understand how they differ/improve upon the freeware options of JBoss and Tomcat. Also, I'm going to try to spend some more time understanding the idea of EJB's in relation to these options...of course, I _think_ (and please correct me if I'm wrong) that if I go with something like Weblogic, all of these EJB's will really be provided for us, and it's just a matter of learning that toolset, vs. if we were to go with JBoss or Tomcat, we'd have to go look for a set of freeware EJBs?

And again, thanks for all the great help!
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14103
    
  16

1) Do all Java development locally, trusting that when we move the code base to the Linux server, all will go well (which I somehow don't believe)

Well, that's how I've been working with Java and J2EE software for years - the developer's workstations run Windows (usually Windows 2000 or Windows XP) and deploy the software on one or more servers running whatever OS (various flavours of Unix, Windows, OpenVMS, etc.) - it is a very common way to develop Java software. Java really runs on any OS for which a Java runtime environment is available. You can stop worrying about this.

This is identical to how we do things in .NET, so the methodology at least is very familiar to all of us. I think my largest hang up is that I'm still not sold on the whole cross-platform thing. I've seen that claim so many times, and been burned by it so many times, that I'm allways a little gunshy when developing on a different platform from the hosting platform. That being said, I certainly recoginze that this has been the mission of Java from Day 1, so I guess I'm just looking for a thumbs up from someone who's been-there-and-done-that with a Windows to Linux project before.

Ok, here are my thumbs up and been-there-done-that. As I said above that's how I've done it on many commercial projects - for example with Weblogic, developers have their own Weblogic installed on their local machines (Windows), deploy the app there while they are developing and testing it, and without any changes the app is deployed on a big Windows or non-Windows server.

Yes, it really works like this with Java.

(Well, ofcourse before you really put an application into production, you will be testing it in an environment that is as much like the real production environment as possible).
[ December 14, 2006: Message edited by: Jesper Young ]

Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Environment setup/configuration