• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

J2EE library can be used for standalone project?

 
Ranch Hand
Posts: 94
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

One of the project works developed in JDK 1.4 and now i am unable to compile in 1.8 version jdk Is the below errors are due to upgrade or some jars is missing?

1. import javax.servlet.http.*; cannot be resolved
2. Base64 is ambiguous
3. HttpServletResponse could not be resolved
4. HttpSession could not be resolved
5. org.w3c.domElement could not be resolved

I think they are using J2EE library.....Is it right or fine to use J2EE libraries for a open source project?

What is the ant, maven, sbt info to include to servlet jars or J2EE jars? Please advise

Currently using Ant build.xml to build the project.

Can we include the servlet jar alone with JDK or we need to download the EE JDK only? I want to make it light weight

Thanks.
 
Saloon Keeper
Posts: 15455
363
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you convert the project to Maven, you can easily add the JEE libraries. Depending on which application container you'll be running the application in, you must add additional runtime dependencies.

For servlets, use jakarta.servlet:jakarta-servlet-api. No need to add runtime dependencies.

Base64.Encoder and Base64.Decoder were added in Java 8. Just use the right import statements and change your code a little.

HttpServletResponse and HttpSession are part of the Jakarta Servlet API. Adding the Maven dependency I told you about earlier should be enough.

org.w3c.domElement does not exist. Do you mean org.w3c.dom.Element?
 
Joseph Michael
Ranch Hand
Posts: 94
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Stephan, please help me how to convert the project to maven...Help me with the pom.xml so that will convert the project to maven project
 
Stephan van Hulst
Saloon Keeper
Posts: 15455
363
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Maven is really not that hard. Have you read the Maven user guide yet?

Start by making a POM for your product and add dependencies to it. Show us where you got stuck.
 
Saloon Keeper
Posts: 27720
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There are two primary things you need to do to convert to a Maven project:

1. Arrange your project files in the directory structure required by Maven. For example, Java source goes under src/main/java, testing code under src/test/java. webapp files such as JSPs and WEB-INF/web.xml would go under src/main/webapp and so forth.

2. Create an appropriate Maven POM file that declares what kind of product you are creating (JAR, WAR, whatever), what its name and version are going to be, what plugins - if any - will be required for Maven to do the jobs, and what dependencies there are for Maven and in what scope. For example:


These 2 dependencies pull in servlet API version 2.4 (it's from an old project) and JSP API version 2.0. Scope is "provided", meaning that these are libraries which will be used to help compile, but will not be included in the WAR, since they're provided by the webapp server. A common scope is "compile", which not only compiles using the dependency, but also inserts a copy of the dependency into the target product (for WARs, that means Maven will put it under WEB-INF/lib/.)

Maven keeps a local cache of dependencies, so if you reference a dependency or dependency version that isn't already in your cache, it will automatically download a copy from a Maven repository off the Internet (or, if your shop has a local repository server, from there).

I believe that Base64 was originally stolen by people from private Sun libraries and that ability is no longer available, so you'll have to adjust for that. I'm not sure if the org.w3c classes are still relevant or if they have been supplanted by something more modern, but if they're at all still worth using, then there should be a library that Maven can use.

Not only is if fine to use J2EE libraries for an open source project, I think that JEE (the successor to J2EE) is itself entirely open-source since Oracle handed it over to jakarta.
 
Sheriff
Posts: 7125
184
Eclipse IDE Postgres Database VI Editor Chrome Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Here's a quick starter for beginning a Maven project:

https://maven.apache.org/guides/getting-started/maven-in-five-minutes.html

I found it by Googling Apache Maven.
 
Joseph Michael
Ranch Hand
Posts: 94
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you so much, Knute. I will try and get back to you
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I am currently working on some project for which I need a sample java project developed using jdk 1.4.
Can you help me with this?

Thanks and Regards
Sumit Patil
 
Saloon Keeper
Posts: 7576
176
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sumit, welcome to the Ranch.

Java 1.4? No, most definitely not. Java 8 is barely acceptable these days, and Java 11 somewhat more so. But for a new project, start it on Java 17 if you can.

But your question is not clear. Just about everything is a project, so what, specifically, do you have, and what, specifically, is still missing that you need help with?
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic