my company runs a site that primarily has its backend logic coded in Perl. It works fine but ultimately we are headed to something Java driven. I do plan on studying this and would like to start setting up a Java environment on another server in our company so when the time comes I at least have a headstart.
Does anyone have a recommendation on where to begin? Just interested in generalities now.
JW
What are you planning to study? All Java or just the web service extensions?
If you come from Perl, I must suggest you starting from "hello world" with a Java cookbook, then you can start moving towards web services after a while.
Another good book about web service is what you might need.
Finally, when beginning to build the web service, I suggest you two things:
Design the WSDL independently from Java code that will implement it. It's very important for cross-platform interoperability. Try to use Altova XMLSpy or a similar tool to define the pure WSDL as a design contract
Deploy with Axis
I don't know how to propose to move this question to Stackoverflow, because you can find LOTS of answers there
You need J2EE
http://download.oracle.com/javaee/1.4/tutorial/doc/
Java Tutorial
http://download.oracle.com/javase/tutorial/
General Java Stuff
http://www.oracle.com/technetwork/topics/newtojava/overview/gettingstarted-jsp-138588.html
http://www.oracle.com/technetwork/articles/javase/webapps-1-138794.html
About the Class Path
http://kevinboone.net/classpath.html
Related
I have a complete and pure Java project (GUI game) which I want to run it on my website.
What is the best to do without creating the whole java project from scratch or is there any technologies I can use to embedded my java project on my website.
I know it became more difficult to do this as most broswer do not support java anymore. I know there is a way to do using Java Web Application using Apache Tomcat, but I do not want to do route. I am trying to find more easier and better to solution to this
Thank you
Unfortunately, It is quite possible that you need to rewrite some parts of your application. Mainly because it is a different language (I assume SWING, AWT, or another Java-based library, but you could tell more about your project and used libraries).
There is usually two parts of a game/application (super simplified):
backend,
frontend,
I am quite sure you can use most of your backend code. But the frontend probably needs to be rewritten. It is even better if you loosely coupled those two parts meaning there is no code in the backend for the frontend because you will have a harder time now breaking it down.
For example, you could check Vaadin and see what you could use from there to refactor your GUI application to be work on a plain browser.
Vaadin basically lets you write only or MOSTLY Java code and still create a website, webpage.
Good luck!
p.s: Next time I recommend you (if you wanna publish it to a different platform) a cross-platform language, you write once and you can run it publish it on multiple platforms.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I'm really starting to get a hang of the client-side Java programming, and from what I understand Java is great for developing stable server sides for large amounts of traffic.
The problem is that I'm completely new to server development, so I don't know where to start or where to look for information, despite Java's good documentation.
More specific questions:
Do you know any good, non-specific tutorials for server-side Java? I've seen some tutorials for Google's Cloud Platform and Netscape, but I don't want to be dependent on their infrastructure.
Is the common practice to develop your code in Eclipse and then "ship" it to your server? As I said I've never done server-side development and I've only tried learning a little node.js.
Thank you in advance, I hope these questions aren't to wide-scoped.
I would suggest you to start with a simple setup like you already told us: Eclipse + let's say an easy to use tomcat.
If it comes to the server side you need to create a Servlet which allows to access other application data from your server in a format which you define or let's say you + the clients define. I would suggest you to start with something you will be familiar like Json. For this I have a little "starting point" for you.
Clone that simple example for a server-side application:
https://github.com/DominikAngerer/java-GsonJerseyProvider
It already provides you a simple structure for Json which is used by a Framework like Ember and also you can easy modify the structure which is defined there.
Is the common practice to develop your code in Eclipse and then "ship" it to your server?
Yeah it's totally common to do that. Write your Server Side code and export it as .war - tomcat or jetty for example can simply deploy them and you will be able to run them on these application server.
Do you know any good, non-specific tutorials for server-side Java? I've seen some tutorials for Google's Cloud Platform and Netscape, but I don't want to be dependent on their infrastructure.
I really love to work with Jersey - It's really a to understand the code you will write. Maybe try the example provided by IBM developersworks: http://www.ibm.com/developerworks/library/wa-aj-tomcat/
For the beginning it may be a little of a overhead but after you tried the example (it should be running right away) I think you will get the idea of how to create a simple backend system with java.
If you want a complete environment out of the box, you can try:
Netbeans EE IDE:
It contains a GlassFish server and the SDK preconfigured, glasfish is one of the most used open source application servers. Here you can find tutorials from the Netbeans page.
JBoss Developer Studio: is another very used IDE that includes a JBoss server. You can find tutorials from this one here.
I would sugest to start with GlassFish, as it is very easy to use and configure.
Take a look at JavaEE. I would start by learning how to create simple JSP pages with Eclipse + Tomcat (create a "Dynamic Web Project"). After that, check out Servlets and be sure to understand HTTP. After that, I would get an overview of JSTL and other Java EE components. DZone has a nice refcard giving you an overview of the Java EE 7 components.
After that, you should be good enough to move on to a framework like Spring or Struts. Alternatively you can perfect Java EE fully learning it's more advanced components like CDI(context dependency injection) or JAX-RS and JAX-WS(web services). This document should give you an overview of how to configure a servlet container in eclipse: http://www.eclipse.org/webtools/community/education/web/t320/Configuring_an_Application_Server_in_Eclipse.pdf
As for tutorials, check out Oracles JavaEE 7 tutorial at: http://docs.oracle.com/javaee/7/tutorial/
Alternatively, if you do not like the styles and patterns used in Java EE, there is a non-Java EE framework called the Play Framework (http://playframework.com) it gives you the option to develop your application using either Java or Scala, and uses MVC architecture.
If you want to learn server side programming with JAVA, I recommend to start working with Eclipse. Almost all developers whom I know are using one or another IDE, most of them are using Eclipse for J2EE.
There are plenty of tutorials available on how to setup eclipse on your local computer. I personally read many tutorials when I learned it, you can google it.
http://www.apekshit.com/t/11/Writing-JAVA-programs-in-Eclipse
http://www.apekshit.com/JSP-Tutorial-for-beginners-with-Examples/c/21
I found these 2 that might help you to achieve what you are looking for.
I am really really having hard time to create simple "Hello World" Web Service in Java. If you exclude several mobile Android mobile apps I have done, I am pretty new to Java environment.
First I tried Axis2 and that simply doesn't work out of the box. Fresh installation of Eclipse, Tomcat 6.0 and Axis2. Tried sample test app and it failed miserably. You can read about it here. My conclusion is that Axis2 simply doesn't work (maybe it used to work). I will try to go back to install older versions, maybe one will magically start working. I have to modify some old project at work that was using Axis2, so that's why I have to stick with it. I would hate to have to migrate to some other tool.
Then I ran on Oracle article Getting Started with JAX-RPC and I was thinking, cool, let's try that. Well, I just managed to get pissed off. After getting half way through the article and trying to write some simple test web service I realized that their code examples are poorly written. Missing brackets, wrong references, missing explanations, etc...
First of all, an interface should extend not implement. Am I right?
public interface SunRegPort implements java.rmi.Remote {
Also, this doesn't exist:
import java.xml.rpc.server.ServiceLifecycle;
But this does:
import javax.xml.rpc.server.ServiceLifecycle;
Well, I don't feel competent to criticize too much (cause of my level of knowledge about this subject of course), but after all I am suspicious that this article is complete JUNK and therefore I am not able to follow it.
Please somebody tell me that I am wrong and if anybody has some advice or link to some How-To page that talks about web services, I would appreciate.
Thanks.
The terminology Web Services is pretty vague. In Java, the modern and reasonably easy way to do this is by annotating classes.
I would recommend that first, you decide whether you want to implement:
SOAP Web Services -> look at JAX-WS
REST Web Services -> look at JAX-RS
Once you have chosen the "type" of Web Services, choose the library that implements the specification.
The Wikipedia entries list a few of these implementations. Apache CXF (complete but a beast), Jersey (popular) and Restlet are very common choices. I personally like the JBoss implementations as well for JAX-WS.
For JAX-WS with Apache CXF, here is a quick start tutorial that looks pretty good (untested)
For JAX-RS with Jersey, try this
Unless you have strong reasons to do otherwise (for instance you need to call an existing system), use REST which is simpler and leaner.
I would recommend you to check out the CXF project by apache. It's quite easy to use and should help you to set up a webservice.
There is a nice guide to Hello world set up.
http://cxf.apache.org/docs/a-simple-jax-ws-service.html
If you're still interested in giving Tomcat a shot, here is a tutorial on youtube of making a very basic "Hello world" example using Eclipse. It leaves a lot to learn; but it looks like it will at least get you started.
FYI, the version of Eclipse used is slightly outdated. So some of the menu options may not be exactly the same:
http://www.youtube.com/watch?v=EOkN5IPoJVs
Also, the meaning of "Web Service" can be subjective. So, to be specific; this just shows you how to get a basic HTTP endpoint started on your local machine.
If you are not tied to Eclipse, give NetBeans a shot. I think it's much better for Web Services in Java.
Web Services are most widely implemented examples of Service Oriented Architecture (SOA). A service contract is defined with the help of SOAP and Web Service Definition Language (WSDL) and that is published for other applications to use.
In this article we will see how we can create web service and web service client in java.
http://www.opencodez.com/java/how-to-build-and-deploy-web-service-and-client-in-java.htm
At the moment, I have lot's of Java which does all kind of nifty stuff and I'm happy with it. The code is command line driven which have been great so far, but I recently decided I want to make the functionality available through web-services. Since my is complex and I'm happy with the way it's written , I don't want go through the pain of porting it to other languages. So I set out on a google journey to find out what web servers exist (on a Linux machine, though it's interesting to hear the answer without that limitation).
From what I could find, it seems that there are two viable options: Apache Tomcat and Sun Java Server.
What are the reason to choose one on top of the other? what are the strength of each and what are the weaknesses? Or, perhaps, there is a third one which is much easier, flexible and less cumbersome.
Anyone?
Easy, flexible and not cumbersome, that would be Jetty, but also Simpleweb might be useful. You dont say much about your software so i'm not really sure, but for a command line program, I don't think you need all the JavaEE stuff.
The mainstream servers are these.
I think the Apache Tomcat vs Glassfish (Sun Java Server) discussion is irrelevant for your needs, any would do.
There are many containers for Java web applications, they all have their own strengths and weaknesses. If you're looking for a container to support a business application, you should probably take a look at how they differ and work out which suits your business and IT drivers.
The key thing is that they all support the servlet specification - your webapps can run in any of them - which means you can change your mind easily. Some of them will also support more of the Java Enterprise Edition specs, so may be too heavy for your needs.
If you're just getting started, I'd suggest Tomcat. It's basic, but it's reliable, quick to run and start up, and it's got a really easy web-based webapp deployment interface.
Your question is actually a bit too ambiguous and wide. You can in fact run Java code at any machine you like, regardless of the language you programmed the webbased interface in. You can for example create a PHP based website which interacts with a "backend" Java application (the "command line application" as you call it). The only requirement is to have a JRE at the server machine. Then basically everything as web interface suffices: CGI, PHP, ASP, Python, etcetera, you name it. As long as it has access to the underlying commandline runtime, which is in the PHP example to be done by exec().
But Java, actually Java EE, also provides a web application programming interface: the JSP/Servlet API, the web component of the large Java EE API. This make integration with the "commandline Java application" much more seamless. You can basically just put your application in the classpath and import/access/use it in a Servlet class the real Java way:
YourApplication app = new YourApplication();
Result result = app.doStuff();
// ...
To be able to run JSP/Servlet (JSP is at end actually also a Servlet), you need a concrete implementation of the Servlet API (the whole Java EE is just an abstract specification). Apache Tomcat is good to start with, the other popular alternative being Eclipse Jetty. Those are 'simple' servletcontainers which implements the Servlet API, with Jetty being a more embedded approach of it (you can configure and run it as a "plain vanilla" Java Application). But if you need to support/cover the other aspects of the Java EE API as well, then you need an application server, such as Sun Glassfish or JBoss AS (both which by the way uses Tomcat as the servletcontainer part).
To learn more about JSP/Servlet, I can recommend the Coreservlets.com tutorials.
Apache Tomcat should do good.
The standard concept for running code inside a web server is the "Servlet API" from Sun.
Essentially it provides a few interfaces which the web server uses to invoke your code, and defines how the web server should behave. This allows you to write very generic code that can run in a variety of web containers which implement the Servlet API. See the Wikipedia article for details - http://en.wikipedia.org/wiki/Java_Servlet.
They come in all sizes too, depending on your needs. Some small enough for embedding in your own application, some very big. The servlet API allows you not to care.
For a beginner, the quickest way to get up and running, is to download the full version of Netbeans which includes full support for doing this kind of work, and has a built in servlet container.
I am a .NET Developer with about 5 years of web development experience using Microsoft technologies starting with classic ASP to ASP .NET 3.5.
I do have a little background in Java as well and can write/understand Java code very easily. I am looking for resources (online, books) that are compatible with my .NET experience. I am only interested in web development in Java and want to start at intermediate level even if it may require me to look up some details.
What path or resources would you recommend for intermediate .NET web developers to gain equivalent proficiency in Java web development tools?
Get an IDE: IntelliJ (my preference), Eclipse, Netbeans;
Get an application server: Glassfish (my preference; either v2 or v3 Prelude), JBoss or, if you're feeling adventurous, SpringSource dm server;
Get a JDK eg 6u11;
Get a copy of Spring 2.5.6 (or 3.0M2 if you're feeling adventurous);
Get a copy of the Spring reference documentation;
Put the pieces together.
Get yourself a copy of eclipse, and just start reading other people's code, and reading some java docs. The Java website has all the docs online, and they're one of the best language specs I've seen.
Really, if you know C# pretty well, Java should be a cake walk. The languages are pretty similar, so you just need to get to know the different frameworks.
Probably the most helpful book in regards to learning Java's web development framework, Java Server Faces:
Core JSF
- Great examples and explainations throughout on the whole process of using the JSF Framework.
And of course for anyone new to Java I would recommend:
Effective Java
- Covers various design patterns and practices.
In my experience that official Java exams are better than the .Net equivalents, so it may be worth starting there?
Search for a servlet/JSP tutorial (Good, albeit a little old, example here).
You'll get basic knowledge of Java web application development.
Whatever your level is, JSF for Nonbelievers is the best introduction to JSP/JSF.
I'd check out Bitter Java.
It's a book that shows you the wrong way to do things, why it's wrong, and then it shows you the right way.
It pretty much falls in line with the evolution of the j2ee framework. Started with servlets, then moved into jsps, then command pattern, etc.