Posts in Category: deploy

Adempiere 3.6 Java Version Update

The following article describes how to make Adempiere 3.6.0 version work on systems with JAVA Versions greater than 7 .The following code Update will help you install Adempiere 3.6 on systems who currently doesn’t have JAVA 6 installed on them.

Do made the following changes in the Code and then build the Adempiere from Eclipse and use it on system which even have JAVA 7 installed on them. Once installed on systems with JAVA 7 we can also run the server on JAVA 7 systems and perform all the operations. We have tested this on system with JAVA 7 installed.

Do note that the system in which initially code is changed and build is made should have JAVA 6 installed. Once build is made from JAVA 6 system after the aforementioned code changes then that build can be deployed on JAVA 6 and upper versions.

 

The Code Changes are as follows:

  1. In Login.java find and replace the method isJavaOK() with the code

public static boolean isJavaOK (boolean isClient)

{

//            Java System version check

String jVersion = System.getProperty(“java.version”);

//AB

//                            if (jVersion.startsWith(“1.5.0”))

//                                            return true;

//                //vpj-cd e-evolution support to java 6

//                if (jVersion.startsWith(“1.6.0”))

//                                            return true;

//                //end

//                if (jVersion.startsWith(“1.7.0”))

//                                            return true;

//                if (jVersion.startsWith(“1.8.0”))

//                                            return true;

float v_JavaVersion=getJAVAVersion(jVersion);

if(v_JavaVersion>=1.6)

returntrue;

//AB

//  Warning

boolean ok = false;

//            if (jVersion.startsWith(“1.4”)

//                            || jVersion.startsWith(“1.5.1”))                //  later/earlier release

//                            ok = true;

 

//  Error Message

StringBuffer msg = new StringBuffer();

msg.append(System.getProperty(“java.vm.name”)).append(” – “).append(jVersion);

if (ok)

msg.append(“(untested)”);

msg.append(”  <>  1.5.0″);

//

if (isClient)

showMessageDialog(null, msg.toString(),

org.compiere.Adempiere.getName() + ” – Java Version Check”,

ok ? JOptionPane.WARNING_MESSAGE : JOptionPane.ERROR_MESSAGE);

else

log.severe(msg.toString());

return ok;

}   //  isJavaOK

 

2. Add the method at the end of the class Login.java

public static float getJAVAVersion(String jh)

{

int n=2,a=0;

for (int i = 0; i < jh.length(); i++)

{

if (jh.charAt(i) == ‘.’)

{

n–;

if (n == 0)

{

a=i;

}

}

}

return Float.parseFloat(jh.substring(0,a));

}

3. Replace the following code in test() method in ConfigVMSun.java

 

                public String test()

{

//            Java Home

File javaHome = new File (p_data.getJavaHome());

boolean pass = javaHome.exists();

String error = “Not found: Java Home”;

if (getPanel() != null)

signalOK(getPanel().okJavaHome, “ErrorJavaHome”,

pass, true, error);

if (!pass)

return error;

//            Look for tools.jar to make sure that it is not the JRE

File tools = new File (p_data.getJavaHome()

+ File.separator + “lib” + File.separator + “tools.jar”);

pass = tools.exists();

error = “Not found: Java SDK = ” + tools;

if (getPanel() != null)

signalOK(getPanel().okJavaHome, “ErrorJavaHome”,

pass, true, error);

if (!pass)

return error;

//

if (CLogMgt.isLevelFinest())

printProperties(System.getProperties(), “System”, true);

//

log.info(“OK: JavaHome=” + javaHome.getAbsolutePath());

setProperty(ConfigurationData.JAVA_HOME, javaHome.getAbsolutePath());

setProperty(ConfigurationData.JAVA_HOME, javaHome.getAbsolutePath());

//                            Java Version

//AB

//                                            final String VERSION = “1.5.0”;

//                                            final String VERSION2 = “1.6.0”; //            The real one

//                                            final String VERSION3 = “1.7.0”; //            The real one

//                                            final String VERSION4 = “1.8.0”; //            The real one

//                                            pass = false;

String jh = javaHome.getAbsolutePath();

String[] array=jh.split(“jdk”);

jh=array[1];

float v_JavaVerfrmHome=Login.getJAVAVersion(jh);                                                     //JAVA Home Check

if(v_JavaVerfrmHome>=1.6)

{

pass = true;

}

//                                            if (jh.indexOf(VERSION) != -1)   //            file name has version = assuming OK

//                                                            pass = true;

//                                            if (!pass && jh.indexOf(VERSION2) != -1)              //

//                                                            pass = true;

//

//                                            if (!pass && jh.indexOf(VERSION3) != -1)              //

//                                                            pass = true;

//                                            if (!pass && jh.indexOf(VERSION4) != -1)              //

//                                                            pass = true;

//AB

String thisJH = System.getProperty(“java.home”);

if (thisJH.indexOf(jh) != -1)         //            we are running the version currently

{

//AB

String thisJV = System.getProperty(“java.version”);

//                                                            pass = thisJV.indexOf(VERSION) != -1;

//                                                            if (!pass && thisJV.indexOf(VERSION2) != -1)

//                                                                            pass = true;

float v_JavaVersion=Login.getJAVAVersion(thisJV);            //JAVA Version Check

if(v_JavaVersion>=1.6)

{

pass = true;

}

if (pass)

log.info(“OK: Version=” + thisJV);

}

error = “Wrong Java Version: Should be equal to or more than 1.6”;

//AB

if (getPanel() != null)

signalOK(getPanel().okJavaHome, “ErrorJavaHome”,pass, true, error);

if (!pass)

return error;

//

setProperty(ConfigurationData.JAVA_TYPE, p_data.getJavaType());

return null;

}              //            test

 

