Important Java Basic Code Conventions for Readable Code

Here I would like to give some basic code conventions in Java that mostly we need in our daily programming life: Indentation Use 4 spaces for indentation. No tabs! If you are using Eclipse, you can configure this at With Eclipse 3.7: Window->Preferences->Java->Code Style->Formatter Edit on one selected convention, example: Java Conventions [built-in] and go […]

Sample layout pom.xml for Java project

To make you get into Maven 2 project easily, let’s have a look to pom.xml general layout for Java project, here it is: <?xml version="1.0" encoding="UTF-8" standalone="no"?> <project xmlns="" xmlns:xsi="" xsi:schemaLocation=""> <modelVersion>4.0.0</modelVersion> <groupId></groupId> <artifactId>sample-java-training</artifactId> <packaging>jar</packaging> <name>Osify Training Sample</name> <description>Osify Training Sample</description> <version>1.0.0-SNAPSHOT</version> <parent/> <prerequisites /> <repositories/> <scm/> <properties/> <dependencies> <dependency/> </dependencies> <build> <sourceDirectory>src/main/java</sourceDirectory> <outputDirectory>target/classes</outputDirectory> […]

Add log4j to your Java project

Log4j is a logging mechanism that is in Apache foundation project. Log4j is for Java project. Here, to add logging feature to your Java project, you can use one as following ways: Manually Visit Download the Log4j jar library Manually include it into your project dependency All manage by yourself, you need to do […]

Generate jar and manifest Info in Jar in maven 2

To create jar packaging of Java project with maven 2 based, we used a plugin called: maven-jar with simply paste the code below in pom.xml of plugins section: <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-jar-plugin</artifactId> <version>2.4</version> <configuration> <archive> <manifest> <addClasspath>true</addClasspath> </manifest> </archive> </configuration> </plugin> And if you want to add in your jar’s MANIFEST info, you can directly modify […]

Generate source code Jar for Maven 2 based project

Some case, you need to generate source code from your project which is maven 2 based. Please have a look to maven-source plugin by adding a short code below into your pom.xml <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-source-plugin</artifactId> <executions> <execution> <id>attach-sources</id> <goals> <goal>jar</goal> </goals> </execution> </executions> </plugin> By default it will generate jar named as: ${project.artifactId}-${project.version}-source.jar

បំលែង Jar ឬ Java project ទៅជា EXE file ដោយ​របៀប​ណា?

ខ្ញុំមាន​ Project in Java បន្ទាប់ពី Compile និង​ Package វាជា Jar file ហើយ​។ តើ​ត្រូវ​ធ្វើយ៉ាង​ម៉េច អាច​ប្រើវា ជា EXE file ប្រើ​ក្នុង Windows XP or Windows 7 បាន? សូមជួយ​ប្រាប់ពីរបៀបផង និងពិសេស តើមាន Freeware ឬ Free software សំរាប់ធ្វើការងារនេះអត? អរគុណទុកជាមុន។