Skip to main content

How To Run Java EE 5 Tutorial Examples On Mac

I spent some time configuring Java environment on Mac. Here are a few tips on how to get it going.

The Max OS X comes with Java 5 installed. So, here are main steps:

* Download Java EE 5 Tutorial package from http://java.sun.com/javaee/5/docs/tutorial/information/download.html

* Download Sun Java System Application Server 9.1 from http://java.sun.com/javaee/downloads/. I downloaded Java EE 5 SDK Update 3 that comes with the application server.

* Use instructions posted here on how to install it

http://java.sun.com/javaee/sdk/javaee5sdk_install.jsp

Also use Application Server Installation Tips posted here: http://java.sun.com/javaee/5/docs/tutorial/doc/gexaj.html

Once the application server is installed, change permissions on the SDK/javadb, so the folder permissions allow creating a database. Here is an example on how to do that:


cd SDK
sudo chown –R your_name javadb


In general, I believe it is a good idea to change permissions to other files in SDK to some less privileged user than root.

Once I started playing with bookstore example, I’ve got some build and deployment errors. I found that I need to create a password file and point to it with the javaee.server.passwordfile property.

Create a new file app-server-psw.properties in the javaeetutorial5/examples/bp-project/ folder. Edit the file and add


AS_ADMIN_PASSWORD=admin_password


The admin_password should be the same as it was specified during the Application Server installation.
Update javaeetutorial5/examples/bp-project/app-server.properties by adding these properties:


db.vendor=javadb
javaee.tutorial.home=/Users/mykola/java/j2ee/javaeetutorial5
javaee.server.passwordfile=${javaee.tutorial.home}/examples/bp-project/app-server-psw.properties


Once that is done, the bookstore example build and deployment works fine.

Comments

Popular posts from this blog

Building a Flex project with Ant

Here is a quick sample on how to build a simple Flex "hello world" project with Ant. The "hello world" project contains a src folder with one Flex application file and an Ant build.xml file: ./project_home/ ./src/ app.mxml build.xml The app.mxml is the main module of the project. It simply has a label with a "Hello World!" text: <?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"> <mx:Label text="Hello World!"/> </mx:Application> Here is the build.xml source: <?xml version="1.0"?> <project name="fx_practice7" default="all"> <!-- Init the build process --> <target name="init" unless="initialized"> <!-- Name of project and version --> <property name="FLEX_HOME" location="/Users/mykola/java/flex"/>

cucumber-jvm and Android Studio

During this Winter holidays, I've been exploring a Behavior Driven Development and experimented with a couple of testing frameworks: Calabash and cucumber-jvm . In this post, I would like to describe setting up cucumber-jvm for Android Studio projects. I've extended cucumber-jvm examples with a version for Android Studio. Here is a copy in my github branch: https://github.com/mdzyuba/cucumber-jvm/tree/add_android_studio_example/examples/android/android-studio/Cukeulator . In addition to the example code, here is some details on how it was created. Dependencies The cucumber-jvm requires several libraries to be added to a project:  https://github.com/cucumber/cucumber-jvm/tree/master/android I've found it's easier to add those dependencies with the Android Studio project setup dialog because it takes care of the jar versions for you. File > Project Structure > Modules > app > Dependencies > + > Library dependency   > type "cuc

Using FlexUnit for Stress Testing

I saw quite a few questions in the forums on how to stress test a Flex application. I thought about it and came up with an idea that I want to share here. I think FlexUnit can be used for stress testing. It is not that difficult. I simply add multiple test runners for each client application and run all of them asynchronously. Here is the example of the FlexUnit runner: <?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" xmlns="*" xmlns:flexunit="flexunit.flexui.*" creationComplete="onCreationComplete()"> <mx:Script> <![CDATA[ import flexunit.framework.TestSuite; import test.TemperatureConverterTest; import test.ArrayUtilTest; import mx.collections.ArrayCollection; import flexunit.flexui.TestRunnerBase; [Bindable] public var testClients:ArrayCollection; public var NUMBER_OF_TESTS:int = 100; private function onCreationComple