« java » Feed

Ebfe6ecd50f96701fabd9ad15aa061c9

A Java hello-world application on Google App Engine (part 2)

2010-11-25 14:25

Write comment

Before you start reading this article I recommend that you take a look at the previous part, so you can understand this one better.
Anyway what we gonna see today is some configuration, to help Ant compiling our helloworld GAE project and deploy it on GAE, you could see it in link and download the whole project i've covered during part 1 and part 2 of this simple tutorial.
First of all, a short notice for people who have tried GAE using Python:
Java is a compiled programming language so you need to compile your source code in favor to use it, but in our case we gonna need a tool to automate building our project, like Apache Ant or just let’s just call it Ant.

Back on track, let me first tell you that Ant will look for a file named build.xml by default.
After that, it’ll do exactly what it was told to do, so let’s edit that helloworld/build.xml file to make things work:

<project>
  <property name="sdk.dir" location="../" />
  <import file="${sdk.dir}/config/user/ant-macros.xml" />
 <path id="project.classpath">
    <pathelement path="war/WEB-INF/classes" />
    <fileset dir="war/WEB-INF/lib">
      <include name="**/*.jar" />
    </fileset>
    <fileset dir="${sdk.dir}/lib">
      <include name="shared/**/*.jar" />
    </fileset>
  </path>
</project>

watch out from this line <property name="sdk.dir" location="Path/To/Your/GAE/SDK" />
to be more safe and less confused while debugging just put the absolute path instead of relative.
Next we gonna need the ant macro, that comes with the SDK, and  what in it exactly is a bunch of  functions-declaration-like, that we gonna need later.

Read more…

Ebfe6ecd50f96701fabd9ad15aa061c9

Getting rid of "java.lang.OutOfMemoryError: PermGen space" exception on jboss

2010-10-18 12:45

Write comment

Playing around with Seam framework, i began by deploying some of the sample applications which should work out of the box ... but not for me:

Just after deploying any of the sample apps, i get the "java.lang.OutOfMemoryError: PermGen" exception right after, as a first reflex, i've doubled "Xms" and "Xmx" VM options and nothing changed, i still have the same error, and that's becoming more funny :)

Reading some dokus about the garbage collecting in Java, things became more clear:

The Java garbage collector is managed through 3 generations of objects, depending on the object age it can be in the (1st) Young generation or the (2nd) Tenured generation, an object may die or be moved to Tenured generation depending on the applied GC policies; the Permanent generation (3rd) holds meta-data describing user classes and can quickly reach its limits with a large-code application.

Read more…

6c4a91744a9f857f00ddd8802edb7465

Using 'Ant' the 'batch' way

2010-10-08 10:26

Write comment

Apache Ant is a wonderfull tool for automating software build processes, most of the cases for Java software as it is implemented with Java and requires the VM. Netbeans offers native ability to run projects using Ant, it only requires you to put the build.xml file in the root of your project folder and the targets become right-clickable, simply amazing !

Every project having a build.xml for Ant targets implements these build automation tasks:
  • Build
  • Clean
  • Run
  • Deploy
  • Debug
  • ... etc
And what if i want to create batch-style tasks such as:
  • Deleting some files (maybe cache files or old unused files).
  • Moving/copying files
  • Creating skeleton files or folders (think about a project template, module template ...)
  • Backuping, restoring and even Subversion commands
  • Sending an email
  • Doing an SQL manipulation
  • ... etc ... just anything having no 'direct' relation to software build automation

Read more…

 Nbre d'élements: 3/
7