SUN C++ 4.2 could not find POSIX thread on Solaris 2.6

I am trying to compile JTC(JThreads)1.0.13 on Sun solaris 2.6.
I am able to compile JTC using gcc 2.95 but when i am compiling same application with Sun C++ 4.2 it is not able to find out POSIX threads , thus giving error
Operating system doesn't support threads.
I have tried compiling the same application on Sun Solaris 2.7 with C++ 4.2 , where it goes fine
I have got pthread.h.
Please help

C++ 4.2 is not supported on Solaris 2.6. Sun 5.X is.

Similar Messages

  • Sun C++ 5.13 SunOS_sparc Beta2 2014/06/17: Error: Could not find a match for std::_Tuple_impl 0, unsigned&& ::_Tuple_impl(std::tuple unsigned&& , unsigned) needed in std::tuple unsigned&& ::tuple unsigned, void (unsigned&&).

    I think I downloaded the latest Solaris Studio version.  When I compile my code, I got the following error:
    bash-3.00$ gmake -f Makefile.sun
    CC -c -o metadata.o metadata.cpp -I. -I.. -g -O0 -std=c++11 -I/export/home/oracle/zhifan/boost_1_55_0 -I/export/home/oracle/zhifan/instantclient_11_2/sdk/include -V
    CC: Sun C++ 5.13 SunOS_sparc Beta2 2014/06/17
    ccfe: Sun C++ 5.13 SunOS_sparc Beta2 2014/06/17
    "metadata.cpp", line 20: Warning: db hides databus::MetadataManager::db.
    "metadata.cpp", line 26: Warning: db hides databus::MetadataManager::db.
    Error: Could not find a match for std::_Tuple_impl<0, unsigned&&>::_Tuple_impl(std::tuple<unsigned&&>, unsigned) needed in std::tuple<unsigned&&>::tuple<unsigned, void>(unsigned&&).
    "/export/home/oracle/zhifan/SolarisStudio12.4-beta_jul14-solaris-sparc/lib/compilers/CC-gcc/include/c++/4.8.2/tuple", line 868:     Where: While instantiating "std::tuple<unsigned&&>::tuple<unsigned, void>(unsigned&&)".
    "/export/home/oracle/zhifan/SolarisStudio12.4-beta_jul14-solaris-sparc/lib/compilers/CC-gcc/include/c++/4.8.2/tuple", line 868:     Where: Instantiated from std::forward_as_tuple<unsigned>(unsigned&&).
    "/export/home/oracle/zhifan/SolarisStudio12.4-beta_jul14-solaris-sparc/lib/compilers/CC-gcc/include/c++/4.8.2/bits/stl_map.h", line 485:     Where: Instantiated from non-template code.
    1 Error(s) and 2 Warning(s) detected.
    gmake: *** [metadata.o] Error 2
    with the same code, It can be compiled with g++ on Linux platform.
    1 Is the issue same as 12.4 Beta, Error: Could not find a match for std::_Tuple_impl<0, std::string &&>::_Tuple_impl(std::tuple<std::string &&> ?
    2 Do we have any workaround for this issue?
    3 When will the final 12.4 release  be available?

    I can't say for sure whether your problem is fixed in the final release without a test case, but I'd say the chances are very good.
    The final release will be announced soon. Watch this space, or the Oracle Solaris Studio page for an announcement.

  • The system could not find a javax.ws.rs.ext.MessageBodyWriter or a DataSourceProvider class for the com.rest.assignment.EmpBean type and application/json mediaType.  Ensure that a javax.ws.rs.ext.MessageBodyWriter exists in the JAX-RS application for the

    Hi,
    Im trying to create a Rest WS with a @GET method that will return me an Emp object. I need the output as a JSON string.
    I have created a dynamic web project and added javax RS jars:
    When im trying to run this, i'm getting the below mentioned error:
    FlushResultHa E org.apache.wink.server.internal.handlers.FlushResultHandler handleResponse The system could not find a javax.ws.rs.ext.MessageBodyWriter or a DataSourceProvider class for the com.rest.assignment.EmpBean type and application/json mediaType.  Ensure that a javax.ws.rs.ext.MessageBodyWriter exists in the JAX-RS application for the type and media type specified.
    RequestProces I org.apache.wink.server.internal.RequestProcessor logException The following error occurred during the invocation of the handlers chain: WebApplicationException (500 - Internal Server Error)
    Please help as im stuck with this from long.
    Thanks in advance.
    Below is the code for my service class:
    package com.rest.assignment;
    import java.io.FileInputStream;
    import java.io.FileNotFoundException;
    import java.io.IOException;
    import java.util.Enumeration;
    import java.util.HashSet;
    import java.util.Properties;
    import java.util.Set;
    import javax.ws.rs.GET;
    import javax.ws.rs.Path;
    import javax.ws.rs.Produces;
    import javax.ws.rs.core.Application;
    import javax.ws.rs.core.MediaType;
    import javax.ws.rs.core.Response;
    @Path("/restService")
    public class RestService extends Application {   
        @GET
        @Path("/getEmpDetails")
        @Produces(MediaType.APPLICATION_JSON)
        public Response getStringResponse()
            EmpBean empBean = new EmpBean();
            String filePath = "C:/Program Files/IBM/workspace/HelloWorld/src/com/rest/resources/EmpData.properties";
            Properties properties = new Properties();
            try {
                properties.load(new FileInputStream(filePath));
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            } catch (IOException e) {
                e.printStackTrace();
             Enumeration e = properties.propertyNames();
             String result="";
            String[] empDetailsArr;
            while (e.hasMoreElements()) {
              String key = (String) e.nextElement();
              String empDetails = properties.getProperty(key);
              empDetailsArr=empDetails.split(",");    
              empBean.setFirstName(empDetailsArr[0]);
              empBean.setLastName(empDetailsArr[1]);
              empBean.setEmpId(empDetailsArr[2]);
              empBean.setDesignation(empDetailsArr[3]);
              empBean.setSkillSet(empDetailsArr[4]);
              result = empDetailsArr[1];
            //return empBean;
            return Response.ok(empBean).type(MediaType.APPLICATION_JSON_TYPE).build();
        @Override
        public Set<Class<?>> getClasses() {
            Set<Class<?>> classes = new HashSet<Class<?>>();
            classes.add(RestService.class);
            classes.add(EmpBean.class);
            return classes;
    and my empBean goes like this:
    package com.rest.assignment;
    public class EmpBean {
        private String firstName;
        private String lastName;
        private String empId;
        private String designation;
        private String skillSet;
        public String getFirstName() {
            return firstName;
        public void setFirstName(String firstName) {
            this.firstName = firstName;
        public String getLastName() {
            return lastName;
        public void setLastName(String lastName) {
            this.lastName = lastName;
        public String getEmpId() {
            return empId;
        public void setEmpId(String empId) {
            this.empId = empId;
        public String getDesignation() {
            return designation;
        public void setDesignation(String designation) {
            this.designation = designation;
        public String getSkillSet() {
            return skillSet;
        public void setSkillSet(String skillSet) {
            this.skillSet = skillSet;
    Web.xml goes like this:
    <?xml version="1.0" encoding="UTF-8"?>
    <web-app id="WebApp_ID" version="3.0" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
    <display-name>restWS</display-name>
    <welcome-file-list>
      <welcome-file>index.html</welcome-file>
      <welcome-file>index.htm</welcome-file>
      <welcome-file>index.jsp</welcome-file>
      <welcome-file>default.html</welcome-file>
      <welcome-file>default.htm</welcome-file>
      <welcome-file>default.jsp</welcome-file>
    </welcome-file-list>
    <servlet>
      <servlet-name>REST</servlet-name>
      <servlet-class>com.ibm.websphere.jaxrs.server.IBMRestServlet</servlet-class>
      <init-param>
       <param-name>javax.ws.rs.Application</param-name>
       <param-value>com.rest.assignment.RestService</param-value>
      </init-param>
      <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
      <servlet-name>REST</servlet-name>
      <url-pattern>/rest/*</url-pattern>
    </servlet-mapping>
    </web-app>
    When i try to return a string from my get method, it gives me a proper response. i get this exception when im trying to return a JSON response.

    Hi,
    Im trying to create a Rest WS with a @GET method that will return me an Emp object. I need the output as a JSON string.
    I have created a dynamic web project and added javax RS jars:
    When im trying to run this, i'm getting the below mentioned error:
    FlushResultHa E org.apache.wink.server.internal.handlers.FlushResultHandler handleResponse The system could not find a javax.ws.rs.ext.MessageBodyWriter or a DataSourceProvider class for the com.rest.assignment.EmpBean type and application/json mediaType.  Ensure that a javax.ws.rs.ext.MessageBodyWriter exists in the JAX-RS application for the type and media type specified.
    RequestProces I org.apache.wink.server.internal.RequestProcessor logException The following error occurred during the invocation of the handlers chain: WebApplicationException (500 - Internal Server Error)
    Please help as im stuck with this from long.
    Thanks in advance.
    Below is the code for my service class:
    package com.rest.assignment;
    import java.io.FileInputStream;
    import java.io.FileNotFoundException;
    import java.io.IOException;
    import java.util.Enumeration;
    import java.util.HashSet;
    import java.util.Properties;
    import java.util.Set;
    import javax.ws.rs.GET;
    import javax.ws.rs.Path;
    import javax.ws.rs.Produces;
    import javax.ws.rs.core.Application;
    import javax.ws.rs.core.MediaType;
    import javax.ws.rs.core.Response;
    @Path("/restService")
    public class RestService extends Application {   
        @GET
        @Path("/getEmpDetails")
        @Produces(MediaType.APPLICATION_JSON)
        public Response getStringResponse()
            EmpBean empBean = new EmpBean();
            String filePath = "C:/Program Files/IBM/workspace/HelloWorld/src/com/rest/resources/EmpData.properties";
            Properties properties = new Properties();
            try {
                properties.load(new FileInputStream(filePath));
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            } catch (IOException e) {
                e.printStackTrace();
             Enumeration e = properties.propertyNames();
             String result="";
            String[] empDetailsArr;
            while (e.hasMoreElements()) {
              String key = (String) e.nextElement();
              String empDetails = properties.getProperty(key);
              empDetailsArr=empDetails.split(",");    
              empBean.setFirstName(empDetailsArr[0]);
              empBean.setLastName(empDetailsArr[1]);
              empBean.setEmpId(empDetailsArr[2]);
              empBean.setDesignation(empDetailsArr[3]);
              empBean.setSkillSet(empDetailsArr[4]);
              result = empDetailsArr[1];
            //return empBean;
            return Response.ok(empBean).type(MediaType.APPLICATION_JSON_TYPE).build();
        @Override
        public Set<Class<?>> getClasses() {
            Set<Class<?>> classes = new HashSet<Class<?>>();
            classes.add(RestService.class);
            classes.add(EmpBean.class);
            return classes;
    and my empBean goes like this:
    package com.rest.assignment;
    public class EmpBean {
        private String firstName;
        private String lastName;
        private String empId;
        private String designation;
        private String skillSet;
        public String getFirstName() {
            return firstName;
        public void setFirstName(String firstName) {
            this.firstName = firstName;
        public String getLastName() {
            return lastName;
        public void setLastName(String lastName) {
            this.lastName = lastName;
        public String getEmpId() {
            return empId;
        public void setEmpId(String empId) {
            this.empId = empId;
        public String getDesignation() {
            return designation;
        public void setDesignation(String designation) {
            this.designation = designation;
        public String getSkillSet() {
            return skillSet;
        public void setSkillSet(String skillSet) {
            this.skillSet = skillSet;
    Web.xml goes like this:
    <?xml version="1.0" encoding="UTF-8"?>
    <web-app id="WebApp_ID" version="3.0" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
    <display-name>restWS</display-name>
    <welcome-file-list>
      <welcome-file>index.html</welcome-file>
      <welcome-file>index.htm</welcome-file>
      <welcome-file>index.jsp</welcome-file>
      <welcome-file>default.html</welcome-file>
      <welcome-file>default.htm</welcome-file>
      <welcome-file>default.jsp</welcome-file>
    </welcome-file-list>
    <servlet>
      <servlet-name>REST</servlet-name>
      <servlet-class>com.ibm.websphere.jaxrs.server.IBMRestServlet</servlet-class>
      <init-param>
       <param-name>javax.ws.rs.Application</param-name>
       <param-value>com.rest.assignment.RestService</param-value>
      </init-param>
      <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
      <servlet-name>REST</servlet-name>
      <url-pattern>/rest/*</url-pattern>
    </servlet-mapping>
    </web-app>
    When i try to return a string from my get method, it gives me a proper response. i get this exception when im trying to return a JSON response.

  • Could not find a valid Java virtual machine to load

    On a fresh copy of CFMX8, when I run updater 7, it responds
    'Could not find a valid Java virtual machine to load'.
    This is being installed on a Win2K3 server and this is on a
    'freshly minted' POC box solely for the purpose of
    installing/testing CFMX8 to determine how it compares to our
    CFMX6.1 environment.
    You will notice that it is NOT being installed in the default
    directory:
    JRun Version Information
    Vendor Macromedia
    Product Name JRun 4.0
    Build Number 108487
    Version Full Version
    License Type Trial License
    Serial Number JRD400-69341-58259-30688
    JRun 3.x Serial Number
    Restricted to Single IP No
    Installation Root D:\ISG\software\jrun4
    Expiration Date Mar 29, 2008
    Evaluation Days Remaining 29
    JDK path (JAVA_HOME): D:/ISG/software/jrun4/jre
    I do find it curious that I can run the Updater 6, and it
    seems to behave properly (it finds the VM). I ran it just as a
    test, then wiped everything to start over from scratch. For some
    reason do I need to direct Updater 7 to the installation that I did
    not have to do in Updater 6?
    Thank you in advance for your assistance - Jacques

    tried executing the following cmd, below is the following error:
    <<command i executed>>
    C:\Program Files\Java\jre1.5.0_09\bin>java -classpath "C:\Program Files\Java\jre1.5.0_09\lib\javaws.jar" com.sun.javaws.Main https://<IPddr>:8443/sample.jnlp
    Can you pls let me know how it can be resolved?Umm.. I am not sure, but I will start with
    a question. Why not do it this way?C:\Program Files\Java\jre1.5.0_09\bin>javaws https://<IPddr>:8443/sample.jnlp

  • Could not find the main class: oracle.ide.boot.Launcher.  Program will exit

    Hi,
    I have installed Oracle11g_win64_11gR1, Database and Client.
    The issue is unable to invoke "sqldeveloper", getting the following error message. Could you please help ?
    FYI. I have already downloaded and installed installed JRE and JDK.
    ie. C:\Program Files (x86)\Java\jre6\ and C:\Program Files\Java\jdk1.6.0_24, still did not work.
    C:\Users\oracle>java -version
    java version "1.6.0_24"
    Java(TM) SE Runtime Environment (build 1.6.0_24-b07)
    Java HotSpot(TM) 64-Bit Server VM (build 19.1-b02, mixed mode)
    Let me know, if you need more information. Here is the error message.
    Error Message
    =========
    (1) if I invoke sqldeveloper, directly from the location " C:\app\oracle\product\11.1.0\db_1\sqldeveloper\sqldeveloper\bin " using explorer, I do get error message
    "Unable to find a java Virtual Machine.
    To point to a location of java Virtual machine please refer to the Oracle9i JDeveloper Install Guide ( jdev/install.html)"
    (2) if I invoke sqldeveloper, directly from the locationC:\app\oracle\product\11.1.0\client_1\sqldeveloper, it prompts me to enter "full path for java.exe".
    When I enter full path and continue, still it continue to prompt and ask the same input.
    (3) if I invoke sqldeveloper from from command prompt using the batch file "sqldeveloper.bat"
    C:\Users\oracle>C:\app\oracle\product\11.1.0\client_1\sqldeveloper\sqldeveloper\
    bin\sqldeveloper.bat
    C:\Users\oracle>java -Xmx512M -Xverify:none -XX:JavaPriority10_To_OSPriority=10
    -XX:JavaPriority9_To_OSPriority=9 -Doracle.ide.util.AddinPolicyUtils.OVERRIDE_F
    LAG=true -Dsun.java2d.ddoffscreen=false -Dwindows.shell.font.languages= -Dide.co
    nf="sqldeveloper.conf" -Dide.home.dir.name=.sqldeveloper -classpath ..\..\ide\l
    ib\ide-boot.jar;..\..\jdev\lib\xmleditor.jar;..\..\ide\lib\oicons.jar;..\..\..\j
    dbc\lib\ojdbc5.jar;..\..\jlib\jewt4.jar;..\..\jlib\share.jar;..\..\sqldeveloper\
    lib\jle2.jar oracle.ide.boot.Launcher
    Exception in thread "main" java.lang.NoClassDefFoundError: oracle/ide/boot/Launc
    her
    Caused by: java.lang.ClassNotFoundException: oracle.ide.boot.Launcher
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    Could not find the main class: oracle.ide.boot.Launcher. Program will exit.
    OS
    ==============
    MS Windows 7 Home Premium
    sqldeveloper.conf
    ===================
    SetSkipJ2SDKCheck true
    IncludeConfFile ../../jdev/bin/ide.conf
    AddVMOption -Dapple.laf.useScreenMenuBar=true
    AddVMOption -Dcom.apple.mrj.application.apple.menu.about.name="SQL_Developer"
    AddVMOption -Dcom.apple.mrj.application.growbox.intrudes=false
    AddVMOption -Dcom.apple.macos.smallTabs=true
    AddVMOption -Doracle.ide.util.AddinPolicyUtils.OVERRIDE_FLAG=true
    AddJavaLibFile ../../jdev/lib/xmleditor.jar
    AddJavaLibFile ../../ide/lib/oicons.jar
    AddJavaLibFile ../../jlib/jewt4.jar
    AddJavaLibFile ../../jlib/share.jar
    AddJavaLibFile ../ide/jlib/xmlef.jar
    AddJavaLibFile ../../sqldeveloper/lib/jle2.jar
    AddJavaLibFile ../../sqldeveloper/lib/oracle.dbtools.logging.jar
    AddVMOption -Dsun.java2d.ddoffscreen=false
    AddVMOption -Dwindows.shell.font.languages=
    IncludeConfFile sqldeveloper-nondebug.conf
    SetJavaHome C:\Program Files\Java\jdk1.6.0_24
    Edited by: sivapara on Feb 16, 2011 1:08 PM

    I was able to resolve this issue by performing following.
    1. Go to the location where sqldeveloperW.exe is being executed from.
    2. You will find a file sqldeveloper.conf in that location. Edit this file and change the value of IncludeConfFile to point to actual place. For me following were old and new values.
    OLD (Wrong) : IncludeConfFile ../../jdev/bin/ide.conf
    NEW (Correct) : IncludeConfFile ../../ide/bin/ide.conf
    After making above change in the sqldeveloper.conf file. Save and close it. Restart SQLDeveloper. You will not get the error anymore.
    Thanks
    Ravi

  • Could not find main class. Program will now exit. *SIGH*.....

    At first I thought it was just my own programs that I created with netbeans that had this problem; however, even the demo programs under the sdk folder give me this problem when i try to run them. Virtual Machine Loader will just come up with pop up saying "Could not find the main class. Program will not exit"
    I am a fairly competent programmer, not new to java. But I am new to guis in java, and using netbeans to create them. The program I am creating gives me this error with javaw and with java it will tell me NoClassDef for grouplayout. I checked the manifest file it looks alright:
    Manifest-Version: 1.0
    Ant-Version: Apache Ant 1.7.0
    Created-By: 10.0-b19 (Sun Microsystems Inc.)
    Main-Class: desktopapplication2.DesktopApplication2
    Class-Path: lib/appframework-1.0.3.jar lib/swing-worker-1.1.jar lib/swing-layout-1.0.1.jar lib/ant-swing.jar lib/SwingSet2.jar lib/swing-layout-1.0.3.jar
    X-COMMENT: Main-Class will be added automatically by build
    }(brackets not included)
    I am sort of lost.... Do I need to install ant separately?
    I feel like there may be some classpath issues?
    I have java 1.6 update 4 and netbeans 6.0
    I am completely lost I have been working on fixing this for the past 2 or 3 days now, and reading up all the information.
    Note: This is just a standard desktop application.
    Also I just thought of something. If I have install the development kit do I also need to install the framework or whatever for 6.0 separately? Meaning installing the latest version of jvm. Sorry if this isn't clear i forgot what it is called.
    Sorry if this sounds like a beginner question or something, but I am going crazy. If i am having this much trouble running my own program i really hope distributing files won't be this much of a nightmare....

    Please become familar with resources at the NetBeans site. There are tutorials and FAQs that cover usage of NB, and how to do things like you're asking.
    See my reply in this thread for more information
    http://forum.java.sun.com/thread.jspa?threadID=5270931&tstart=0

  • Could not find Factory: javax.faces.context.FacesContextFactory

    I'm trying to start a new JSF with facelets app from scratch using JSF 1.2.06 on Tomcat 6.0.10 but I can't even get the app to start.
    I get this when I try to start the app:
    java.lang.IllegalStateException: Application was not properly initialized at startup, could not find Factory: javax.faces.context.FacesContextFactory
         javax.faces.FactoryFinder.getFactory(FactoryFinder.java:263)
         javax.faces.webapp.FacesServlet.init(FacesServlet.java:142)
         org.apache.jasper.runtime.PageContextImpl.doForward(PageContextImpl.java:699)
         org.apache.jasper.runtime.PageContextImpl.forward(PageContextImpl.java:670)
         org.apache.jsp.index_jsp._jspService(index_jsp.java:59)
         org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:384)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
    I've seen a few contradictory pieces of advice on how to resolve but none seem very promising.
    What are the basic requirements for a JSF 1.2 application, especially regarding entries required in web.xml and faces-config.xml? I don't see this clearly documented anywhere on Sun's JSF site.
    Thanks!

    I think I found the reason for this problem.
    I should have also mentioned that my app contained a welcome page (index.jsp) that contained only a forward to my Facelet-based home page via:
    <jsp:forward page="pages/stm/StmHome.jsf" />
    My home page was named: StmHome.xhtml
    I mapped the FacesServlet to handle all requests with a *.jsf extension
    But I set the javax.faces.DEFAULT_SUFFIX context parameter to: .xhtml
    When I changed the value for the forward tag in the index.jsp to "StmHome.xhtml" the app started ok and the home page displayed without error.
    So it looks like this problem was caused by a mismatch between the value I set for the javax.faces.DEFAULT_SUFFIX context parameter and the value I set for the URL pattern in the FacesServlet mapping, correct ?
    Which brings me to my next question: should the values for the javax.faces.DEFAULT_SUFFIX and the FacesServlet URL pattern always match?
    Thanks!

  • Could not find agent library on the library path or in the local directory

    Hi all,
    I'm trying to write a jvmti agent that write any information in a mysql db. I've written a simple agent that work correctly and now I'll try to insert the mysqlpp library in my agent:
    1) I've added #include <mysql++.h>
    2) and I've added mysqlpp::Connection      conn(false); (global variable)
    I've modify my Makefile and the compiler and linker work correctly but when I test the agent the VM says "Could not find agent library on the library path or in the local directory"
    Below the code:
    -- analizer.cpp --
    #include <iostream>
    #include <stdlib.h>
    #include <jni.h>
    #include <string.h>
    #include <jvmti.h>
    #include <mysql++.h>
    #include "ClassDetail.cpp"
    #define CFN(ptr) checkForNull(ptr, __FILE__, __LINE__);
    static void checkForNull(void *ptr, const char* file, int line) {
        if(ptr == NULL) {
            std::cerr << "ERROR : NullPointerException in " << file <<":"<< line<<"\n";
            abort();
    static char* getErrorName(jvmtiEnv *jvmti, jvmtiError err) {
        jvmtiError errNum;
        char *name;
        errNum = jvmti->GetErrorName(err, &name);
        if( errNum != JVMTI_ERROR_NONE) {
            std::cerr << "ERROR : errore nel reprire l'error name " << errNum;
            abort();
        return name;
    #define CJVMTIE(jvmti, err) checkJvmtiError(jvmti, err, __FILE__, __LINE__);
    static void checkJvmtiError(jvmtiEnv *jvmti, jvmtiError err, const char* file, int line) {
        if(err != JVMTI_ERROR_NONE) {
            char *name = getErrorName(jvmti, err);
            std::cout << "ERROR : JVMTI error " << err << "("<<name<<") in "<<file<<":"<<line;
            abort();
    static void vmInit(jvmtiEnv *jvmti_env, JNIEnv *jni, jthread thread);
    static void startGCEvent(jvmtiEnv *jvmti_env);
    static void finishGCEvent(jvmtiEnv *jvmti_env);
    static jvmtiIterationControl JNICALL heapObject(jlong tag, jlong size, jlong* tag_ptr, void* userData);
    jrawMonitorID           lock;
    int                     gc_count;
    long                    heapSize = 0;
    bool                    heapCheck = false;
    mysqlpp::Connection      conn(false);
    JNIEXPORT jint JNICALL Agent_OnLoad(JavaVM *vm, char *options, void *reserved) {
        std::cout<<"OnLoad\n";
        jint                rc;
        jvmtiEnv            *jvmti = NULL;
        jvmtiError          err;
        jvmtiCapabilities   capabilities;
        jvmtiEventCallbacks callbacks;
        rc = vm->GetEnv((void **)&jvmti, JVMTI_VERSION);
        if( rc != JNI_OK) {
            std::cout << "ERROR : Errore nell'ottenere 'environment rc = " << rc;
            return -1;
        CFN(jvmti);
        err = jvmti->GetCapabilities(&capabilities);
        CJVMTIE(jvmti, err);
        CFN(&capabilities);
        capabilities.can_generate_garbage_collection_events = true;
        capabilities.can_tag_objects = true;
        CJVMTIE(jvmti, jvmti->AddCapabilities(&capabilities));
        CJVMTIE(jvmti, jvmti->CreateRawMonitor("agent lock", &lock));
        callbacks.VMInit = &vmInit;
        callbacks.GarbageCollectionStart = &startGCEvent;
        callbacks.GarbageCollectionFinish = &finishGCEvent;
        CJVMTIE(jvmti, jvmti->SetEventCallbacks(&callbacks, sizeof(callbacks)));
        jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, NULL);
        jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_GARBAGE_COLLECTION_START, NULL);
        jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_GARBAGE_COLLECTION_FINISH, NULL);
        return 0;
    JNIEXPORT void JNICALL Agent_OnUnload(JavaVM *vm)
        std::cout<<"OnUnload\n";
    static void JNICALL worker(jvmtiEnv *jvmti, JNIEnv *jni, void *p) {
        std::cout << "worker";
        for (;;) {
            CJVMTIE(jvmti, jvmti->RawMonitorEnter(lock));
            while (gc_count == 0) {
                CJVMTIE(jvmti, jvmti->RawMonitorWait(lock, 0));
                jvmti->RawMonitorExit(lock);
            gc_count = 0;
            jvmti->RawMonitorExit(lock);
            /* Perform arbitrary JVMTI/JNI work here to do post-GC cleanup */
            if(!heapCheck) {
                heapCheck = true;
                jint        count;
                jclass    *classes;
                CJVMTIE(jvmti, jvmti->GetLoadedClasses(&count, &classes));
                ClassDetail *details = (ClassDetail*)calloc(sizeof(ClassDetail), count);
                for(int i = 0; i < count; i++) {
                    char *sig;
                    CJVMTIE(jvmti, jvmti->GetClassSignature(classes, &sig, NULL));
    CFN(sig);
    details[i] = ClassDetail(strdup(sig));
    CJVMTIE(jvmti, jvmti->SetTag(classes[i], (jlong)(ptrdiff_t)(void*) (&details[i])));
    heapSize = 0;
    CJVMTIE(jvmti, jvmti->IterateOverHeap(JVMTI_HEAP_OBJECT_EITHER, &heapObject, NULL));
    std::cout << "Heap Memory : " << heapSize<<'\n';
    heapCheck = false;
    static void vmInit(jvmtiEnv jvmti, JNIEnv jni, jthread thread) {
    jclass clazz = jni->FindClass("java/lang/Thread");
    jmethodID mid = jni->GetMethodID(clazz, "<init>", "()V");
    jthread _thread = jni->NewObject(clazz, mid);
    CJVMTIE(jvmti, jvmti->RunAgentThread(_thread, &worker, NULL, JVMTI_THREAD_MAX_PRIORITY));
    static void startGCEvent(jvmtiEnv *jvmti) {
    static void finishGCEvent(jvmtiEnv *jvmti) {
    std::cout << "****************************************************************** <<<<<<<<<<<< Finito gc\n";
    gc_count++;
    CJVMTIE(jvmti,jvmti->RawMonitorEnter(lock));
    CJVMTIE(jvmti,jvmti->RawMonitorNotify(lock));
    CJVMTIE(jvmti,jvmti->RawMonitorExit(lock));
    static jvmtiIterationControl JNICALL heapObject(jlong tag, jlong size, jlong* tag_ptr, void* userData) {
    if(tag != (jlong) 0) {
    std::cout << "Tag : " << tag<< '\n';
    ClassDetail detail = (ClassDetail) (void*) (ptrdiff_t) tag;
    char *sig = detail->getSignature();
    std::cout << "Class " << sig << " size : " << size<<'\n';
    heapSize += size;
    return JVMTI_ITERATION_CONTINUE;
    -- ClassDetail.cpp --class ClassDetail {
    private:
    char* signature;
    public:
    ClassDetail(char* signature){
    this->signature = signature;
    char* getSignature() { return this->signature;}
    --Makefile--########################################################################
    # Sample GNU Makefile for building JVMTI Demo waiters
    # Example uses:
    # gnumake JDK=<java_home> OSNAME=solaris [OPT=true] [LIBARCH=sparc]
    # gnumake JDK=<java_home> OSNAME=solaris [OPT=true] [LIBARCH=sparcv9]
    # gnumake JDK=<java_home> OSNAME=linux [OPT=true]
    # gnumake JDK=<java_home> OSNAME=win32 [OPT=true]
    # Source lists
    LIBNAME=analizer
    SOURCES=analizer.cpp
    MYSQLPP_LIB_PATH=/home/claudio/Desktop/Scaricati2/mysql++-3.0.6/mysqlpp_lib/lib/
    MYSQLPP_HEADER_PATH=/home/claudio/Desktop/Scaricati2/mysql++-3.0.6/mysqlpp_lib/include/mysql++
    MYSQL_PATH=/opt/mysql-5.0.51a-linux-i686-icc-glibc23
    # Solaris Sun C Compiler Version 5.5
    ifeq ($(OSNAME), solaris)
    # Tell gnumake which compilers to use
    CC=cc
    CXX=CC
    # Sun Solaris Compiler options needed
    COMMON_FLAGS=-mt -KPIC
    # Check LIBARCH for any special compiler options
    LIBARCH=$(shell uname -p)
    ifeq ($(LIBARCH), sparc)
    COMMON_FLAGS+=-xarch=v8 -xregs=no%appl
    endif
    ifeq ($(LIBARCH), sparcv9)
    COMMON_FLAGS+=-xarch=v9 -xregs=no%appl
    endif
    ifeq ($(OPT), true)
    CXXFLAGS=-xO2 $(COMMON_FLAGS)
    else
    CXXFLAGS=-g $(COMMON_FLAGS)
    endif
    # Object files needed to create library
    OBJECTS=$(SOURCES:%.cpp=%.o)
    # Library name and options needed to build it
    LIBRARY=lib$(LIBNAME).so
    LDFLAGS=-z defs -ztext
    # Libraries we are dependent on
    LIBRARIES= -lc
    # Building a shared library
    LINK_SHARED=$(LINK.cc) -G -o $@
    endif
    # Linux GNU C Compiler
    ifeq ($(OSNAME), linux)
    # GNU Compiler options needed to build it
    COMMON_FLAGS=-fno-strict-aliasing -fPIC -fno-omit-frame-pointer
    # Options that help find errors
    COMMON_FLAGS+= -W -Wall -Wno-unused -Wno-parentheses
    ifeq ($(OPT), true)
    CXXFLAGS=-O2 $(COMMON_FLAGS)
    else
    CXXFLAGS=-g $(COMMON_FLAGS)
    endif
    # Object files needed to create library
    OBJECTS=$(SOURCES:%.cpp=%.o)
    # Library name and options needed to build it
    LIBRARY=lib$(LIBNAME).so
    LDFLAGS=-Wl,-soname=$(LIBRARY) -static-libgcc -mimpure-text
    LDFLAGS += -lmysqlpp
    # Libraries we are dependent on
    LIBRARIES=
    # Building a shared library
    LINK_SHARED=$(LINK.cc) -shared -o $@
    endif
    # Windows Microsoft C/C++ Optimizing Compiler Version 12
    ifeq ($(OSNAME), win32)
    CC=cl
    # Compiler options needed to build it
    COMMON_FLAGS=-Gy -DWIN32
    # Options that help find errors
    COMMON_FLAGS+=-W0 -WX
    ifeq ($(OPT), true)
    CXXFLAGS= -Ox -Op -Zi $(COMMON_FLAGS)
    else
    CXXFLAGS= -Od -Zi $(COMMON_FLAGS)
    endif
    # Object files needed to create library
    OBJECTS=$(SOURCES:%.cpp=%.obj)
    # Library name and options needed to build it
    LIBRARY=$(LIBNAME).dll
    LDFLAGS=
    # Libraries we are dependent on
    LIBRARIES=
    # Building a shared library
    LINK_SHARED=link -dll -out:$@
    endif
    # Common -I options
    CXXFLAGS += -I.
    #CXXFLAGS += -I../agent_util
    CXXFLAGS += -I$(JDK)/include -I$(JDK)/include/$(OSNAME)
    CXXFLAGS += -I$(MYSQLPP_HEADER_PATH) -I$(MYSQL_PATH)/include -L$(MYSQLPP_LIB_PATH) -I$(MYSQLPP_LIB_PATH)
    # Default rule
    all: $(LIBRARY)
    # Build native library
    $(LIBRARY): $(OBJECTS)
         $(LINK_SHARED) $(OBJECTS) $(LIBRARIES)
    # Cleanup the built bits
    clean:
         rm -f $(LIBRARY) $(OBJECTS)
    # Simple tester
    test: all
         LD_LIBRARY_PATH=`pwd` $(JDK)/bin/java -agentlib:$(LIBNAME) -jar jvmti-test.jar
         #LD_LIBRARY_PATH=`pwd` $(JDK)/bin/java -agentlib:$(LIBNAME) -version
    # Compilation rule only needed on Windows
    ifeq ($(OSNAME), win32)
    %.obj: %.cpp
         $(COMPILE.cc) $<
    endif

    Did you make sure your library (call it x) starts is named libx.so (atleast, on linux, possibly libx.dll on windows, not sure)? It will not load otherwise, and you must specify -agentlib:x (rather than saying libx.so). Yes, it is "funny" how it gives the same uninformative error message for a wide variety of errors. It will also give you this same error message if there are still unresolved symbols upon loading your library (which would be my second guess).

  • Could not find selected item in LOV

    hi i follow this sample http://www.scribd.com/doc/2633296/ADF-Learning-6-Dependent-List-Boxes ,but when i select my LOV am geting this error FacesCtrlListBinding> <getInputValue> ADFv: Could not find selected item matching value 100 of type: oracle.jbo.domain.Number in the list-of-values.
    am in jdeveloper 11.1.1.6.0

    the data type am selecting is number but displaying employee name my page is,the value 100 is the employeeid is in db
    <?xml version='1.0' encoding='UTF-8'?>
    <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1"
              xmlns:f="http://java.sun.com/jsf/core"
              xmlns:h="http://java.sun.com/jsf/html"
              xmlns:af="http://xmlns.oracle.com/adf/faces/rich">
      <jsp:directive.page contentType="text/html;charset=UTF-8"/>
      <f:view>
        <af:document id="d1">
          <af:messages id="m1"/>
          <af:form id="f1">
            <af:panelHeader text="panelHeader 1" id="ph1">
              <f:facet name="context"/>
              <f:facet name="menuBar"/>
              <f:facet name="toolbar">
                <af:commandButton actionListener="#{bindings.CreateInsert.execute}"
                                  text="CreateInsert"
                                  id="cb1"/>
              </f:facet>
              <f:facet name="legend"/>
              <f:facet name="info"/>
              <af:panelFormLayout id="pfl1">
                <af:inputText value="#{bindings.DepartmentId.inputValue}"
                              label="#{bindings.DepartmentId.hints.label}"
                              required="#{bindings.DepartmentId.hints.mandatory}"
                              columns="#{bindings.DepartmentId.hints.displayWidth}"
                              maximumLength="#{bindings.DepartmentId.hints.precision}"
                              shortDesc="#{bindings.DepartmentId.hints.tooltip}"
                              id="it1" rendered="false">
                  <f:validator binding="#{bindings.DepartmentId.validator}"/>
                  <af:convertNumber groupingUsed="false"
                                    pattern="#{bindings.DepartmentId.format}"/>
                </af:inputText>
                <af:inputText value="#{bindings.EmployeeId.inputValue}"
                              label="#{bindings.EmployeeId.hints.label}"
                              required="#{bindings.EmployeeId.hints.mandatory}"
                              columns="#{bindings.EmployeeId.hints.displayWidth}"
                              maximumLength="#{bindings.EmployeeId.hints.precision}"
                              shortDesc="#{bindings.EmployeeId.hints.tooltip}"
                              id="it3" rendered="false">
                  <f:validator binding="#{bindings.EmployeeId.validator}"/>
                  <af:convertNumber groupingUsed="false"
                                    pattern="#{bindings.EmployeeId.format}"/>
                </af:inputText>
                <af:inputText value="#{bindings.Password.inputValue}"
                              label="#{bindings.Password.hints.label}"
                              required="#{bindings.Password.hints.mandatory}"
                              columns="#{bindings.Password.hints.displayWidth}"
                              maximumLength="#{bindings.Password.hints.precision}"
                              shortDesc="#{bindings.Password.hints.tooltip}"
                              id="it4">
                  <f:validator binding="#{bindings.Password.validator}"/>
                </af:inputText>
                <af:inputText value="#{bindings.UserId.inputValue}"
                              label="#{bindings.UserId.hints.label}"
                              required="#{bindings.UserId.hints.mandatory}"
                              columns="#{bindings.UserId.hints.displayWidth}"
                              maximumLength="#{bindings.UserId.hints.precision}"
                              shortDesc="#{bindings.UserId.hints.tooltip}" id="it2">
                  <f:validator binding="#{bindings.UserId.validator}"/>
                </af:inputText>
                <af:selectOneChoice value="#{bindings.DepartmentId1.inputValue}"
                                    label="#{bindings.DepartmentId1.label}"
                                    required="#{bindings.DepartmentId1.hints.mandatory}"
                                    shortDesc="#{bindings.DepartmentId1.hints.tooltip}"
                                    id="soc1" autoSubmit="true">
                  <f:selectItems value="#{bindings.DepartmentId1.items}" id="si1"/>
                </af:selectOneChoice>
                <af:selectOneChoice value="#{bindings.EmployeeId1.inputValue}"
                                    label="#{bindings.EmployeeId1.label}"
                                    required="#{bindings.EmployeeId1.hints.mandatory}"
                                    shortDesc="#{bindings.EmployeeId1.hints.tooltip}"
                                    id="soc2" partialTriggers="soc1">
                  <f:selectItems value="#{bindings.EmployeeId1.items}" id="si2"/>
                </af:selectOneChoice>
              </af:panelFormLayout>
            </af:panelHeader>
          </af:form>
        </af:document>
      </f:view>
    </jsp:root>my view is
    <?xml version="1.0" encoding="windows-1252" ?>
    <!DOCTYPE ViewObject SYSTEM "jbo_03_01.dtd">
    <!---->
    <ViewObject
      xmlns="http://xmlns.oracle.com/bc4j"
      Name="VikUserViewObj"
      Version="11.1.1.61.92"
      InheritPersonalization="true"
      SelectList="VikUser.DEPARTMENT_ID,
           VikUser.EMPLOYEE_ID,
           VikUser.PASSWORD,
           VikUser.USER_ID"
      FromList="VIKUSER VikUser"
      BindingStyle="OracleName"
      CustomQuery="false"
      PageIterMode="Full"
      UseGlueCode="false">
      <Properties>
        <SchemaBasedProperties>
          <LABEL
            ResId="model.VikUserViewObj_LABEL"/>
        </SchemaBasedProperties>
      </Properties>
      <EntityUsage
        Name="VikUser"
        Entity="model.VikUser"/>
      <ViewAttribute
        Name="DepartmentId"
        IsNotNull="true"
        PrecisionRule="true"
        EntityAttrName="DepartmentId"
        EntityUsage="VikUser"
        AliasName="DEPARTMENT_ID"/>
      <ViewAttribute
        Name="EmployeeId"
        IsNotNull="true"
        PrecisionRule="true"
        EntityAttrName="EmployeeId"
        EntityUsage="VikUser"
        AliasName="EMPLOYEE_ID"/>
      <ViewAttribute
        Name="Password"
        PrecisionRule="true"
        EntityAttrName="Password"
        EntityUsage="VikUser"
        AliasName="PASSWORD"/>
      <ViewAttribute
        Name="UserId"
        PrecisionRule="true"
        EntityAttrName="UserId"
        EntityUsage="VikUser"
        AliasName="USER_ID"/>
      <ResourceBundle>
        <PropertiesBundle
          PropertiesFile="model.ModelBundle"/>
      </ResourceBundle>
    </ViewObject>Edited by: user0994 on 2012/10/20 9:07 PM
    Edited by: user0994 on 2012/10/20 9:29 PM
    Edited by: user0994 on 2012/10/20 10:41 PM

  • Jar file could not find main class.. I cant see why?

    I have read loads of tutorials on this and it should be very straight forward but i STILL cant make a working jar file of my program.. please see if you can see anything wrong with what im doing..
    my program is one .java file that compiles perfectly, and is runnable both through eclipse and by using the command prompt.. i made a jar file using both eclipse and the command prompt, and neither worked.. every time i run it by double clicking it i get the error "could not find main class, program will exit". here is the contents of my jar:
    CorePackage\IPEmailer.class
    CorePackage\IPEmailer$1.class
    CorePackage\IPEmailer$SMTPAuthenticator.class
    META-INF\MANIFEST.MF
    the MANIFEST.MF file contains:
    Manifest-Version: 1.0
    Class-path: .
    Created-By: 1.6.0_02 (Sun Microsystems Inc.)
    Main-Class: CorePackage.IPEmailer
    (yes there is a blank line at the end)
    the class mentioned in 'Main-Class' has a main method that looks like this:
    public static void main(String[] args) {
        // TODO Auto-generated method stub
        new IPEmailer();
    }the program uses 2 external jar files:
    activation.jar
    mail.jar
    and reads a file called:
    ipemailer.ini
    and writes a file called:
    ip.txt
    the program has no GUI and is intended to run 'silently' in the background
    please help me understand what is wrong with this

    package CorePackage;
    import javax.mail.*;
    import javax.mail.Authenticator;
    import javax.mail.PasswordAuthentication;
    import javax.mail.internet.*;
    import java.util.*;
    import java.io.*;
    import java.net.*;
    public class IPEmailer implements Runnable{
          * @param args
         String recipientsinput[]={""};
         String subject;
         String body;
         String server;
         String user;
         String pass;
         String from;
         String urlString = "http://www.whatismyip.org";
         String currentIP;
         String ipFromFile;
         boolean webFailed;
         long interval = 900000; //15 mins
         long oldInterval;
         Thread t = new Thread(this);
         public static void main(String[] args) {
              // TODO Auto-generated method stub
              new IPEmailer();
         public IPEmailer(){
                         ..........etccould the problem be that the class is a thread? i cant see why it would be, but ive never made a jar where the main class also 'implements runnable'

  • Could not find the main class: SearchExcel.  Program will exit.  ????

    sekic0429{uabudd_milou}[w10/rbssw/2.0] pwd
    /tmp/MyJava/jexcelapi
    sekic0429{uabudd_milou}[w10/rbssw/2.0] printenv CLASSPATH
    /tmp/MyJava/excelapi:/app/jdk/1.6.0_16/jre/lib:/app/jdk/1.6.0_16/lib
    sekic0429{uabudd_milou}[w10/rbssw/2.0] ls
    build ExcelSearch.java index.html resources SearchExcel.java~ tutorial.html
    docs ExelSearch.java~ jxl.jar SearchExcel.class src workbook.dtd
    ExcelSearch.class formatworkbook.dtd jxlrwtest.xls SearchExcel.java TestSpecification.xls
    sekic0429{uabudd_milou}[w10/rbssw/2.0] javac -extdirs . ExcelSearch.java
    sekic0429{uabudd_milou}[w10/rbssw/2.0]
    sekic0429{uabudd_milou}[w10/rbssw/2.0] java ExcelSearch
    Exception in thread "main" java.lang.NoClassDefFoundError: ExcelSearch
    Caused by: java.lang.ClassNotFoundException: ExcelSearch
    at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
    Could not find the main class: ExcelSearch. Program will exit.
    sekic0429{uabudd_milou}[w10/rbssw/2.0] cat ExcelSearch.java
    import java.io.File;
    import java.io.IOException;
    import java.util.Date;
    import jxl.*;
    import jxl.read.biff.BiffException;
    public class ExcelSearch
    public static void main(String[] args)
    try
    Workbook workbook = Workbook.getWorkbook(new File("TestSpecification.xls"));
    catch (IOException e)
    e.printStackTrace();
    catch (BiffException e)
    e.printStackTrace();
    Regards Peter, hope for answer

    r035198x wrote:
    Where is SearchExcel.class?Excellent question, though I think I spotted a problem with the cp supplied.
    Note the documentation for -cp state (in part)
    For example, if directory foo contains a.jar and b.JAR, then the class path element foo/* is expanded to a A.jar:b.JAR, except that the order of jar files is unspecified.So instead of this..
    java -cp /tmp/MyJava/excelapi:/app/jdk/1.6.0_16/jre/lib:/app/jdk/1.6.0_16/lib SearchExcel..try this..
    java -cp /tmp/MyJava/excelapi/*:/app/jdk/1.6.0_16/jre/lib:/app/jdk/1.6.0_16/lib SearchExcelNotes:
    1) Adding the JRE classes to the classpath should not be necessary, but I left the rest of the cp unaltered to highlight the one specific difference I am suggesting.
    2) When posting code, code snippets, HTML/XML or input/output, please use the code tags. The code tags help retain the indentation and formatting of the sample. To use them, select the sample text and click the CODE button.
    If that still fails, tell us more specifically where the SearchExcel class is by copy/pasting the output (within code tags) of the command..
    prompt>jar -tvf mysearchexcel.jarWhere, of course, you replace 'mysearchexcel.jar' with the actual Jar name it is supposed to be located in.
    Edit 1:
    Changed JavaDocs -> documentation.
    Edited by: AndrewThompson64 on Jan 11, 2010 7:12 PM

  • Could not find the main class : HelloWorldApp program will exit

    please help me
    i downloaded and installed jdk-6u13-windows-i586-p(1) from sun.java.com
    in my computer --> Advanced --> environment variables --> i had set
    user variable :
    variable value
    java_home C:\Program Files\Java\jdk1.6.0_13\bin
    System variable:
    path : C:\Program Files\Java\jdk1.6.0_13\bin
    after that i wrote a program
    * The HelloWorldApp class implements an application that
    * simply prints "Hello World!" to standard output.
    class HelloWorldApp {
    public static void main(String[] args) {
    System.out.println("Hello World!"); // Display the string.
    i saved in c:\ mywork
    i compiled it with
    javac HelloWorldApp.java and then
    java HelloWorldApp
    output / result also came
    but iam unable to create jar file . when it is created it is showing
    could not find the main class : HelloWorldApp program will exit
    i created jar file by following way
    i created
    manifest.txt
    Min-Class : HelloWorldApp and then
    start -->run--> cmd-->
    c:\mywork> jar cfm test.jar manifest.txt HelloWorldApp.class
    c:\ java -jar test.jar
    but it displays a message
    " could not find the main class : HelloWorldApp program will exit "
    please please please help me please 1000's of please help me

    Peter__Lawrey wrote:
    You have to specify the manifest with a special option (I think its was -M)
    Otherwise the jar will create one (even if you provide it)No, the text file passed as a parameter will be incorporated in the manifest file generated by the JAR tool.
    @OP: This will work:
    JarTest.java
    public class JarTest {
      public static void main(String[] args) {
        System.out.println("JarTest works!");
    }manifest.txt
    Main-Class: JarTest+(note there is an extra new line in the manifest.txt!)+
    Now execute these commands:
    javac JarTest.java
    jar cfm MyJar.jar manifest.txt JarTest.class
    java -jar MyJar.jar And on my machine, the string "JarTest works!" is displayed on the screen.
    And if you look in the MANIFEST.MF file inside your jar file (you can use almost any zip-utility for this), you will see the following:
    Manifest-Version: 1.0
    Created-By: 1.6.0_0 (Sun Microsystems Inc.)
    Main-Class: JarTestOr something similar.

  • Could not find the main class. Program will exit!

    I have created many Executable Jar files before, and this one I did the same. When I run the jar file, (Clicking on it) I get the "Could not find the main class. Program will exit!" error message. When I run the jar file through DOS I get this Stack trace:
    Exception in thread "main" java.lang.NoClassDefFoundError: javax/media/ControllerListener
    at java.lang.ClassLoader.defineClass0(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:509)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:246)
    at java.net.URLClassLoader.access$100(URLClassLoader.java:54)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:193)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:186)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:265)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:262)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:322)
    Any Ideas? I did a search on google, and looks like others have had this problem but found no answer.
    US101

    There could be several reasons for getting this "Could not find main class" error message. From your stack trace it looks like the class javax/media/ControllerListener is not in your class path. Make sure your manifest file has a line like this:
    Class-Path: pathToTheJarFileWithControllerListenerClass.jar otherJars.jar
    This error message is also generated whenever any static initialization errors out giving the misleading error message implying that there is something wrong with the main class. Prior to starting your main class, static initialization of any static variables takes place. In my case, I was initializing a resource bundle, and forgot to include the property file in my building of the jar file. Well this failed of course and the generic error message appeared. It took many long hours to figure out it didn't have anything to do with the manifest file or the main class itself.
    HTH,
    John Bender

  • Could not find the main class: projectRFID.ProjectGUI. Program will exit.

    Hello,
    I'm quite new in Java. I have an application with GUI. When I'm using Eclipse version 3.4.0 to run the application, all it is working perfect.
    But after I generate the jar from Eclipse, using the manifest file option from there and added the ProjectGUI to it, where is the main class, and try to run from the command line I receive the next error:
    root@slax:~/workspace# java -jar rfid.jar
    Exception in thread "main" java.lang.NoClassDefFoundError: projectRFID/ProjectGUI
    Caused by: java.lang.ClassNotFoundException: projectRFID.ProjectGUI
    at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
    Could not find the main class: projectRFID.ProjectGUI. Program will exit.
    root@slax:~/workspace#
    I run this application on a SLAX system with jdk6 update 7.
    I tried to generate the jar file even from the command line using the manifest file option but I still receive the same error.
    I hope somebody can help me!
    Thank you!

    cojogrizli wrote:
    The structure of my project in Eclipse is src/project/files.java and in jar file is src/files.java bin/class.java Dati/ and META-INF/.That's wrong. You don't need the .java files in the jar (but you can have them, if you want, they are just not used by Java).
    And each .class file must be in a directory that reflects its package. So in your example ProjectGUI.class must be in the directory projectRFID/ inside the .jar file.

  • Could not find the main class - Problem with Webservice-Access

    Hello Everybody,
    I'm having serious Problems with accessing a WebService (Tomcat-Axis) per executable jar-File.
    I constructed a simple GUI with 3 Textboxes 1 Button and 1 Resultbox.
    I use eclipse so it was no Problem to simple generate the Backgroundclient by Processing the .wsdl-File of the WS.
    Now I do this:
    Head_tServiceLocator serviceLocator = new Head_tServiceLocator();
    Head_t service = serviceLocator.getRPCCall();
    RPCCallSoapBindingStub Head_t = (RPCCallSoapBindingStub) service;and use the Webservice like an Object.
    All this works very well.
    Now the Problem:
    Head_t service = serviceLocator.getRPCCall();this Line has to throw a ServiceException.
    If i add a try-catch Block to Process the Message JAVA tells me after i exported to JAR (with Manifest-stuff and so on) and double Click on the JAR the following :
    Could not find the main Class - Program will exit.
    And if i add a throws Declaration to the Methodheader it tells me:
    Fatal Exception Occured - Program will exit
    But if i Comment out that Line at least the GUI is being displayed (so it DOES find the main-Class). But then of course the Webservice won't be accessed.
    All the JARs needed (axis.jar, commons-discovery.jar and so on) are in the same Directory as the Webservice-Client.jar
    Please Help me.
    Greets,
    Zap

    I am not done any typing mistake while creating the jar file i already followed the suggestion that you have mentioned but still the same error .
    This is my MANIFEST.MF file created under META-INF folder
    Manifest-Version: 1.0
    Class-Path: qtjambi-4.4.3_01.jar qtjambi-win32-msvc2005-4.4.3_01.jar
    Created-By: 1.5.0 (Sun Microsystems Inc.)
    Main-Class: Ui_MainWindow
    When i extracted the app.jar following this i got
    1. META-INF folder inside that MAINFEST.MF file the contents i have already placed above
    2. qtjambi-4.4.3_01.jar
    3. qtjambi-win32-msvc2005-4.4.3_01.jar
    4. Ui_MainWindow.class
    Please tell me whats wrong in that i can also give you the app.jar file please let me know the email id ..

Maybe you are looking for