23 September 2011

Oracle JDK 7 on OpenSuse as default JVM


After install of jdk-7-linux-i586.rpm, in terminal type these commands:

update-alternatives --install /usr/bin/java java /usr/java/jdk1.7.0/jre/bin/java 20000 

update-alternatives --install /usr/bin/javaws javaws /usr/java/jdk1.7.0/jre/bin/javaws 20000 
update-alternatives --install /usr/bin/javac javac /usr/java/jdk1.7.0/bin/javac 20000 
update-alternatives --install /usr/bin/jar jar /usr/java/jdk1.7.0/bin/jar 20000

update-alternatives --config java

OpenSuse 64
cd /usr/lib64/browser-plugins
ln -s /usr/java/jdk1.7.0/jre/lib/amd64/libnpjp2.so /usr/lib64/browser-plugins/libnpjp2.so

FoxPro 64bit plugin
update-alternatives --install /usr/lib64/mozilla/plugins/libjavaplugin.so libjavaplugin.so.x86_64 /usr/java/jdk1.7.0/jre/lib/amd64/libnpjp2.so 20000

FoxPro 32bit plugin

update-alternatives --install /usr/lib/mozilla/plugins/libjavaplugin.so libjavaplugin.so /usr/java/jdk1.7.0/jre/lib/i386/libnpjp2.so 20000

22 September 2011

JasperReport in NetBeans Swing Desktop Application

This is finally successfully coded procedure for showing Jasper Report in NetBeans Swing Desktop Application :

public void ShowReport() {
        try {
            Class.forName("org.postgresql.Driver");
            Connection con = DriverManager.getConnection("jdbc:postgresql://localhost:5432/neosoft", "postgres", "postgres");
            HashMap hm = new HashMap();
            JasperReport jre;
            jre = JasperCompileManager.compileReport("src//japi//report1.jrxml");
            JasperPrint jr = JasperFillManager.fillReport(jre, hm, con);
            JasperExportManager.exportReportToHtmlFile(jr, "report1.html");
            JasperViewer.viewReport(jr, false);
        } catch (ClassNotFoundException ex) {
            System.out.println(ex.getMessage());
        } catch (SQLException se) {
            System.out.println(se.getMessage());
        } catch (JRException ex) {
            System.out.println(ex.getMessage());
        }
    }

Also dont forget to include these jars into library :


15 September 2011

JDBC PostgreSQL in JDeveloper

Here is how to solve postgresql jdbc driver installation for JDeveloper WebLogic 10.3.

1.) Download the driver from here (http://jdbc.postgresql.org/download.html). You will probably want to download the JDBC 4 driver. The downloaded file will be .zip, eventhough the weblogic requires .jar. :-) For those who are beginners should know that Sun used .jar which is just another .zip file. Therefore rename the downloaded .zip to .jar.

2.) You can copy the file to C:\Oracle\Middleware\wlserver_10.3\server\lib .

3.) Open the following file C:\Oracle\Middleware\wlserver_10.3\common\bin\commEnv.cmd.

4.) Find the following line

set WEBLOGIC_CLASSPATH=%JAVA_HOME%\lib\tools.jar;%WL_HOME%\server\lib\weblogic_sp.jar;%WL_HOME%\server\lib\weblogic.jar;%FEATURES_DIR%\weblogic.server.modules_10.3.3.0.jar;%WL_HOME%\server\lib\webservices.jar;%ANT_HOME%/lib/ant-all.jar;%ANT_CONTRIB%/lib/ant-contrib.jar

and append ;%WL_HOME%\server\lib\postgresql-8.4-701.jdbc4.jar

so it becomes

set WEBLOGIC_CLASSPATH=%JAVA_HOME%\lib\tools.jar;%WL_HOME%\server\lib\weblogic_sp.jar;%WL_HOME%\server\lib\weblogic.jar;%FEATURES_DIR%\weblogic.server.modules_10.3.3.0.jar;%WL_HOME%\server\lib\webservices.jar;%ANT_HOME%/lib/ant-all.jar;%ANT_CONTRIB%/lib/ant-contrib.jar;%WL_HOME%\server\lib\postgresql-8.4-701.jdbc4.jar

5.) Make sure that the postgresql-8.4-701.jdbc4.jar reflects the postgres driver filename which you downloaded

6.) Restart the server

7.) Now if you go inside the Weblogic admin console and create a datasource you should be able to successfully test the configuration

    Driver Class = "org.postgresql.Driver";
    JDBC URL = "jdbc:postgresql://localhost:5432/neosoft";
    USER = "postgres";
    PASSWORD = "postgres";

source : Oracle Forum