Click to See Complete Forum and Search --> : Small problem


Lenaryn
01-07-2005, 11:37 PM
Ok well it's not that small. I finished my CS degree this past spring and I'm now looking at doing some little projects on my own as a kind of portfolio for prospective employers. Well today I finally came up with an idea for something to do aside from a long list of data structures heh.

I decided to build a web based strategy game, sorta like Earth 2025 (http://games.swirve.com/earth). The idea quickly ballooned into something pretty ambitious for a first project. So anyway here's the situation. Java is my primary language, so I'm thinking I'll be learning a lot about servlets in the next little while. I've done enough with MySQL that I could create player accounts but I'm not sure how I would store their game data. I'm going to have some fairly complex objects...is there some way to store a whole object in a database or am I going to be dealing with a mountain of SQL scripting? One thing I've been wondering is if maybe there are packages available to deal directly with a MySQL server right in my Java classes. I'm not going to try and hide my ignorance, I haven't even looked at servlets until a couple of minutes ago. Until now my programming experience has been limited mainly to "simple" command line programs.

If you have any suggestions for technologies I should use instead of JSP/Servlets, MySQL, and Apache/Tomcat let me know. This whole exercise is about teaching myself new things.

ray326
01-08-2005, 05:54 PM
You're talking about Object to Relational Mapping (ORM) and there is a very popular framework for doing that called Hibernate. You can roll your own, too, and your app is probably simple enough that wouldn't be a problem. The SQL should be pretty straight forward. I highly recommend you look at the J2EE Patterns area of Sun's site.

Lenaryn
01-09-2005, 01:09 AM
Thanks! Good to finally have some kind of idea what I need. Finally got the computer all reformatted and I'll start messing around with this stuff soon. I'm sure I'll be back with more specific questions later heh.

Lenaryn
01-11-2005, 10:31 PM
Well I spent the last couple of days working out program design and stuff. I got hibernate unpacked and started with the new user instructions on the site. Now, I've got J2EE and Eclipse installed. I can create and run a Java program just fine.

Part of the new user instructions tells you to run "ant eg" if you have Ant installed. Now I was under the impression that Ant was part of the J2EE setup. Anyway, ant was not recognized as a program. If that didn't work, you're directed to run build eg. Build.bat calls java.exe, which my system ALSO doesn't recognize for some reason.

I do have java.exe's in my eclipse dir, but it's looking like I'm not able to run it outside of eclipse. I'm just totally confused at this point heh.

ray326
01-12-2005, 02:17 AM
Eclipse is the best way to go IMHO but there is certainly a learning curve there. I believe Ant is included with and directly supported within the Eclipse environment and that Eclipse recognizes the build.xml file as something special. (Yes, org.apache.ant_1.6.1 is a plugin in Eclipse 3.0.) I believe there is even an "Ant Perspective" available.

Since you're doing J2EE with Eclipse then check out http://myeclipseide.org for an excellent Eclipse configuration available on a subscription basis for only $30 per year.

As far as the JDKs go, there is one bundled with Eclipse for its use but you need to install a full JDK for running Java apps (especially Tomcat) outside of the Eclipse IDE. That external one is the one you'll want in your JAVA_HOME environment and its bin directory in your PATH.

Lenaryn
01-12-2005, 11:38 AM
Cool...I didn't realize Eclipse could open and build this thing.

That's the thing, I downloaded and installed the J2EE 1.4 sdk. Is that actually just the servers and whatnot? I'm getting the distinct impression that it doesn't also include the JDK. Maybe I would have noticed this if I had set up emacs like I originally intended...but Eclipse was just too cool to pass up heh. I guess I'm just not really clear on the differences between J2SE and J2EE.

Edit: I just figured out the SDK really is there, but the installer didn't set JAVA_HOME and PATH. I just successfully ran Ant on Hibernate :cool:

ray326
01-12-2005, 11:05 PM
I just figured out the SDK really is there, but the installer didn't set JAVA_HOME and PATH. I just successfully ran Ant on Hibernate Way to go! As Yogi would say, "Nothing suceeds like success." I think the reason the SDK installer doesn't set the JAVA_HOME is because you can have multiple versions of the SDK installed and switch between them with a JAVA_HOME and PATH change. So it doesn't know whether this SDK is the one you really want to use. There was a time way back that I seem to recall it did try to do that kind of thing but it stopped about JDK 1.2.