aspose file tools*
The moose likes Linux / UNIX and the fly likes Linux/J2EE questions Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Linux / UNIX
Bookmark "Linux/J2EE questions" Watch "Linux/J2EE questions" New topic
Author

Linux/J2EE questions

Dave Berkheimer
Greenhorn

Joined: Feb 05, 2001
Posts: 26
Hi,

First of all, let me preface my questions by saying that I have tinkered with various versions of Linux over the years, but this is the first time that I've done anything like install j2ee on Linux. But, I've installed j2ee on several Win machines so I do have experience there. Having said all this, let's get on to the questions that I have.

1. This is more of a basic Linux question, but applies because of the situation. Do you have to uninstall j2ee from Linux if you want it to exist in another folder or can you just move it lock, stock and barrel?

2. As I stated, I've often installed j2ee on a Win machine, so I'm familiar with the necessary configurations that have to be set up in order for Java to run from anywhere; leading to this question. If I set up the JAVA_HOME and PATH correctly(which I have currently set in the etc/bash.bashrc file), should I be able to run ./javac and ./java from any location?

3. And question 2 leads to this question. Just where in the bash.bashrc do I set up the configuration variables? Most of what I've seen in the way of suggestions says to "append" the vars to the file, which to me implies the end. Is this a correct assumption on my part or have I missed something?

By the way, I'm running Ubuntu 7.10 and have the most recent version of J2EE.

Thanks for your help
Dave


Sun Certified Java Programmer
Niklas Rosencrantz
Ranch Hand

Joined: Apr 08, 2006
Posts: 49
The way I did it with Ubuntu was completely trivial, just with apt-get install and everything was set. If you want j2ee to reside in another directory I would reinstall it and try to use some installation option to specify where it installs. I myself didn't have to set up java configuration variables at all with Ubuntu. java and javac worked from any directory right after installation. I used to run Mandriva where I had to specify conf variables which isn't optimal for instance if you upgrade you have to change JAVA_HOME wherever you have it, for instance in startup files for the application server. My advice would be to avoid all manual configuration and leave as much as possible to the installer.
Good luck
Niklas
Pat Farrell
Rancher

Joined: Aug 11, 2007
Posts: 4659
    
    5

I try to stay as far away from j2Ee as possible. JSP and servlets in a .war work fine, without all the Enterprise Bean cruft.

Have you considered just using Apache and Tomcat? most linux distros can automatically install them.

Netbeans and Eclipse will make the war files from your java project with a click or two.
Maris Orbidans
Ranch Hand

Joined: Mar 08, 2004
Posts: 149
1) What do you mean by j2ee ? glassfish ? No, you don't have to reinstall it to move it to other directory. Also you can create a symbolic link anywhere you want that points to an existing directory.

2) You need to set only PATH.

3) I use .bash_profile file to set up all variables.
Maris Orbidans
Ranch Hand

Joined: Mar 08, 2004
Posts: 149
Pat, J2EE != EJB

Pat Farrell
Rancher

Joined: Aug 11, 2007
Posts: 4659
    
    5

Originally posted by Maris Orbidans:
J2EE != EJB



Very true, but I can't tell from the OP what they really want or need, which raises the question, does the OP need J2EE?
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14273
    
  21

Most Linux distributions come with a package management system for managing the software installed on the system. So the preferred way to install software is via the package management system. On Ubuntu, you use Synaptic (if you want to do it via a GUI) or with apt-get (on the command line).

Note that "J2EE" isn't a specific software package - it's just a specification, and there are several implementation of it. Sun's reference implementation is called Glassfish, and it's in the Ubuntu software repository, so the easiest way to install it on the command line is with the following command:

sudo apt-get install glassfish

If you want a different version of Glassfish than what's in the Ubuntu software repository, you can just download it from the Glassfish website and install it in whatever folder you like. If you are the only person who's going to use it on the computer, then you could install it in your own home directory. If it's a multi-user system, then a good place to install it is in /usr/local.


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 8 API documentation
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16145
    
  21

The OS only vendor-supplied JVM package for Linux currently is gcj, which is presently not suitable for used with J2EE. This may change soon, since Sun's supposed to completely open-source Java. Although opening the source code alone isn't enough - they'll have to be offering an accepted license.

Sun provides an RPM for RedHat-style systems, but at last count no .deb. You should have no problems using alien, however. Their preference was to put all the JDKs and JVMs into the directory /usr/java. Oddly enough, this very manageable approach is something they only do on Linux - Solaris is less tidy.

