Exception in thread "main" java.lang.UnsatisfiedLinkError ERROR

Hi All,
I am trying to develop a Swing Application. I have compiled my codes in Windows like this:
javac -d ../../classes *.javaThen I tried to run the program from <my dir>/classes/ folder...
java com.fusion.ucmrtnd.Mainwhere Main.java contains the main() method.
But I am getting the following error:
Exception in thread "main" java.lang.UnsatisfiedLinkError: sun.awt.SunToolkit.getAppContext(Ljava/lang/Object;)Lsun/awt/AppContext;
        at sun.awt.SunToolkit.getAppContext(Native Method)
        at sun.awt.SunToolkit.targetToAppContext(Unknown Source)
        at sun.awt.windows.WComponentPeer.postEvent(Unknown Source)
        at sun.awt.windows.WComponentPeer.replaceSurfaceDataLater(Unknown Source)
        at sun.awt.windows.WWindowPeer.updateInsets(Native Method)
        at sun.awt.windows.WWindowPeer.initialize(Unknown Source)
        at sun.awt.windows.WFramePeer.initialize(Unknown Source)
        at sun.awt.windows.WComponentPeer.<init>(Unknown Source)
        at sun.awt.windows.WCanvasPeer.<init>(Unknown Source)
        at sun.awt.windows.WPanelPeer.<init>(Unknown Source)
        at sun.awt.windows.WWindowPeer.<init>(Unknown Source)
        at sun.awt.windows.WFramePeer.<init>(Unknown Source)
        at sun.awt.windows.WToolkit.createFrame(Unknown Source)
        at java.awt.Frame.addNotify(Unknown Source)
        at javax.swing.SwingUtilities$SharedOwnerFrame.addNotify(Unknown Source)
        at java.awt.Dialog.addNotify(Unknown Source)
        at java.awt.Dialog.conditionalShow(Unknown Source)
        at java.awt.Dialog.show(Unknown Source)
        at java.awt.Component.show(Unknown Source)
        at java.awt.Component.setVisible(Unknown Source)
        at java.awt.Window.setVisible(Unknown Source)
        at java.awt.Dialog.setVisible(Unknown Source)
        at DisplayStrip.DisplayStripRun(DisplayStrip.java:32)
        at Main.main(Main.java:8)PS: I used NetBeans 6.5 IDE, where it's working fine. But when I am trying to deploy the codes in Windows, I am getting this error.
Any help would be appreciated.
TiA....

maybe your rt.jar conflicting

