File objects in jar file

Hi!
Is their some kind of way one can use File objects in a jar file plz? I have a project which is complete and working well on the IDE but now that I have jarred it, i've come to realize that apparently file objects do not relate well with .jar files. The problem is that the program makes a lot of file manipulations and changing everything to getResource, InputStream etc would be very lengthy. So there's absolutely no way in which one can use File objects in jar files?
Any help would be very much appreciated!
Thanks and regards,
Krt_Malta

You can use the java.net.JarURLConnection class (use file:/// when creating the URL) to get a URL to a jar entry, create a URI from the URL, and then create a File object on the URI.
Or use java.util.jar.JarFile methods and its associated classes to get jar entry contents.
While you can use these approaches to create File objects from a jar, they are not any easier than what's already been mentioned.
And all you can do is read or delete a jar - jar entries can't be rewritten.

Similar Messages

  • Difference b/w PAR & JAR Files

    hi,
    i m new to enterprise portal(EP),what is a use of PAR file in portal appl , what is the difference b/w PAR & JAR files,why cant we can use JAR file.
    thank in advance naresh

    Hi,
    In computing, a JAR file (or Java ARchive) is used for aggregating many files into one. It is generally used to distribute Java classes and associated metadata.
    1) WAR (file format) (Web Application aRchive) files are also Java archives which store XML files, java classes, Java Server Pages and other objects for Web Applications.
    2) RAR (Resource Adapter aRchive) files, not to be confused with the RAR (file format), are also Java archives which store XML files, java classes and other objects for J2EE Connector Architecture (JCA) applications.
    3)EAR (file format) (Enterprise ARchive) files are composite Java archives which combine XML files, java classes and other objects including JAR, WAR and RAR Java archive files for Enterprise Applications.
    JAR files can be created and extracted using the "jar" command that comes with the JDK. It can be done using zip tools, but as WinZip has a habit of renaming all-uppercase directories and files in lower case, this can raise support calls with whoever created the JAR or the tool authors themselves. WinRAR, on the other hand, retains the original case of filenames.
    A JAR file has an optional manifest file located in the path META-INF/MANIFEST.MF. The entries in the manifest file determine how the JAR file will be used. JAR files which are intended to be executed as standalone programs will have one of their classes specified as the "main" class. The manifest file would have an entry such as
    Portal applications are packaged in PAR (Portal Archive) files. A PAR file is a standard ZIP file with a .par extension that contains a deployment descriptor, all Java classes, Web resources and other files required to run the application.
    Within the portal, the name of the PAR file is the name of the application. The fully qualified name of any component or service defined in the PAR is the name of the PAR file, followed by a period (.) and then the name of the component or service.
    A PAR file contains the following files:
    The following files are contained files contained in a PAR file are divided into the following types:
    ●     Web resources
    All files in a PAR file that are accessible directly via an HTTP request, such as:
    ○     HTML
    ○     Images
    ○     Stylesheets (.css)
    Web resource files can be located anywhere outside the top-level PORTAL-INF and META-INF folders.
    You can create links to these files directly. For more information, see Creating URLs to Web Resources.
    ·        Java Classes and Deployment Descriptor
    Java classes that implement the component and services defined in the PAR file, plus the deployment descriptor (portalapp.xml). The deployment descriptor specifies the components and services contained in the PAR file, and defines the configuration for the application, components and services. For more information the deployment descriptor, see Deployment Descriptor (portalapp.xml).
    The PAR file’s Java classes and deployment descriptor are located in the top-level PORTAL‑INF folder
    ·        Manifest
    A PAR can also include a manifest file (MANIFEST.MF in the top-level META-INF folder), which provides version information. The folder and file are not required, but are recommended for tracking versions of your application.
    in enterprise portal we use mainly EAR as jar files.
    to import EAR files you need to follow this steps
    goto
    system administration -> Transport -> Transport Packages -> import -> choose client or server on your convinence and browse to this file and press upload and then after uploading press import
    for PAR files you need to follow this steps
    goto
    system administration -> support -> Support Desk -> in Top Level Areas selcet portal runtime -> in "Portal Anywhere" Admin Tools select Administration Console -> in Upload Archive Specify a Portal Archive (PAR) file and choose 'Upload' to store the PAR in the PCD-> browse the file and press upload.
    ************please reward points if the information is helpful to you************

  • OpenScript/How to add .jar file to Java Code in relative path

    Hi all,
    I want to add a .jar file which can be executed separately (like "java -jar A.jar") to my recorded Java Code.I've read this wiki http://everest2.us.oracle.com/wiki/Generic_JAR_Project about how to add a .jar file to "Assets", however, I cannot figure out how to use the .jarr file in Java code,I mean , how to get this .jar file like the method the databank added in "Assets"?
    Things I did are as followed:
    1.Execute my .jar file in OpenScript Java code with absolute path like this:
    String cmd = "C:\Users\A.jar";
    Runtime.getRuntime().exec(cmd);
    This does work, but must set a absolute path in Java code like "C:\User\A.jar" ,which is not the workaround I want (I need my scripts can be run on other machines).
    2.Try to get its current path with following codes:
    File directory = new File(".");
    String currentPath=directory.getCanonicalPath();
    However,though this can get its absolute path (which is the the project path) in Eclipse like "C:\Users\Workspace\testProject", this only gets "C:\OracleATS\openScript" in OpenScript.
    I thought to copy my .jar file to the project path , got its current path in java code first,then can know the path of .jar file, but this workaround failed because of the above reason.
    I notice that in the "Assets" there are "Databanks","Object Libraries","JAR Files","Scripts". Since the databanks and scripts that added to "Databanks" and "Scripts" can be got or run in Java Code like:
    *getDatabank("DatabankName").getNextDatabankRecord(); String data = eval("{{db.DatabankName.data}}");*
    *or getScript("ScriptName").run();*
    *Is there a method to get and run the jar file added to "Assets\JAR Files" like the above?*
    Thank you very much!
    Regards,
    Angyoung

    Hi DM,
    Thanks for your reply!
    I've found a workaround,which is calling OpenScript's APIs ,such as this.getScriptPackage().getRepository() and this.getScriptPackage().getWorkspace(),etc to locate the .jar file.
    And this workaround can still work even though the script is run on other machine.
    Sorry to reply you so late!
    Regards,
    Angyoung

  • How to use RMI objects in a servlet

    Hi,
    I have just run the example RMI program in the java tutorial in my linux pc. Also I have another method to just echo a string back. It works fine when calling from command line.
    Now I want to write a servlet that get a string when POSTed and call the RMI objects echo method and display the returned string.
    I use Tomcat-5.0 which is installed in /usr/local. I moved the remote object interface jar to the common/lib folder and import the interface in my Servlet. I use the following statements inside the servlet to get the RMI object reference.
                Registry registry = LocateRegistry.getRegistry("localhost");
                Rser comp = (Rser) registry.lookup("rmiser");When i use this in my servlet the tomcat stops working.
    Also I don't know how to specify the code base and security policy which I use in command prompt when calling RMI object.
    Pls suggest me what to do and also specify any resources that explain this task step by step.
    Thanks.

    restarted the system and caught the following exception while calling the servlet.
    Apr 30, 2009 12:24:15 PM org.apache.catalina.startup.Catalina start
    INFO: Server startup in 3861 ms
    java.security.AccessControlException: access denied (java.net.SocketPermission 127.0.0.1:1099 connect,resolve)
         at java.security.AccessControlContext.checkPermission(AccessControlContext.java:323)
         at java.security.AccessController.checkPermission(AccessController.java:546)
         at java.lang.SecurityManager.checkPermission(SecurityManager.java:532)
         at java.lang.SecurityManager.checkConnect(SecurityManager.java:1034)
         at java.net.Socket.connect(Socket.java:513)
         at java.net.Socket.connect(Socket.java:469)
         at java.net.Socket.<init>(Socket.java:366)
         at java.net.Socket.<init>(Socket.java:180)
         at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(RMIDirectSocketFactory.java:22)
         at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(RMIMasterSocketFactory.java:128)
         at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:595)
         at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:198)
         at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:184)
         at sun.rmi.server.UnicastRef.newCall(UnicastRef.java:322)
         at sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source)
         at RequestParamExample1.doGet(RequestParamExample1.java:94)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
         at filters.ExampleFilter.doFilter(ExampleFilter.java:101)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:186)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
         at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
         at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152)
         at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
         at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:462)
         at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
         at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118)
         at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
         at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)
         at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
         at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
         at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
         at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
         at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
         at java.lang.Thread.run(Thread.java:619)
    Apr 30, 2009 12:25:19 PM org.apache.coyote.tomcat5.CoyoteAdapter service
    SEVERE: An exception or error occurred in the container during the request processing
    java.security.AccessControlException: access denied (java.lang.RuntimePermission setContextClassLoader)
         at java.security.AccessControlContext.checkPermission(AccessControlContext.java:323)
         at java.security.AccessController.checkPermission(AccessController.java:546)
         at java.lang.SecurityManager.checkPermission(SecurityManager.java:532)
         at java.lang.Thread.setContextClassLoader(Thread.java:1351)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:151)
         at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118)
         at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
         at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)
         at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
         at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
         at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
         at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
         at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
         at java.lang.Thread.run(Thread.java:619)
    Exception in thread "ContainerBackgroundProcessor[StandardEngine[Catalina]]" java.security.AccessControlException: access denied (java.lang.RuntimePermission setContextClassLoader)
         at java.security.AccessControlContext.checkPermission(AccessControlContext.java:323)
         at java.security.AccessController.checkPermission(AccessController.java:546)
         at java.lang.SecurityManager.checkPermission(SecurityManager.java:532)
         at java.lang.Thread.setContextClassLoader(Thread.java:1351)
         at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1623)
         at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1608)
         at java.lang.Thread.run(Thread.java:619)
    Hope u can find it now.
    the line
    at RequestParamExample1.doGet(RequestParamExample1.java:94)
    is the file I am editing and using to call RMI.
    Edited by: itsraja on Apr 30, 2009 12:06 AM

  • Where is BusinessObjects Enterprise Java SDK jars located(BO XI3.1)?

    We need to import Business Objects Enterprise Java SDK's jar files. However, there is no document or forum post that have the directory for version BOXI3.1.
    By searching for the cecore.jar file, we find a directory that contains many Business Objects Enterprise Java SDK jar files:
    D:\Business Objects\BusinessObjects Enterprise 12.0\warfiles\WebApps\BusinessProcessBI\WEB-INF\lib
    Is this the correct directory for the Business Object Enterprise jar files?
    We imported bellow SDK jar files:
    asn1.jar
    cecore.jar
    celib.jar
    ceplugins_client.jar
    ceplugins_core.jar
    ceplugins_cr.jar
    cereports.jar
    certj.jar
    cesession.jar
    ceutils.jar
    clientplugins.jar
    commons-codec-1.3.jar
    commons-logging-1.1.jar
    corbaidl.jar
    ebus405.jar
    flash.jar
    freessl201.jar
    jsafe.jar
    logging.jar
    pluginhelper.jar
    postprocessing_oca2service.jar
    publishing_oca2service.jar
    rasapp.jar
    rascore.jar
    reporttemplate.jar
    serialization.jar
    SL_plugins.jar
    webreporting.jar
    xbean.jar
    xcelsius.jar
    XcelsiusSLPlugins.jar
    Is this the complete list that we should import for X3.1? there are some files like commons-codec-1.3.jar, it looks a Apache jar file, not the SDK's jar file. shall i include such files as well?

    Don't know why I see this error when I am creating the SessionMgr object even though I have the CrystalDecisions.Enterprise.Framework and CrystalDecisions.Enterprise.InfoStore referenced:
    SessionMgr sessionMgr = new SessionMgr();
    Retrieving the COM class factory for component with CLSID {E063B04A-CB8B-460E-99D0-F7D8FA2FAAA2} failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)).

  • Packaging Business Domain Objects for Shared Use?

    Hi:
    I am trying to figure out how best to package a number of ADF Entity Objects so that they are shared by multiple developers and applications. Reading the JDev documentation it looks like the appropriate method is to create a System Library and place these objects into JAR files in the library. Is this the right approach?
    If so, other questions follow. It looks like 10.1.3 has replaced "system libraries" with "extension libraries". True? Regardless, when I go into Tool -> Manage Libraries and choose <New>, the only type of library that is available to create is a "User" one.
    Any guidance appreciated.
    Johnny Lee

    Thanks, Shay. That was the perfect answer to the second part of my question. Michael's post really is awesome. One of the things we are most looking forward to with the production 10.1.3 release is the completion of the documentation. For future reference, I think it would be useful to separate the release schedule of the help text from the application. The value of clear information is much greater than minor bug fixes or feature enhancements, IMHO.
    But to the first question, it would still be helpful to hear from folks how they are organizing their ADF components. The small version of this question is whether or not packaging entity objects into jar files in external libraries makes sense. Yes/no?
    The larger question (and I admit to showing my inexperience here) has to do with organizing the hierarchical structure of a moderate sized ADF application (Faces & Business Components). We are using CVS as our repository and so far the two developers have been working on separate parts of the application, creating their pieces within JDev and then uploading them into CVS. So CVS has all of these modules that reflect individual JDev projects, but no overall structure of how the different pieces relate to one another. Now we're starting to look at sharing components and it's becoming clear that we need to get a little more organized.
    So, some specific questions (for anyone who would like to respond):
    1) How do you lay out your ADF application source hierarchies?
    2) Do you reflect your package structure within your directory structure?
    3) Where do you maintain your hierarchy? If you use version control, are your repository and working copies the only places you keep your source, or do you maintain an external central directory structure?
    4) Are there things about structuring an ADF Faces/BC application that are different from standard J2EE applications?
    5) Have you found particular posts, articles or examples helpful?
    Thanks.
    Johnny Lee

  • Create a File object from a file in a .jar

    i looked for 2 hours...
    i tired this:
    URL url =  MyClass.class.getResource("filename.dat");
    File file = new File(url.getFile());i give up.

    The problem is that the file inside a Jar file is not
    a file. The jar file just contains a stream of bytes
    in the format needed to make the Jar file. Jar files
    are not folders like in the directory. So to get at
    the contents of the Jar file you need to read the Jar.
    The getResource method returns the URL which is a
    file URL, but this only works because Java has
    handlers that deal with getting the contents from a
    Jar file based on this type of URL. A URL cannot
    just be made into a file. I'm not sure that the File
    object can handle this type of file URL (I guess not
    or we wouldn't be having this discussion). So really
    it just depends what you want do. If you want to
    extract the file, just read the data in from the
    inputstream gotten from the URL, or better just call
    getResourceAsStream(), and read the bytes into an
    array. After this, you can do whatever, write it as
    a file to the hard drive, convert to a string, get
    the size based on the array length. makes sense, but how could i get an InputStream into an array, dont i need the size of the array first? and i dont think i can use InputStream.available()to figure it out... i tired downcasting to a FileInputStream yet no avail.

  • Packaging POF object class in a jar file

    I have the following issue packaging a POF class.
    I have two POF classes which are defined in the package oracle.communications.activation.asap.ace;
    1. Token.java
    2. Asdl.java
    For simplicity i package them in the coherence.jar along with the other nessary artifacts.
    "tokens-pof-config.xml"
    <?xml version="1.0"?>
    <pof-config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns="http://xmlns.oracle.com/coherence/coherence-pof-config"
    xsi:schemaLocation="http://xmlns.oracle.com/coherence/coherence-pof-config coherence-pof-config.xsd">
    <user-type-list>
    <!-- coherence POF user types -->
    <include>coherence-pof-config.xml</include>
    <!-- com.tangosol.examples package -->
    <user-type>
    <type-id>1001</type-id>
    <class-name>Token</class-name>
    </user-type>
    <user-type>
    <type-id>1002</type-id>
    <class-name>Asdl</class-name>
    </user-type>
    </user-type-list>
    <allow-interfaces>true</allow-interfaces>
    <allow-subclasses>true</allow-subclasses>
    </pof-config>
    Then I startup the CacheServer it startsup fine. However when I invoke the POF classes from my weblogic artifacts I get the following error message.
    <Oct 26, 2011 10:04:24 PM PDT> <Warning> <EJB> <BEA-010065> <MessageDrivenBean threw an Exception in onMessage(). The exception was:
    (Wrapped) java.io.IOException: unknown user type: oracle.communications.activation.asap.ace.Token.
    (Wrapped) java.io.IOException: unknown user type: oracle.communications.activation.asap.ace.Token
    ======================================================================================================================
    If I however define the classes in the default package or no package instead of package oracle.communications.activation.asap.ace;
    Keeping everything else the same everything works fine.
    ====================================================================================
    What do I need to do to make this work if I am packaging my POF classes not in the default package ?

    Hi JK,
    Well i have modified my POF classes since then and now created a package for them before I was just playing around and had them defined in a default package.
    Second Baby steps here, once I get things working by packaging things in the coherence.jar file I will create my own jar artifact and add it to class path. As it is I have classpath issues. ...
    So as I mentioned earlier.
    I created the oracle/communications/activation/asap/ace directory added my two POF classes to it and then repackaged the jar.
    It returns this error!
    2011-10-27 06:48:03.355/4.696 Oracle Coherence GE 3.6.0.4 <Error> (thread=main, member=1): Error while starting service "DistributedCache": (Wrapped) (Wrapped: error configuring class "com.tangosol.io.pof.ConfigurablePofContext") java.lang.NoClassDefFoundError: oracle/communications/activation/asap/ace/Token (wrong name: Token)
    So any ideas ?
    "tokens-pof-config.xml"
    ==============
    <?xml version="1.0"?>
    <pof-config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns="http://xmlns.oracle.com/coherence/coherence-pof-config"
    xsi:schemaLocation="http://xmlns.oracle.com/coherence/coherence-pof-config coherence-pof-config.xsd">
    <user-type-list>
    <!-- coherence POF user types -->
    <include>coherence-pof-config.xml</include>
    <!-- com.tangosol.examples package -->
    <user-type>
    <type-id>1001</type-id>
    <class-name>oracle.communications.activation.asap.ace.Token</class-name>
    </user-type>
    <user-type>
    <type-id>1002</type-id>
    <class-name>oracle.communications.activation.asap.ace.Asdl</class-name>
    </user-type>
    </user-type-list>
    <allow-interfaces>true</allow-interfaces>
    <allow-subclasses>true</allow-subclasses>
    </pof-config>
    cache-server.sh_
    #!/bin/sh
    # This will start a cache server
    # specify the Coherence installation directory
    COHERENCE_HOME=.
    # specify the JVM heap size
    MEMORY=512m
    if [ ! -f ${COHERENCE_HOME}/bin/cache-server.sh ]; then
    echo "coherence.sh: must be run from the Coherence installation directory."
    exit
    fi
    if [ -f $JAVA_HOME/bin/java ]; then
    JAVAEXEC=$JAVA_HOME/bin/java
    else
    JAVAEXEC=java
    fi
    #JAVA_OPTS="-Xms$MEMORY -Xmx$MEMORY -Dtangosol.pof.enabled=true -Dtangosol.pof.config=tokens-pof-config.xml"
    #JAVA_OPTS="-Xms$MEMORY -Xmx$MEMORY -Dtangosol.coherence.clusteraddress=224.3.6.0 -Dtangosol.coherence.clusterport=3059"
    JAVA_OPTS="-Xms$MEMORY -Xmx$MEMORY"
    #JAVA_OPTS="-Xms$MEMORY -Xmx$MEMORY"
    $JAVAEXEC -server -showversion $JAVA_OPTS -cp "$COHERENCE_HOME/lib/coherence.jar:." com.tangosol.net.DefaultCacheServer $1
    Token.java for example (Asdl.java looks very similar)
    ================================
    package oracle.communications.activation.asap.ace;
    import java.io.IOException;
    import java.io.Serializable;
    import com.tangosol.io.pof.PortableObject;
    import com.tangosol.io.pof.PofReader;
    import com.tangosol.io.pof.PofWriter;
    import java.sql.*;
    import java.util.Enumeration;
    * This class represents the domain object Token. This class is also packaged on the classpath
    * for the Cache-Server when it starts up. The Token class implements the PortableObject format.
    * @author Ankit Asthana
    public class Token implements PortableObject {
         * The state associated with a token
         * 1 - Unassigned, 2 - Available, 3 - Reserved, 4 - defunct
         private int state;
         * The network ID associated with each token
         private String neID;
         * Unique Token ID, used to identify Tokens
         private String tokenID;
         * State of the token possible
         public static int TOKEN_AVAILABLE = 2;
         public static int TOKEN_RESERVED = 3;
         * The following are static final indices required for the implementation
         * for a POF object, they have to be sequential in order.
         public static final int TOKENID = 0;
         public static final int STATE = 1;
         public static final int NEID = 2;
         * setter Method for state of the token
         * @param state
         public void setState(int state) {
              this.state = state;
         * getter Method for the state of the token
         * @return
         public int getState() {
              return state;
         * setter Method for the network ID
         * @param neID
         public void setNeID(String neID) {
              this.neID = neID;
         * getter Method for the network ID
         * @return
         public String getNeID() {
              return neID;
         * returns the TokenID for the current token
         * @return
         public String getTokenID() {
              return tokenID;
         * Default Constructor required by POJO's, Do not remove!
         public Token() {
         * This is a utility method and returns the state of the token in a String format using the
         * integer value representing the state of the token passed to it.
         * @param tokenStateInteger
         * @return
         public static String tokenToString(int tokenStateInteger) {
              if (tokenStateInteger == TOKEN_AVAILABLE)
                   return "Available";
              else if (tokenStateInteger == TOKEN_RESERVED)
                   return "Reserved";
              return "Unknown";
         * Parameterized constructor for a token.
         * Can be used to initialize a token with the following parameters
         * @param tokenID: Unique ID representing the Token
         * @param state: The state for the token, by default available
         * @param neID: The network ID this token associates to
         public Token(String tokenID, int state, String neID) {
              this.state = state;
              this.tokenID = tokenID;
              this.neID = "" + neID;
         // ----- PortableObject interface ---------------------------------------
         * The readExternal method is required for the implementation of the POF portableObject.
         * This method is used for serialization purposes
         * {@inheritDoc}
         public void readExternal(PofReader reader) throws IOException {
              tokenID = reader.readString(TOKENID);
              state = Integer.parseInt(reader.readString(STATE));
              neID = reader.readString(NEID);
         * The writeExternal method is required for the implementation of the POF portableObject.
         * This method is used for de-serialization purposes
         * {@inheritDoc}
         public void writeExternal(PofWriter writer) throws IOException {
              writer.writeString(TOKENID, tokenID);
              writer.writeString(STATE, Integer.toString(state));
              writer.writeString(NEID, neID);
    Edited by: 807103 on Oct 27, 2011 8:55 AM
    Edited by: 807103 on Oct 27, 2011 9:00 AM

  • Create  object for a class in jar file

    Hi
    I am using Oracle JDeveloper 10g. I have created a main application using Swing/JClient technologies. I am facing a problem for the past one week. I let u all people know my problem and I kindly request you to send a solution if known possibly confirmed.
    Problem: I have created a main application using swing that class extends JFrame. This main application consists of two parts. One left side panel and one right side panel. Left side panel contains JTree component. Each item in that tree refers to a class file located in a separate jar file.i.e that acts as a separate application. If we are executing separately that jar file class, I am able to see that small application running. If I am selecting an item in JTree during runtime, I should place that small application from the respective jar file in the right side panel of the main application. I can locate the jar file and even I can create object to that particular class file. But I cannot execute the application even separately and also not able to place in the right side panel of the main application.
    Note: The small application from the jar file contains one class file containing main method. That class file extends JPanel and implements JUPanel. i.e., with data binding. I am trying to create an object for this class file with data binding from my main application. Navigation bar is used in the main class file.
    If possible can any provide me solution at the earliest. Waiting eagerly for the positive reply.
    Regards,
    s.senthilkumar

    Can you sure that there is only a A class in the classpath of Tomcat, I advise you to add
    some statements into the A class so that you can be sure which classloader is used
    to load the A class.

  • Can I make a RandomAccessFile object from file in jar?

    There is some files in jar.
    I googled some articles that include how to make a input stream of a file in jar.
    I wonder if I can make a RandomAcessFile object from that file?
    ~may the force be with you~

    Shiny is all about highlights and contrast, and maybe reflections.  Sometimes a curve with a 'W' shape can do the job, but probably better to add highlights by painting with white on a new layer, blurring and reducing contrast.   If you upload your picture, it will be much easier to advise on the best route.

  • Pass a object from one jar to another jar file

    I have a common jar file which will communicate to the server for data validation purpose.But after validation it has to invoke different different jar file based on its response from the server.So, I might have a object which has to pass from the common jar file to a specific jar file.So, I like to know what will be the best procedure to achieve it.
    Please help me out.

    arpitak wrote:
    Yes,jar file holds class files.one of class files wants to trigger a method of a class file which resides in different jar file.this is the situation I tried to describe.Let consider there are three jar files like JAR A,JAR B ,JAR C.Here JAR A is a common jar where other two jar could be used as a plug in. So based on the condition any one of them (JARS) will be triggered by the common jar(JAR A).this is the situation.The class file of JAR A will trigger some method or main method of the JAR B/JAR C.So,here how could I pass a object from one jar to another is my main question.
    Is it clear now?
    I need a solution for this very urgently.Are you looking for a plug-in framework? That is, dynamically discovering and loading plugins. I am not experienced in developing or using plugins. However Googling "java plugin" brings up JPF.
    If you just have multiple jars that have different classes, the JVM will load the appropriate classes if it can find the jars through the standard classloader on the classpath or through a customer classloader.

  • Can I use addAuditTrailEntry(String message, Object detail) in a jar file?

    I have a lot of jar libraries that I need to import into my BPEL process. It's not practical for me to copy all the code flatly into an embedded java / bpelx.
    How can I call the addAuditTrailEntry method inside the classes in my jar file?
    e.g.
    I import libraries.jar at the top of my .bpel file.
    In my embedded java I do:
    MyClass myclass = new MyClass();
    myclass.doSomething();
    In the public void doSomething() method I would like to write to the audit trail directly. Currently I am simply having the doSomething() method return a String with a summary of everything it has done. This is not good enough because the method takes a long time to complete and I need a running audit trail so that I can take actions depending on what is going on in it.
    I can't seem to find the documentation... I assume in my MyClass.class I will need to import some bpel jars so that it can comprehend what a bpel process is... then pass the current process instance into the MyClass file so that it can call its addAuditTrailEntry method... is this right?
    I envision something like:
    import orabpeljars.jar
    public MyClass(BPELProcess process)
    process.addAuditTrailEntry("In MyClass Constructor");
    ------------------------------------------

    I have a lot of jar libraries that I need to import into my BPEL process. It's not practical for me to copy all the code flatly into an embedded java / bpelx.
    How can I call the addAuditTrailEntry method inside the classes in my jar file?
    e.g.
    I import libraries.jar at the top of my .bpel file.
    In my embedded java I do:
    MyClass myclass = new MyClass();
    myclass.doSomething();
    In the public void doSomething() method I would like to write to the audit trail directly. Currently I am simply having the doSomething() method return a String with a summary of everything it has done. This is not good enough because the method takes a long time to complete and I need a running audit trail so that I can take actions depending on what is going on in it.
    I can't seem to find the documentation... I assume in my MyClass.class I will need to import some bpel jars so that it can comprehend what a bpel process is... then pass the current process instance into the MyClass file so that it can call its addAuditTrailEntry method... is this right?
    I envision something like:
    import orabpeljars.jar
    public MyClass(BPELProcess process)
    process.addAuditTrailEntry("In MyClass Constructor");
    ------------------------------------------

  • DI Metadata Integrator install problems

    Environment: BOE BO XI r2 SP4 installed on windows server A with an Oracle dB
    Data Integrator 11.5 is installed on a windows server B
    we have also installed the BOE components, designer, webi, etc on server B.
    Problem: When we try to install DI metadata integrator on server B, I get the following error:
    '...path not found'
    when i try to run the cmsConfig.cmd file from dos i get the same error.
    I have checked and see all the jar files. Any help would be appreciated
    See below the information in the cmsconfig.cmd file
    @echo off
    setlocal
    rem Define the directory containing the Business Objects Enterprise and collector jar files.
    rem NOTE: Do not change the names of the following environment variables. They are subject
    rem to automatic update by the install utility.
    set DI_DIR=C:\PROGRA1\BUSINE1\DATAIN~1.7
    set CE_JARS_DIR=C:\PROGRA1\BUSINE1\common\3.5\java\lib
    set DI_CRAWLER_DIR=C:\PROGRA1\BUSINE1\DATAIN~1.7\ext\cmsCollector
    if NOT defined JAVA_HOME set JAVA_HOME=%DI_DIR%\ext\jre
    set CLASSPATH=%DI_DIR%\lib\loader.jar
    "%JAVA_HOME%\bin\java" -Djava.system.class.loader=com.bobj.ConfigurableClassLoader -Dclassloader.properties="%DI_CRAWLER_DIR%\classloader.properties"
    -Dlink_dir="%DI_DIR%" -Dboe_dir="%CE_JARS_DIR%" com.acta.crystalrepo.config.crConfigLaunch -C"%CE_JARS_DIR%" -I"%DI_CRAWLER_DIR%" -D"%DI_DIR%" %*
    :EXIT
    See below the information in the properties file
    Application jars
    cp.0.directory=%link_dir%
    lib
    cp.0.jars=acta_adapter_sdk.jar;acta_tool.jar;log4j-1.2.3.jar
    Business Objects Enterprise jars
    cp.1.directory=%boe_dir%
    cp.1.jars=cecore.jar;celib.jar;ceplugins.jar;cereports.jar;cesession.jar;corbaidl.jar;ebus405.jar;pluginhelper.jar;rasapp.jar;rascore.jar;serialization.jar;webi.jar;wilog.jar;jtools.jar;boconfig.jar;rebean.jar;rebean.wi.jar;rebean.common.jar
    webi.directory=%boe_dir%
    webi.jars=webi.jar;wilog.jar;jtools.jar;boconfig.jar
    CMS Metadata Integrator jar
    cp.2.directory=%link_dir%
    ext
    cmsCollector
    lib
    cp.2.jars=cms_md_collector.jar;MMCore.jar;MMCMS.jar
    External jars
    cp.3.directory=%link_dir%
    ext
    lib
    cp.3.jars=xerces.jar;msutil.jar;commons-logging.jar
    Web External jars
    cp.4.directory=%link_dir%
    ext
    diAdmin
    WEB-INF
    lib
    cp.4.jars=sqljdbc.jar;ojdbc14.jar;db2java.jar;ifxjdbc.jar;ifxjdbcx.jar;jconn2.jar;jconnect45.jar;mysql-connector-java-5.0.4-bin.jar

    Found a solution, see link below
    http://www.forumtopics.com/busobj/viewtopic.php?p=581371&sid=ee3cd084cfd9010cfda6665224f809e1

  • How to create ear using Jdeveloper9i

    Hello
    My Application contains
    1) Struts
    2) Value objects (WEB layer and ejb Layer acess these classes)
    3) EJB Layer
    Where to place Value objects( in .jar? or in .war)
    and how to make war, jar and ear using JDeveloper9.0.3

    Use the wizard to build a complete application. It'll build a *.deploy file for you. That should give you a good starting place. Use the file to build your war, ear or deploy right to your application server.

  • ProcessBuilder is FUNKY!!! or is it just me?

    I am trying to execute a JAR file from within a ProcessBuilder object. my JAR file accepts command-line parameters. However, as soon as i start passing those parameters the program hangs or doesn't execute anything. Here's my code:
    String list[] = {"java","-jar \\program\\java\\update\\CMDLineUpdateDD1.jar -c \\program\\java\\update\\config.xml"};
    ProcessBuilder b = new ProcessBuilder(list);
    Process p = b.start();
    BufferedReader input = new BufferedReader(new InputStreamReader(p.getInputStream()));
    String line=null;
    while((line=input.readLine()) != null) {
          log.info(line);
    int exitVal = p.waitFor();What happens is that it works when i just have the 'java' and '-jar' parameters. However, this jar also accepts a few command line parameters like the one shown above. If i add any of those parameters the program executes nothing. it generally exits, but no program has been executed.
    I have tried the above variable 'list' as the following:
    //all parameters completely separated...
    String list[] = {"java","-jar","\\program\\java\\update\\CMDLineUpdateDD1.jar","-c","\\program\\java\\update\\config.xml"};
    //separated by parameter, with equal signs...
    String list[] = {"java","-jar=\\program\\java\\update\\CMDLineUpdateDD1.jar","-c=\\program\\java\\update\\config.xml"};
    //parameters with spaces
    String list[] = {"java","-jar \\program\\java\\update\\CMDLineUpdateDD1.jar","-c \\program\\java\\update\\config.xml"};in each case it takes the "java" command and the "jar" parameter, but once i add the "-c" parameter it doesn't respond.
    any ideas? thanks!
    Edited by: 960093 on Sep 26, 2012 8:08 AM

    System.setErr(System.out);i added the above code before i start the process. i now get a little more info, but still as soon as i add the parameters it deadlocks. i get NO output, and it just runs like that.
    if i put:
    String list[] = {"java","-jar","\\program\\java\\update\\CMDLineUpdateDD1.jar"}i get an error message: "Can't find the config file!" (which is expected and normal, since i didn't give the config file parameter)
    but when i add the config file parameter:
    String list[] = {"java","-jar","\\program\\java\\update\\CMDLineUpdateDD1.jar","-c", "\\program\\java\\update\\config.xml"};it deadlocks. DANG! this is frustrating
    RE: PS-i have a folder in my C: root called 'program' with all my code in it. i got that from a former developer and have never changed it. does that make sense?

Maybe you are looking for