Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Does anyone know about Java Dev on Ubuntu?

  • 24-03-2011 12:02pm
    #1
    Registered Users, Registered Users 2 Posts: 1,019 ✭✭✭


    Hi Folks,

    I have been trying to get Java more specifically J2EE/Tomcat up and running on my laptop on and off for about a fortnight. I need it for a project I'm doing for college but so far it has just wrecked my head.

    I tried to install Eclipse which I have used before from the software manager (it gives me v3.4 I think) but this includes nothing for J2EE development (as its missing WTP plugins as far as I know). I wasn't able to find an easy way to install WTP (can't be found via Eclipse Update Software). So I said bugger this and downloaded the J2EE edition of Eclipse from the sun website, I installed it (v3.5 Helios) and of course there appears to be no option to create servelts, JSP etc. I do not have any options to specify my Tomcat Server.

    Does anyone know of a good tutorial with included download links that will let me have an appropriate version of Eclipse and a Tomcat server up and running in about half an hour. I know I can do it on a windows machine and the more time this takes the more likely I am to go back to Windows. Im a big big fan of Ubuntu but not when its taking stupid amounts of time to do what should be otherwise straight forward.

    Dave


Comments

  • Registered Users, Registered Users 2 Posts: 3,579 ✭✭✭BopNiblets


    Maybe consider Netbeans as an alternative?
    It's what we're using in my course and it's easy enough to create Java Web app projects with it, doesn't use tomcat server though, uses Glassfish if that's any use.

    http://netbeans.org/downloads/index.html


  • Registered Users, Registered Users 2 Posts: 1,110 ✭✭✭Skrynesaver


    BopNiblets wrote: »
    Maybe consider Netbeans as an alternative?
    It's what we're using in my course and it's easy enough to create Java Web app projects with it, doesn't use tomcat server though, uses Glassfish if that's any use.

    http://netbeans.org/downloads/index.html

    Actually it can use Tomcat as well, GlassFish is for full J2EE development Tomcat for J2SE dev.

    I'd also recommend apt-get install netbeans


  • Registered Users, Registered Users 2 Posts: 1,019 ✭✭✭PDD


    @ OSI - I've seen that on a few tutorials I found on the web but the only problem is that there is no such option on the menu's of my Eclipse install.

    @ BopNiblets - Yep I could do and its what is setup in the labs in the college but I have used Eclipse before in a job so Im familiar with it, where stuff is etc. Also the consensus from the web and my group of programming friends it that Netbeans is pants by comparison to Eclipse when it comes to web projects. I may have to look at Netbeans but I think Id look at Eclipse on a windows VM before doing that.

    @ Skrynesaver - Your slightly off the mark there, both of them are J2EE compliant stacks. AFAIK Tomcat was the first web server to be Java compliant and Glassfish is just Oracles option for a J2EE web stack. The likes of servlets/EJB/JSP & other web technologies are what distinguishes the J2EE (Enterprise Edition) runtime from the J2SE (Standard Edition) for example if you download J2SE then try to import servlet/JSP/EJB libraries it will tell you that they do not exist. Thats because they do not come packaged with J2SE whereas if you downloaded the J2EE runtime it would compile them because the appropriate libraries are packaged with them.

    Cheers for the feedback guys, much appreciated.


  • Moderators, Technology & Internet Moderators Posts: 1,336 Mod ✭✭✭✭croo


    You should be able to create and deploy tomcat based apps with eclipse on ubuntu!
    But there are a couple of things that perhaps you aren't aware.

    First is, which java are you using? By default openjdk is the installed version on ubuntu... I'd like to be using it but it causes me a lot issues so install the sun version. By default it is no longer in the ubuntu repositories (i'm using Meerkat 10.10) but if you enable the "Canonical Partners" repository in the "Software sources" it should then become available .. I think. If not you'll need to do a little googling.

    To be honest I haven't tried openjdk in a while, so have a go with it and if it works for you then well and good if not I think I installed java-6-jre java-6-jdk & java-6-plugin.. not sure if you need just that but that works for me.
    sudo apt-get install java-6-jre java-6-jdk java-6-plugin

    Next you must enable that version if it isn't already
    sudo update-java-alternatives -s java-6-sun

    I assume you have installed tomcat6? If not...
    sudo apt-get install tomcat6

    Secondly, there is a little bit of configuration you need to do for tomcat on ubuntu and it's all over the web.
    cd /usr/share/tomcat6
    sudo ln -s /var/lib/tomcat6/conf conf
    sudo ln -s /etc/tomcat6/policy.d/03catalina.policy conf/catalina.policy
    sudo ln -s /var/log/tomcat6 log
    sudo chmod -R 777 /usr/share/tomcat6/conf

    Stop the server before you start eclipse ... just in case
    sudo /etc/init.d/tomcat6 stop


    Now start eclipse.... I assume you did get the JEE version!?

    Go FILE->NEW->Dynamic Web Project
    It'll prompt for project and the Target Runtime... if there isn't one click the New Runtime... button and select
    Apache->Apache Tomcat v6.0 then click next
    enter /usr/share/tomcat6 for the Tomcat installation directory and finish

    Next select your new project and right-click to bring up the context menu.
    Select NEW->Servlet... well the rest you know I guess.

    When the code is ready just right click on the project and select
    RUN AS->RUN on Server
    That should start the server you identified in the "Target Runtime..." above and deploy the application.

    At least that's how it works for me... though I've not done much servlet work in the last year but I just tried with ubuntu 10.10, eclipse Helios and tomcat6.


  • Moderators, Technology & Internet Moderators Posts: 1,336 Mod ✭✭✭✭croo


    PDD wrote: »
    @ Skrynesaver - Your slightly off the mark there, both of them are J2EE compliant stacks. AFAIK Tomcat was the first web server to be Java compliant and Glassfish is just Oracles option for a J2EE web stack. The likes of servlets/EJB/JSP & other web technologies are what distinguishes the J2EE (Enterprise Edition) runtime from the J2SE (Standard Edition) for example if you download J2SE then try to import servlet/JSP/EJB libraries it will tell you that they do not exist. Thats because they do not come packaged with J2SE whereas if you downloaded the J2EE runtime it would compile them because the appropriate libraries are packaged with them.
    That's right. Tomcat is a Web Container while Glassfish is an Application Server that would include a Web Container plus an EJB Container... there might be more differences today but that's how it was in 2000 when I started looking at J2EE.


  • Advertisement
  • Moderators, Technology & Internet Moderators Posts: 1,336 Mod ✭✭✭✭croo


    PDD wrote: »
    @ OSI - I've seen that on a few tutorials I found on the web but the only problem is that there is no such option on the menu's of my Eclipse install.
    I just noticed OSI had given the same instructions I did, but the option ins't there for you. You mentioned you installed eclipse from the repository and then downloaded the JEE version from eclipse.org. Did you completely remove the repos version? Are you sure you are running the correct eclipse? My window is labeled "Java EE - Eclipse".. Help-About tell me I am using "Eclipse Java EE IDE for Web Developers". It doesn't sound like you are running the correct version.


Advertisement