Similar Messages

  • Standby.wrf error Exception in thread "main" java.lang.UnsatisfiedLinkError: C:\STAF\bin\JSTAF.dll: Can't load AMD 64-bit .dll on a IA 32-bit platform

    Hi,
    I have created a single tile and getting below error in standby0.wrf file.
    As mentioned in doc, I made a windows 32 bit for standby VM and installed 32 bit staf followed by staf configurations.I installed all the critical updates for windows.
    Exception in thread "main" java.lang.UnsatisfiedLinkError: C:\STAF\bin\JSTAF.dll: Can't load AMD 64-bit .dll on a IA 32-bit platform
    at java.lang.ClassLoader$NativeLibrary.load(Native Method)
    at java.lang.ClassLoader.loadLibrary0(Unknown Source)
    at java.lang.ClassLoader.loadLibrary(Unknown Source)
    at java.lang.Runtime.loadLibrary0(Unknown Source)
    at java.lang.System.loadLibrary(Unknown Source)
    at com.ibm.staf.STAFHandle.<clinit>(STAFHandle.java:306)
    at IdleVMTest.main(IdleVMTest.java:30)
    I am attaching my test log.
    please let me know how to fix it.
    Thanks,
    Suresh

    Rebecca,
    I appreciate your quick response.
    I am running the test from Primeclient. I am planning to add more tiles once tile0 runs fine. Client0 runs separately.Forgot to mention this in last update.
    I assume prime client generates all wrf files. when other VM's .wrf files are generated fine, will it be still primeclient side error??
    Primeclient is windows 2008 sp2 64bit. Initially I installed 32 bit java and ended up problem while starting the  VMmark2-STAX.bat. When i installed the 64bit java, problem vanished. I assume java version is correct.
    Similary initially i installed a cygwin 64 bit but i got error like "Error VMmarkRMQmgr unable to clear  queues". So uninstalled it and installed a cygwin 32 bit and the problem vanished.
    I am seeing the standby VM is relocated fine during the test. it is just it is not capturing the data in .wrf file. Standby VM configure section does not talk about java installation. is there anything else i am missing it?
    I would like to know whether  below error talks about standby VM because standby VM is 32 bit other side primeclient is 64 bit. below error says on a IA 32-bit platform.
    Exception in thread "main" java.lang.UnsatisfiedLinkError: C:\STAF\bin\JSTAF.dll: Can't load AMD 64-bit .dll on a IA 32-bit platform
    Below image u can see java variables are set. Is there anything wrong??
    Thanks,
    Suresh

  • Exception in thread "main" java.lang.UnsatisfiedLinkError: - fresh Install

    Pls can someone help me out. I have a similar problem to the one raised in this thread.
    I want to install 10g Release 2 on a RHEL AS4 Production IBM server. I've followed the installation guide to the letter!
    I keep getting this error:
    [oracle@pencomlx2 database]$ ./runInstaller
    Starting Oracle Universal Installer...
    Checking installer requirements...
    Checking operating system version: must be redhat-3, SuSE-9, redhat-4, UnitedLinux-1.0, asianux-1 or asianux-2
    Passed
    All installer requirements met.
    Preparing to launch Oracle Universal Installer from /tmp/OraInstall2007-07-08_04-07-07PM. Please wait ...[oracle@pencomlx2 database]$ Exception in thread "main" java.lang.UnsatisfiedLinkError: /tmp/OraInstall2007-07-08_04-07-07PM/jre/1.4.2/lib/i386/libawt.so: libXp.so.6: cannot open shared object file: No such file or directory
    at java.lang.ClassLoader$NativeLibrary.load(Native Method)
    at java.lang.ClassLoader.loadLibrary0(Unknown Source)
    at java.lang.ClassLoader.loadLibrary(Unknown Source)
    at java.lang.Runtime.loadLibrary0(Unknown Source)
    at java.lang.System.loadLibrary(Unknown Source)
    at sun.security.action.LoadLibraryAction.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at sun.awt.NativeLibLoader.loadLibraries(Unknown Source)
    at sun.awt.DebugHelper.<clinit>(Unknown Source)
    at java.awt.Component.<clinit>(Unknown Source)
    Pls can someone help out b4 i loose my mind!
    Kwex.

    This thread has a similar issue as the one addressed here: Re: Installation on Unbreakable Linux.
    ~ Madrid.

  • Exception in thread "main" java.lang.UnsatisfiedLinkError: no ocijdbc 10

    I have a script file called xmldr
    XML_LIB=~/sm/xmlDR/xmldr/lib
    export XML_LIB
    CLASSPATH=$CLASSPATH:$XML_LIB/ojdbc14.jar:$XML_LIB/xmldr.jar:$XML_LIB/xml.jar:$XML_LIB/xmlparserv2.jar:$XML_LIB/xsu12.jar;
    export CLASSPATH
    java xmlDR $0 $1 $2 $3 $4 $5 $6 $7 $8 $9
    But i still get the following error when i try to execute my script
    This program takes in 7-10 args
    $xmldr 100 268 OCI mt2 mes mes /opt/oracle/sm/
    connection URL: jdbc:oracle:oci8:@mt2
    Exception in thread "main" java.lang.UnsatisfiedLinkError: no ocijdbc10 in java.library.path
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1491)
    at java.lang.Runtime.loadLibrary0(Runtime.java:788)
    at java.lang.System.loadLibrary(System.java:834)
    at oracle.jdbc.driver.T2CConnection$1.run(T2CConnection.java:3135)
    at java.security.AccessController.doPrivileged(Native Method)
    at oracle.jdbc.driver.T2CConnection.loadNativeLibrary(T2CConnection.java:3131)
    at oracle.jdbc.driver.T2CConnection.logon(T2CConnection.java:221)
    at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:414)
    at oracle.jdbc.driver.T2CConnection.<init>(T2CConnection.java:132)
    at oracle.jdbc.driver.T2CDriverExtension.getConnection(T2CDriverExtension.java:78)
    at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:801)
    at java.sql.DriverManager.getConnection(DriverManager.java:512)
    at java.sql.DriverManager.getConnection(DriverManager.java:171)
    at xmlDR.main(xmlDR.java:117)
    and the 117th line is
    conn = DriverManager.getConnection(thinConn, username, password);
    Is this because i havent set my classpath right in my shell script?

    Hi guys,
    I am facing a problem when I am using oci driver. The reason why I am using oci driver is to enable failover. so at any cost I need to use oci driver only instead thin.
    The errors follows
    java.lang.UnsatisfiedLinkError: t2cParseExecuteDescribe
    at oracle.jdbc.driver.T2CStatement.t2cParseExecuteDescribe(Native Method)
    at oracle.jdbc.driver.T2CStatement.executeForDescribe(T2CStatement.java:725)
    at oracle.jdbc.driver.OracleStatement.executeMaybeDescribe(OracleStatement.java:1049)
    at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1154)
    at oracle.jdbc.driver.OracleStatement.executeInternal(OracleStatement.java:1726)
    at oracle.jdbc.driver.OracleStatement.execute(OracleStatement.java:1696)
    at com.lhs.ccb.sfw.application.JdbcLogin.getDBTimezone(Unknown Source)
    at com.lhs.ccb.sfw.application.JdbcLogin.checkConnection(Unknown Source)
    at com.lhs.ccb.sfw.application.JdbcLogin.newDataSource(Unknown Source)
    at com.lhs.ccb.sfw.application.JdbcLogin.getDataSource(Unknown Source)
    at com.lhs.ccb.sfw.application.TOPLinkLogin.newDatabaseLogin(Unknown Source)
    at com.lhs.ccb.sfw.application.TOPLinkLogin.getDatabaseLogin(Unknown Source)
    at com.lhs.ccb.sfw.application.TOPLinkLogin.newServerSession(Unknown Source)
    at com.lhs.ccb.sfw.application.TOPLinkLogin.getServerSession(Unknown Source)
    at com.lhs.ccb.sfw.application.TOPLinkLogin.registerDescriptorsByTopLink(Unknown Source)
    at com.lhs.ccb.sfw.application.ExtendedServer.initializePersistence(Unknown Source)
    at com.lhs.ccb.sfw.application.BasicServer.initialize(Unknown Source)
    at com.lhs.ccb.sfw.application.ExtendedServer.main(Unknown Source)
    Can anybody provide solution.
    Appreciate your great support

  • Exception in thread "main" java.lang.UnsatisfiedLinkError: /opt/oracle/libo

    Hi,
    I"m using Mac OS X (32 bit) and trying to connect to an Oracle 10g server via JDBC. I just installed the Mac OS X 10.2 Instant Client Package - Basic Lite from here -- http://www.oracle.com/technology/software/tech/oci/instantclient/htdocs/intel_macsoft.html. Sadly, when I try and run my console app to connect, I get this error ...
    Exception in thread "main" java.lang.UnsatisfiedLinkError: /opt/oracle/libocijdbc10.jnilib:
         at java.lang.ClassLoader$NativeLibrary.load(Native Method)
         at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1822)
         at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1739)
         at java.lang.Runtime.loadLibrary0(Runtime.java:822)
         at java.lang.System.loadLibrary(System.java:993)
         at oracle.jdbc.driver.T2CConnection$1.run(T2CConnection.java:3135)
         at java.security.AccessController.doPrivileged(Native Method)
         at oracle.jdbc.driver.T2CConnection.loadNativeLibrary(T2CConnection.java:3131)
         at oracle.jdbc.driver.T2CConnection.logon(T2CConnection.java:221)
         at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:414)
         at oracle.jdbc.driver.T2CConnection.<init>(T2CConnection.java:132)
         at oracle.jdbc.driver.T2CDriverExtension.getConnection(T2CDriverExtension.java:78)
         at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:801)
         at java.sql.DriverManager.getConnection(DriverManager.java:525)
         at java.sql.DriverManager.getConnection(DriverManager.java:140)
         at org.hibernate.connection.DriverManagerConnectionProvider.getConnection(DriverManagerConnectionProvider.java:133)
         at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:111)
         at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2097)
         at myco.dor.dmv.driver.youthful.database.YouthfulDriverDatabase.<init>(YouthfulDriverDatabase.java:77)
         at myco.dor.dmv.driver.youthful.database.YouthfulDriverDatabase.getInstance(YouthfulDriverDatabase.java:83)
         at myco.dor.dmv.driver.youthful.AddressFileProcessor.execute(AddressFileProcessor.java:86)
         at myco.dor.dmv.driver.youthful.AddressFileProcessor.main(AddressFileProcessor.java:81)
    Any ideas? My CLASSPATH is set to include /opt/oracle/classes12.jar. My ORACLE_HOME is set to /opt/oracle and LD_LIBRARY_PATH is set to ORACLE_HOME (since that's where all the jars are). How can I troubleshoot this further?
    Thanks, - Dave

    You can verify the settings of the path to your libraries with
    System.out.println(System.getProperty("java.library.path"));before you call System.loadLibrary(), so you know if it is correct.
    I also found this information (for Solaris):
    The shared library file name requires a "lib" prefix and a ".so" extension. Do not include the "lib" prefix or the ".so" extension for the argument that you pass to the System.loadLibrary method.
    I don't know if that helps you solving your problem.

  • Exception in thread "main" java.lang.UnsatisfiedLinkError

    Exception in thread "main" java.lang.UnsatisfiedLinkError: no LabIfxEC in java.library.path
    (LabIfxEC was compiled by ESQL/C of INFORMIX)
    My Java code as:
    public class LabEC
         public int labnum;
         public LabEC()
              labnum = 0;
         public synchronized native void invocation();
         static
                   System.loadLibrary("LabIfxEC");
         public static void main(String[] args)
              LabEC lec = new LabEC();
              lec.invocation();
              System.out.println("After Invoke : labnum = "+lec.labnum+"\n");
    My .h code as:
    /* DO NOT EDIT THIS FILE - it is machine generated */
    #include "/opt/hobo/java1.2/include/jni.h"
    /* Header for class LabEC */
    #ifndef IncludedLabEC
    #define IncludedLabEC
    #ifdef __cplusplus
    extern "C" {
    #endif
    * Class: LabEC
    * Method: invocation
    * Signature: ()V
    jfieldID jf;
    jclass jc;
    jobject jo;
    jint newnum;
    JNIEXPORT void JNICALL Java_LabEC_invocation
    (JNIEnv *env, jobject this);
    void TransDataToJava (JNIEnv *env, jobject this);
    int CreatConnection ();
    int CloseConnection ();
    #ifdef __cplusplus
    #endif
    #endif
    My ESQL/C code as:
    #include "LabEC.h"
    #include <stdio.h>
    JNIEXPORT void JNICALL Java_LabEC_invocation( JNIEnv *env,jobject this)
         jc = (*env)->GetObjectClass(env,this);
         jf = (*env)->GetFieldID(env,jc,"labnum","I");
         if( CreatConnection()||GetNumFromDB()||CloseConnection() )
              fprintf(stderr,"ERROR IN CONNECTING DB");
         }else{
              TransDataToJava(env,this);
    void TransDataToJava (JNIEnv *env,jobject this)
         (*env)->SetIntField(env,this,jf,newnum);
    int CreatConnection()
         EXEC SQL BEGIN DECLARE SECTION;
         char userid[] = "informix";
         char password[] = "informix";
         char dbname[] = "dbdycm_new";
         EXEC SQL END DECLARE SECTION;
         EXEC SQL CONNECT TO:dbname USER: userid using: password;
         if ( SQLCODE < 0 ) return -1;
         return 0;
    int GetNumFromDB()
         EXEC SQL BEGIN DECLARE SECTION;
         long numofrow;
         EXEC SQL END DECLARE SECTION;
         EXEC SQL SELECT count(*) into: numofrow from ttrlineinfo;
         if ( SQLCODE != 0 ) return -1;
         newnum = numofrow;
         return 0;
    int CloseConnection ()
         EXEC SQL DISCONNECT CURRENT;
         return 0;
    My makefile code as:
    INCLUDE_IX=-I /opt/informix/incl/esql
    INCLUDE=-I /opt/nmc/include -I /opt/hobo/java1.2/include -I /opt/hobo/java1.2/include/solaris
    FLAG=-G
    libLabIfxEC.so:LabEC.c LabEC.h
         cc $(FLAG) $(INCLUDE) $(INCLUDE_IX) -solibLabIfxEC.so LabEC.c
    LabEC.c:LabEC.ec LabEC.h
         esql -e LabEC.ec include=/opt/nmc/include:/opt/hobo/java1.2/include:/opt/hobo/java1.2/include/solaris
    The Exception as:
    Exception in thread "main" java.lang.UnsatisfiedLinkError: no LabIfxEC in java.library.path
    at java.lang.Throwable.fillInStackTrace(Native Method)
    at java.lang.Throwable.<init>(Throwable.java:94)
    at java.lang.Error.<init>(Error.java:50)
    at java.lang.LinkageError.<init>(LinkageError.java:43)
    at java.lang.UnsatisfiedLinkError.<init>(UnsatisfiedLinkError.java:42)
    at java.lang.ClassLoader.loadLibrary(Compiled Code)
    at java.lang.Runtime.loadLibrary0(Runtime.java:471)
    at java.lang.System.loadLibrary(System.java:745)
    at <Unloaded Method>
    I think my LD_LIBRARY_PATH setting is correct. I have been code a pure c library(without ESQL/C code),and it is runing well with Java.
    Please tell me why, thanks very much!
    Yours Alec

    You can verify the settings of the path to your libraries with
    System.out.println(System.getProperty("java.library.path"));before you call System.loadLibrary(), so you know if it is correct.
    I also found this information (for Solaris):
    The shared library file name requires a "lib" prefix and a ".so" extension. Do not include the "lib" prefix or the ".so" extension for the argument that you pass to the System.loadLibrary method.
    I don't know if that helps you solving your problem.

  • "Exception in thread "main" java.lang.UnsatisfiedLinkError:"  JNI in Linux

    Hi,
    I am writing a simple program to understand how JNI works so that I can use this concept to develop a project. But after running the simple code,
    It gives the following error:
    Exception in thread "main" java.lang.UnsatisfiedLinkError: sum
    at TestJni.main(testJni.java:25)
    My Java code is:
    import java.io.*;
    import java.util.*;
    class TestJni
    // Try to load the native Code library for user Authentication.
    static
    try
    System.loadLibrary( "test" );
    catch( UnsatisfiedLinkError e )
    System.out.println("Could not load native code for user authentication." );
    System.exit(1);
    public static void main( String [] args )
    //TestJni obj = new TestJni();
    System.out.println(TestJni.sum(2, 3));
    public static native int sum( int x, int y );
    TestJni.h looks like:
    /* DO NOT EDIT THIS FILE - it is machine generated */
    #include <jni.h>
    /* Header for class TestJni */
    #ifndef IncludedTestJni
    #define IncludedTestJni
    #ifdef __cplusplus
    extern "C" {
    #endif
    * Class: TestJni
    * Method: sum
    * Signature: (II)I
    JNIEXPORT jint JNICALL Java_TestJni_sum
    (JNIEnv *, jclass, jint, jint);
    #ifdef __cplusplus
    #endif
    #endif
    and my C++ code is:
    #include <jni.h>
    #include "TestJni.h"
    #include <stdio.h>
    JNIEXPORT jint JNICALL Java_TestJni_sum(JNIEnv *env, jclass obj, jint x, jint y)
    printf("Inside the native function\n");
    return (x + y);
    Then I am generating my .so file as:
    g++ -o libtest.so sum.cpp -shared -fpic -lcrypt -I//usr/lib/j2se/1.4/include -I/usr/lib/j2se/1.4/include/linux
    and copying the libtest.so file into the folder where I have my TestJni.class file. Then running the java code by:
    java TestJni
    but it gives the "UnsatisfiedLinkError". What to do? :( I have spend 2 days now to solve this problem but I am not getting it.
    I am using ubuntu 7.10 as my OS.
    Please let me know if you can help.

    Thanks for your response. I found that, when I copied the shared library to /usr/lib and
    did: ldconfig -n /usr/lib it worked
    But the problem is, this is my computer, but the computers that I am going to run my actual
    JNI application, have restrictive permission. Could anyone please let me know how I can
    do the work without ldconfig. I mean is there anyway I can configure my .so file's path without
    copying it into the /usr/lib folder and without ldconfig?
    I will appreciate any reply. Thanks.

  • Exception in thread "main" java.lang.UnsupportedClassversion error.

    hi,
    I am having the JDk and jre versions in C: drive
    i am jdk version 1.5.0
    but when i am running the command version it is showing 1.4.2_03 version and also i am having the oracle 10g on my system.
    tried seeting classpath also but no success.
    I am trying to run a simple helloworld program.while compiling there seems to be no problem..
    But while running the program i am encountring the following error.
    Exception in thread "main" java.lang.UnsupportedClassversion error.
    can someone help me regarding this

    Classpath is NOT going to help. You may be able to fix this by putting the JDK bin directory as the first entry in your system's PATH variable.

  • "Exception in thread "main" java.lang.NoClassDefFound Error" in XP

    I was creating programs just fine for awhile. Then, for some unknown reason, I start getting the runtime error message, "Exception in thread "main" java.lang.NoClassDefFound Error." I set my PATH in the following manner:
    Start | Control Panel | Performance and Maintenance | System | Advanced | Environment Variables | Use Variables for Owner | PATH | Edit | C:\j2sdk1.4.2_04;C:\j2sdk1.4.2_04\bin;C:\j2sdk1.4.2_04\jre\bin | Ok | Ok | Ok
    I then closed the dialog boxes and restarted my computer. I then tried to run a program that ran before, only to get the same runtime error! Can someone please help me???

    NoClassDefFoundError happens because the JVM cannot find some class from your program, not because the OS cannot find your JVM (PATH regulates the latter, but not the former). JVM looks up classes in directories (or JAR files) specified through the -classpath option, like "java -classpath c:\myclasses MyMainClass". Read the online doc for the "java" launcher for more info.

  • Error:"exception in thread main:java.lang.noclassdeffound error.

    Hi,
    I am new to this java tech and programming. I just started learning and installed j2sdk1.4.0_03. I wrote a small hello world program and compiled it without any errors. When I execute the same using java hello command, I am getting an error like this: exception in thread "main" java.lang.noclassdeffound error. I am not able to resolve this issue. Please let me know the sol.
    thanks
    venkatraman

    send the program u have typedUmm... Why?
    Anyway @NovaKane: Welcome. Together with seifist and sunny we have at
    least three new posters who show enough intelligence to find chuck's
    solution (or one of the many hundreds of others like it) and the politeness
    to thank him for it. What's the forum coming to?
    If you need it there is a description of the classpath here:
    http://java.sun.com/j2se/1.5.0/docs/tooldocs/windows/classpath.html
    Again, welcome. And thanks for raising the intelligence level (and politeness
    quotient) of the fora.

  • Exception in thread "main" java.lang.UnsatisfiedLinkError: /usr/jdk/instanc

    HI,
    i was test some packet capturing code and i was using jpcap
    * To change this template, choose Tools | Templates
    * and open the template in the editor.
    * @author Aftab Ali
    import jpcap.JpcapCaptor;
    import jpcap.NetworkInterface;
    import jpcap.NetworkInterfaceAddress;
    public class PacketCapturing {
        public static void main(String[] args){
       NetworkInterface[] devices = JpcapCaptor.getDeviceList();
    //for each network interface
    for (int i = 0; i < devices.length; i++) {
      //print out its name and description
      System.out.println(i+": "+devices.name + "(" + devices[i].description+")");
    //print out its datalink name and description
    System.out.println(" datalink: "+devices[i].datalink_name + "(" + devices[i].datalink_description+")");
    //print out its MAC address
    System.out.print(" MAC address:");
    for (byte b : devices[i].mac_address)
    System.out.print(Integer.toHexString(b&0xff) + ":");
    System.out.println();
    //print out its IP address, subnet mask and broadcast address
    for (NetworkInterfaceAddress a : devices[i].addresses)
    System.out.println(" address:"+a.address + " " + a.subnet + " "+ a.broadcast);
    but i have got an exception:java -Djava.library.path=/export/home/libjpcap.so PacketCapturing
    Exception in thread "main" java.lang.UnsatisfiedLinkError: /usr/jdk/instances/jdk1.5.0/jre/lib/i386/libjpcap.so: Can't load IA 32-bit .so on a IA 32-bit platform
    at java.lang.ClassLoader$NativeLibrary.load(Native Method)
    at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1751)
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1668)
    at java.lang.Runtime.loadLibrary0(Runtime.java:822)
    at java.lang.System.loadLibrary(System.java:993)
    at jpcap.JpcapCaptor.<clinit>(JpcapCaptor.java:251)
    at PacketCapturing.main(PacketCapturing.java:23)
    anyone can help me                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    aftab_ali wrote:
    java -Djava.library.path=/export/home/libjpcap.so PacketCapturing
    I don't know much about JNI, but java.library.path should be pointing at a directory containing your libraries and not at the libraries themselves (just as CLASSPATH points to locations containing your classes and not your classes themselves).

  • Exception in thread "main" java.lang.NullPointerException error JDeveloper 12c

    Hello,
    I am trying to call a java stored procedure in java application. I am using ORACLE database and JDeveloper.
    I am getting error "Exception in thread "main" java.lang.NullPointerException. I have no idea what have I been doing wrong.
    I have a table "Beer" and I want to select all the data out with a stored procedure which I call out of Java app.
    I have a java.class file Store_A.java which I have loaded into the ORACLE database with LOADJAVA :
        import java.sql.*;
        import java.io.*;
        public class Store_a {
          public static void apskatit ()
            throws SQLException
            { String sql =
              "SELECT * FROM Beer";
            try { Connection conn = DriverManager.getConnection("jdbc:default:connection:");
              PreparedStatement pstmt = conn.prepareStatement(sql);
              ResultSet rset = pstmt.executeQuery();
              rset.close();
              pstmt.close();
            catch (SQLException e) {System.err.println(e.getMessage());
    Then I have created a procedure which I plan to call out in java:
        CREATE OR REPLACE PACKAGE Store_a AS
        PROCEDURE apskatit;
        END Store_a;
        CREATE OR REPLACE PACKAGE BODY Store_a AS
        PROCEDURE apskatit AS LANGUAGE JAVA
        NAME 'Store_a.apskatit()';
        END Store_a;
    And I have a java file that I have created with JDeveloper 12c:
        import java.sql.Connection;
        import java.sql.DriverManager;
        import java.sql.ResultSet;
        import java.sql.SQLException;
        public class Class1 {
             * @param args
            public static void main(String[] args) throws SQLException {
                Connection conn = null;
                try {
                    Class.forName("oracle.jdbc.driver.OracleDriver");
                    //Izveidojam savienojumu
                    conn = DriverManager.getConnection("jdbc.oracle.thin:@localhost:1521", "SYSTEM", "asdasd");
                    // Izveidojam callable statement
                    CallableStatement stmt = conn.prepareCall("CALL Store_a.apskatit()");
                    ResultSet resul = stmt.executeQuery();
                    while (resul.next()) {
                        System.out.println(resul.getInt(1) + "\t" + resul.getString(2));
                } catch (ClassNotFoundException e) {
                    e.printStackTrace();
                } finally {
                    try {
                        conn.close();
                    } catch (SQLException e) {
                        e.printStackTrace();
    When I try to run the java file, I get this error "Exception in thread "main" java.lang.NullPointerException at client.Class1.main(Class1.java:29).
    So the line I get error in is "conn.close();"
    How to fix this?
    Thank you very much in advance.

    I am trying to call a java stored procedure in java application. I am using ORACLE database and JDeveloper.
    I am getting error "Exception in thread "main" java.lang.NullPointerException. I have no idea what have I been doing wrong.
    Maybe you haven't read it yet but I told you in your other thread what you were doing wrong and, step by step, how to address the problem.
    https://forums.oracle.com/thread/2611124
    I'm not going to repeat everything again just this one main piece of advice:
    Until you get you code working outside the database don't even bother trying to load it into the DB and create a Java stored procedure.
    You are trying to deal with too many different issues at the same time. Unless you solve your primary Java problem by fixing the code outside the DB you will have nothing but problems loading it into the DB.
    And just get rid of this line of code - you don't need it anymore and it hasn't been done like that for many years now:
    Class.forName("oracle.jdbc.driver.OracleDriver");

  • Exception in thread "main" java.lang.ClassFormat Error

    I am running a java program in NeBeans and when I run the program I am getting the following error:
    Exception in thread "main" java.lang.ClassFormatError: Repetitive method name/signature in class file pluginex2/TtsoapcgiPortType_addLink_ResponseStruct_SOAPSerializer
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
    at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
    at pluginex2.Ttsoapcgi_SerializerRegistry.getRegistry(Ttsoapcgi_SerializerRegistry.java:73)
    at pluginex2.Ttsoapcgi_Impl.<init>(Ttsoapcgi_Impl.java:25)
    at pluginex2.Main.main(Main.java:25)
    Java Result: 1
    BUILD SUCCESSFUL (total time: 0 seconds)
    What should I do?Can anyone please help me out?
    Thanks,
    Sravanthi.

    The class files are automatically into the build/generated/wsclient/project-name file of my project.
    I copied those class files into my source folder to make my program work.When I searched my system I jus found two of these files in build/generated/wsclient/project-name folder and source folder of my project.
    I am running the program directly through NetBeans IDE.

  • "Exception in thread "main" java.lang.NumberFormatException"error..pls help

    Hi,
    I'm trying to run a program I've written but keeping getting this error:
    Exception in thread "main" java.lang.NumberFormatException: empty String
    at sun.misc.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:994)
    at java.lang.Double.parseDouble(Double.java:482)
    at data.newLineToRead(data.java:21)
    at data.data(data.java:34)
    at train.main(train.java:86)
    I'm not quite sure where I'm going wrong.I've included the data class and train class.Could someone pls help me.
    Thanks a lot.
    Data Class:
    import java.io.*;
    import java.util.*;
    public class data{
            private static parameter par;
            private static double[][] x=new double[par.n()][par.D()];
            public static double[] t=new double[par.n()];
            public static void newLineToRead(String LineToRead,int n){
            int d=0;
            String stringToRead=new String();
                    for(int i=0;i<=LineToRead.length();i++){
                            StringTokenizer str = new StringTokenizer (stringToRead,"/t");
                            String[] strtemp = new String[str.countTokens()];
                                    while (str.hasMoreTokens()){
                                    x[n][d++] = Double.parseDouble(str.nextToken());
                                    d++;
                                    System.out.println(x[n][d++]);
                            stringToRead=new String();
                    t[n]=Double.parseDouble(stringToRead);
                    x[n][par.d()]=1.0;
            public static void data() throws IOException{
            DataInputStream in=null;
                    try{
                            in=new DataInputStream(new FileInputStream(par.f()));
                            for(int n=0;n<par.n();n++){
                            String LineToRead=in.readLine();
                                    if(LineToRead.length()==0){
                                            System.out.println("Remove empty lines");
                                    else{
                                            newLineToRead(LineToRead,n);
                    }finally{if(in!=null){in.close();}}
            public static double x(int n,int d){return x[n][d];}
            public static double t(int n){return t[n];}
    }Train Class
    import java.io.*;
    import java.util.*;
    public class train{
             private static parameter       par;
             private static data            dat;
             private static model           mod;
             private static response        resp;
             private static void error(String msg){
                    System.out.println(msg);
                    System.exit(1);
             private static void check(){
                if(par.f().length()==0)
                    error("No filename of input vectors!");
                if(par.n()==0)
                    error("No number of input vectors!");
                if(par.d()==0)
                    error("No number of input variables!");
                if(par.d()>par.D())
                    error("Dimension is larger than 100!");
              private static void usage(){
                System.out.println("Non-default parameters==========================");
                System.out.println("-f filename of input vectors");
                System.out.println("-n number of input vectors");
                System.out.println("-d number of input variables");
                System.out.println("Default parameters==========================");
                System.out.println("-R regularisation constant (must be positive and the default value is 0.0)");
                System.out.println("-S epsilon criterion for stopping a learning process (default value is 0.001)");
                System.out.println("-C maximum learning cycle (default value is 10000)");
                      public static void main(String[] argv){
                            if(argv.length==0){
                                    System.out.println("Command line is <Java [-cp path] train parameters>");
                                    usage();
                                    System.exit(1);
                            if(argv.length==1 && argv[0].equals("help")==true){
                                    usage();
                                    System.exit(1);
                            par.nin(0); par.din(0); par.Rin(0.0); par.Cin(10000); par.Sin(0.001);
    for(int i=0;i<argv.length;i++){
                                            if(argv.equals("-f")==true){
    if((i+1)==argv.length)
    error("miss the para");
    par.fin(argv[i+1]);
    i++;
    else if(argv[i].equals("-d")==true){
    if((i+1)==argv.length)
    error("miss the para");
    par.din(Integer.parseInt(argv[i+1]));
    i++;
    else if(argv[i].equals("-n")==true){
    if((i+1)==argv.length)
    error("miss the para");
    par.nin(Integer.parseInt(argv[i+1]));
    i++;
    else if(argv[i].equals("-S")==true){
    if((i+1)==argv.length)
    error("miss the para");
    par.Sin(Integer.parseInt(argv[i+1]));
    i++;
    else if(argv[i].equals("-C")==true){
    if((i+1)==argv.length)
    error("miss the para");
    par.Cin(Integer.parseInt(argv[i+1]));
    i++;
    else if(argv[i].equals("-R")==true){
    if((i+1)==argv.length)
    error("miss the para");
    par.Rin(Double.parseDouble(argv[i+1]));
    i++;
    else error("Unkown token");
    check();
    try {
    dat.data();
    }catch(IOException e) { System.err.println(e.toString()); }
    try {
    mod.model();
    }catch(IOException e) { System.err.println(e.toString()); }
    try {
    resp.record();
    }catch(IOException e){ System.err.println(e.toString()); }

    String stringToRead=new String();
                    for(int i=0;i<=LineToRead.length();i++){
                            StringTokenizer str = new StringTokenizer (stringToRead,"/t");
                            String[] strtemp = new String[str.countTokens()];
                                    while (str.hasMoreTokens()){
                                    x[n][d++] = Double.parseDouble(str.nextToken());
                                    d++;
                                    System.out.println(x[n][d++]);
                            stringToRead=new String();
                    t[n]=Double.parseDouble(stringToRead);
                    x[n][par.d()]=1.0;
            }Not sure exactly what you are trying to do above but...
    You are setting your String to an empty String with "new String()" and then parsing that empty String. Eventually, you are trying to parse a double from that empty String:
    t[n]=Double.parseDouble(stringToRead);Also, I cannot think of a reason to ever use "new String()" when you could just use:
    String myString = "";

  • Exception in thread "main" java.lang.UnsatisfiedLinkError: /lib (MAC/Unix)

    Ok....newbie to JNI here. I know there are quite a few posts like this here..but everyone seems to be on XP/Vista, nothing for MAC/Unix
    This is my problem:
    I have just created a small bit of code to test the JNI and it fails rather miserably with an unhelpful UnsatisfiedLinkError message. So onto the code and my observations:
    This is my HelloJNI.java
    class HelloJNI {
        private native static void print();
        public static void main(String[] args) {
         print();
        static {System.out.println ( System.getProperty( "java.library.path" ) );System.loadLibrary("HelloJNI");System.out.println("Done");}
    }Compiled successfully to HelloJNI.class
    This is my HelloJNI.h header file as generated by javah -jni HelloJNI
    /* DO NOT EDIT THIS FILE - it is machine generated */
    #include <jni.h>
    /* Header for class HelloJNI */
    #ifndef _Included_HelloJNI
    #define _Included_HelloJNI
    #ifdef __cplusplus
    extern "C" {
    #endif
    * Class:     HelloJNI
    * Method:    print
    * Signature: ()V
    JNIEXPORT void JNICALL Java_HelloJNI_print
      (JNIEnv *, jclass);
    #ifdef __cplusplus
    #endif
    #endifHere is the HelloJNI.cpp file:
    #include "HelloJNI.h"
    #include <iostream>
    using namespace std;
    JNIEXPORT void JNICALL Java_HelloJNI_print (JNIEnv *, jclass) {
      cout<<"Aye hello from JNI";
    }Now I have gone about this several ways....but in general the correct way to go about compiling this seems to have been to generate a .o file and then generate a file named libHelloJNI.jnilib. For all you doubters out there, this is the CORRECT name of the file, MAC OSX expects a library with the lib prefix and the .jnilib suffix. I can prove this to you in a second...but even the official technical notes I have come across on the web have told me that I need this special name on OSX in order for java to find my library. But this command works successfully:
    g++ -O3 -DNDEBUG -feliminate-unused-debug-symbols -fPIC -dynamiclib -o libHelloJNI.jnilib -I\/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Headers HelloJNI.cpp
    When I next run "java HelloJNI" I get this:
    .:/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/javaException in thread "main" java.lang.UnsatisfiedLinkError: /libHelloJNI.jnilib:
         at java.lang.ClassLoader$NativeLibrary.load(Native Method)
         at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1822)
         at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1739)
         at java.lang.Runtime.loadLibrary0(Runtime.java:823)
         at java.lang.System.loadLibrary(System.java:1030)
         at HelloJNI.<clinit>(HelloJNI.java:6)HOWEVER this does NOT mean it hasn't found the file...because if I delete the libHelloJNI.jnilib from the root directory and run "java HelloJNI" I get this:
    .:/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/javaException in thread "main" java.lang.UnsatisfiedLinkError: no HelloJNI in java.library.path
         at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1753)
         at java.lang.Runtime.loadLibrary0(Runtime.java:823)
         at java.lang.System.loadLibrary(System.java:1030)
         at HelloJNI.<clinit>(HelloJNI.java:6)So, this is kinda proof that my library file needs to be called libHelloJNI.jnilib, as the error message seems to change when it is present. FYI yes I am running this from the root of my drive, and I also have a file called libHelloJNI.so in the same directory, which java could seem to care less about.
    Any help would be great, this is a very frustrating problem.
    EDIT:
    Quickly some information I forgot to include:
    OS: 10.5.4 OSX
    JAVA: java -version produces: java version "1.6.0_05"
    Java(TM) SE Runtime Environment (build 1.6.0_05-b13-120)
    Java HotSpot(TM) 64-Bit Server VM (build 1.6.0_05-b13-52, mixed mode)g++ ---version:
    i686-apple-darwin9-g++-4.0.1 (GCC) 4.0.1 (Apple Inc. build 5488)
    Copyright (C) 2005 Free Software Foundation, Inc.
    This is free software; see the source for copying conditions.  There is NO
    warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.Processor: 2.1 GHz Intel Core 2 Duo
    Type of Computer: 3rd or 4th generation macbook
    Edited by: LordDelta on Sep 20, 2008 10:44 AM

    LordDelta wrote:
    Ok....newbie to JNI here. I know there are quite a few posts like this here..but everyone seems to be on XP/Vista, nothing for MAC/Unix
    Keep in mind that they are not using the same VM either. Nor is the VM from the same vendor.
    So the rules for what is required exactly will be different.
    loadLibrary() is intended to provide a generic mechanism to load a "shared library" across different platforms.
    The exact naming of the shared libraries is expected to be different.
    It might help, if you can't find other sources, to skip JNI and investigate how to create shared libraries
    which are accessible via C/C++ code. The rules that define that will be the same as those
    used by the VM. Once you understand those rules understanding what your VM needs
    will be easier.

Maybe you are looking for