IDE

IDE(Integrated Development Environment) are complex, They have a visual development tool, integration with compiler, application servers, tools for debugging, refatoring, plugins too, even multiple language can be run in same ide

Eclipse uml plugin (Software reverse engineering)

read more

Eclipse the favorite java IDE. The Shortcuts makes life veryeasy when you are working with any IDE

shortcuts

Content Assist (Ctrl + Space) Is Not Working in Eclipse IDE

read tutorial

Access restriction: The type NetworkInterface is not accessible

Windows -> Preferences -> Java -> Compiler -> Errors/Warnings -> Deprecated and restrstricted API -> Forbidden reference (access rules): -> change to warning

Eclipse plugin for uml diagram Or Online uml2 plugin for eclipse

Now let us take a look on software reverse engineering process.For that we need UML2 plugin. This post will tell you how to install UML2 eclipse plugin to your eclipse ide. Make it sure you are using the latest Eclipse IDE
Steps to follow
  1. Start Eclipse
  2. Navigate to help
  3. Select software updates
  4. Available software tabs
  5. Add site and Enter the following url : http://downloads.myeclipseide.com/downloads/products/eworkbench/helios/enterprise-earlyaccess/
Thanking you...

How to create java doc using eclipse ide

Java Doc


Documentation Comments are essential for every source code in industrial projects. Documentation comments represented by ( /** … */) are unique to java. You can create html developer document for your project once you properly comment your code. Here ,i am going to show you how to create javadoc for your project.

Create a java project in eclipse, Copy and paste the below code to your src folder


* Filename : ArithmeticOperations.java
* Author : nick (belazy1987@gmail.com)
* Date : September 29 1987
* Description : A java program that shows Basic Arithmetic Operations
*/

/**@author java documentation
* @version 1.0
*/
public class ArithmeticOperations {
/** To store answers with double DataType
*/
private double answerDouble = 0.0d;
/**
* To store answers with float DataType
*/
private float answerFloat = 0.0f;
/** To store answers with int DataType
*/
private int ansInt = 1;
/** addition() is used to add two variables
* @param value_one first parameter
* @param value_two second parameter
* @return answerDouble returns the sum of value_one and value_two
*/
private double addition(double value_one, double value_two) {
answerDouble = value_one + value_two;
return answerDouble;
}

/** subtraction() is used to subtract and return the result
* @param value_one first parameter
* @param value_two second parameter
* @return answerFloat returns the difference of value_one and value_two
*/
private float subtraction(float value_one, float value_two) {
answerFloat = value_one - value_two;
return answerFloat;
}

/** multiplication() is used to multiply two values
* and return the result
* @param value_one first parameter
* @param value_two second parameter
* @return ansInt returns the product of value_one and value_two
*/
private int multiplication(int value_one, int value_two) {
ansInt = value_one * value_two;
return ansInt;
}

/**division() is used to division
* and return the result
* @param value_one first parameter
* @param value_two second parameter
* @return ansInt returns the quotient after dividing value_one with value_two
*/
private int division(int value_one, int value_two) {
ansInt = value_one / value_two;
return ansInt;
}

/** showDetails() is used to display the output
* @param ansAdd Output of addition
* @param ansSub Output of subtraction
* @param ansMul Output of multiplication
* @param ansDiv Output of Division
*/
private void showDetails(double ansAdd, float ansSub, int ansMul, int ansDiv) {
System.out.println(" Addition : " +ansAdd);
System.out.println(" Subtraction : " +ansSub);
System.out.println(" Multiplication : " +ansMul);
System.out.println(" Division : "+ansDiv);
}

/**
* main() function
* @param str user can pass parameters to main through command prompt
*/
public static void main(String[] str) {
ArithmeticOperations arithmeticOperation = new ArithmeticOperations();
double ansAdd = arithmeticOperation.addition(10.0,20.0);
float ansSub = arithmeticOperation.subtraction(20.8f,12.3f);
int ansMul = arithmeticOperation.multiplication(200,10);
int ansDiv = arithmeticOperation.division(100,10);
arithmeticOperation.showDetails(ansAdd,ansSub,ansMul,ansDiv);
}
/**
* belazy1987 at gmail dot com
*/
}

read more

How to write unit test in java

Junits using eclipse ide

Description

junit is a java testing framework used to write and run test.
To create test you have to choose junit in eclipse ide.
right click on project , then new, others, expand java, junit.

Example

first you need to choose a class for which you are going to write the test case

Multiplication.java


/**
* @author belazy
*
*/
public class MultiplicationClass {
public long mutliply(int price,int quantity){
long stockValue = price * quantity;
return stockVale;
}
}

it will be better if you create a new package for test suites
say, com.belazy.junitProject.test;
right click on your class --> new --> junit test case
then
tick the radio button new junit 4 test
Name as className+Test
Tick all check box
click on finish
run as junit test

Example for test class


import static org.junit.Assert.*;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
/**
* @author java unit test example
*
*/
public class MultiplicationClassTest {

/**
* @throws java.lang.Exception
*/
@BeforeClass
public static void setUpBeforeClass() throws Exception {
}
/**
* @throws java.lang.Exception
*/
@AfterClass
public static void tearDownAfterClass() throws Exception {
}
/**
* @throws java.lang.Exception
*/
@Before
public void setUp() throws Exception {
}
/**
* @throws java.lang.Exception
*/
@After
public void tearDown() throws Exception {
}

/**
* Test method for {@link MultiplicationClass#mutliply(int, int)}.
*/
@Test
public void testMutliply() {
MultiplicationClass tester = new MultiplicationClass();
assertEquals("Result", 50, tester.mutliply(10, 5));
}
}

Junit works on annotation. @Test(timeout=100) fails, if the method takes more than 100ms to return the output

How to call dll (Native class) using java native interface (jni)

The example shows how to call a .dll (Dynamic Link Library) class using java in eclipse ide. tutorial
Click here to see our facebook page
How to build a stand alone client application using swing in java read here

How to change a variable name which has used many times in you java code in eclipse

Description : select the variable you need to rename in the whole java code, right click on it then hit refractor and rename. Now the variable name will update every where in your code

Facebook comments