Java is self-contained, so it's really sufficient to get one of the archives and copy it - the Sun RPM merely registers it in the database. It takes an "rpm --erase" command to remove all traces, including the database entry.

Java actually doesn't (unless I've missed something!) use either the PATH or JAVA_HOME. The PATH is convenient, because it keeps you from typing the absolute pathnames when executing Java and its utilities since your command shell will use it. JAVA_HOME is used as a convention by many products such as WebLogic and Tomcat, but Java itself doesn't need it.

For Java products such as Tomcat, the "proper" place and way to install is generally variable - I normally prefer /usr/local for them if they don't specify otherwise.

Red Hat has an extensive set of ancillary Java RPMs, but I've found it more trouble than simply managing the stuff myself - it's a little too granular for me. The "alternatives" system is even worse, as I've mentioned before.


Customer surveys are for companies who didn't pay proper attention to begin with.
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14273
    
  21

Sun does not have .deb packages with Java, but Sun Java 6 is in the Ubuntu repository, so the preferred way to install Sun JDK 6 on Ubuntu is:

sudo apt-get install sun-java6-jdk
Dave Berkheimer
Greenhorn

Joined: Feb 05, 2001
Posts: 26
Well folks, it's me... the OP

I've digested all of the responses to my questions. Some of which I found helpful while others just lead me to more questions. Such is learning... right?

One of the things that I noticed from a lot of you was a questioning of my need for J2EE . I installed the J2EE + JDK package for Linux because I was under the impression that it was necessary to develop web applications, especially those utilizing EJB. Am I wrong? To clarify, here is my goal. I want to build a Linux machine that will allow we to locally build any type of web application that Java will allow/support with Tomcat as the servlet/jsp engine. So now you guys tell me... what is essential for making this happen?

One of the answers that I got referring to my first question brought up the subject of symbolic links. Does this imply that my installation of the J2EE package created a symbolic link to the location of the install? If that is the case, that would explain why the JAVA_HOME and PATH vars that I set up in the .bashrc file that point to the location where I moved my J2EE installation don't seem to work.

I appreciate all the answers that I received and I'm hoping that, with all of your help and a lot more reading on my part, that I get things ironed out and running.

Thanks
Dave B.
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14273
    
  21

If your goal is to write Enterprise JavaBeans, then you do need a Java EE server in addition to the JDK, so you're not wrong.

(Note that J2EE has been renamed to Java EE - Java Enterprise Edition - some time ago).
Maris Orbidans
Ranch Hand

Joined: Mar 08, 2004
Posts: 149
One of the things that I noticed from a lot of you was a questioning of my need for J2EE .


It's because many people incorrectly assume that J2EE means EJB. In fact whole java web stack (servlets, JSP, JSF and WS) is part of J2EE.


I installed the J2EE + JDK package for Linux because I was under the impression that it was necessary to develop web applications, especially those utilizing EJB. Am I wrong?


no, of course not


To clarify, here is my goal. I want to build a Linux machine that will allow we to locally build any type of web application that Java will allow/support with Tomcat as the servlet/jsp engine. So now you guys tell me... what is essential for making this happen?


You can install and use NetBeans. It comes with Tomcat and Glassfish and everything works out of the box. No plugins required.
Pat Farrell
Rancher

Joined: Aug 11, 2007
Posts: 4659
    
    5

Originally posted by Dave Berkheimer:
I want to build a Linux machine that will allow we to locally build any type of web application that Java will allow/support with Tomcat as the servlet/jsp engine. So now you guys tell me... what is essential for making this happen?


There are many ways to do it.
I write web applications in Java with .jsp and servlets all the time. I do this all with the SE (standard edition) JDK, not the J2EE version. You can do huge numbers of great things with the SE version.

I generate code for Apache on Linux with Tomcat. Works great.

I do not do Enterprise Beans and all that heavy duty J2EE stuff.

I write it all in Netbeans, and debug it with the bundled Tomcat, downloaded from the Sun /java website in a bundle, and it all works great. I love being able to debug into servlets from Netbeans. Step in, set breakpoints, look at stuff, its wonderful.

I tend to believe, IMHO, etc. that J2EE was oversold and is overkill for a lot of professional development stuff. Its complex, and I like the Lighter Faster Java karma

YMMV, of course
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Linux/J2EE questions