4.  After the ConfigVMSun.java Import Login.java class

5.  That is All.

 

After the following changes we will be able to run the setup and login on system with JAVA 6 and above and run  server from it.

 

In case of any Queries do leave a comment and we will be happy to help!

 

 

 

 

-Adempiere Support { India Portal }

Read More

ADEMPIERE – INSTALLING TOMCAT SERVER FOR DEBUGGING OF WEB UI IN ECLIPSE

Files Needed:

  1. Apache Tomcat 6.0.41 (Or Any Version)
  2. Eclipse – IDE for Java EE Developers
  3. System Browser

[divider]

Process:-

  1. Install Tomcat Runtimes
    1. First, you need to install a Tomcat runtime for the deploying and running of the zk Web Client. Use Tomcat 5.5+
    2. To install a new Tomcat runtime, open the preferences dialog Window->Preferences and select the Server->Installed Runtimes. Use the Search button to locate your tomcat installation home folder.

image001

  1. Define a New Server

At the Servers view, right click to open the context menu and select New->Server.

If server view is not visible then you can use Window→Show View→Others … to open it. 

 image003

  1. Select the correct server type and the server runtime you have setup earlier.

image005

  1. Add your project to the server instance to be created

  image007

  1. The created server instance is now ready for use. Just Start the server once and then stop it. Do not try to debug it at this moment.

  image009

  1. Define location of ADempiere property file (NotePad File …available in your base folder )and ADempiere home (Place where your code is kept)

 

Now you have to define the location of your existing working ‘Adempiere.properties’ file and ADEMPIERE_HOME as system parameter for your Tomcat Instance. To do so, select Run->Open Run Dialog… and select the server instance you have created.

 

 

Note that the entries for your server instance in the Run dialog will only be created after you have start it for at least one time. Select the arguments tab and append your property file path and home parameter at the end of VM arguments.

It is highlighted in the pictures below:

 image011

 

  1. In Run Config Add in it in the same series, do not change the series.

Go to classpath section at user entries add external libs from tomcatlib (or tomcatserverlib) than add project – AdempiereTrunk

Apache jars needs to be at the first place in the classpath. See the image carefully along with the description below.

 

  • Bootstrap Entries
  • JRE Library
  • User Entries
  • tomcat_dir/bin/*.jar
  • tomcat_dir/server/lib/*.jar
  • E2 Project or Trunk
  • Adempiere Libraries i.e. add jasperreport 5.6.0 jar, if not available download, it from Internet

 image013

  1. Now Run in Debug Mode, by Right Clicking on the  Project and selecting Run in Debug Mode
  2. Choose the Browser such that, the browser can be used internal or External Browser.
  3. In case Run of the Project in WebUI, right Click on the project and select run project on Web Server.
  4. Your Version will then open in Debug Mode and in order to learn debugging do follow the next document on Debugging.

[divider]

DO REMEMBER

  1. If u need to change the Database of the WebUI you can do by Changing in the Adempire Properties File , just replace the Username and Password.
  2. Run Configuration is not created till u once start and stop the server.
  3. If your Build is getting failed , observe the errors completely such that you should know which WEB classes are interacting with Desktop Classes and separate them.

 

 

-By Adempiere Support {India Portal}

Read More