Java Jar compilation

Hi all ,
I have been busy with my work so could not enter into this forum,
I am building a jar file of my project.
I am using NetBeans IDE. My files uses an external Jar File a JCalendar bean.
In NetBeans I was able to include it in the editor path.
But now i want to run this jar from command prompt using java -jar option.
But it is not recognising the external jar file JCalendar Bean. I have even included this in class path of system variables.
Please tell me how to do this, my project is going to client side on sunday and i have to implememnt this tommorrow.
Thanks in advance.

Hi!
Sorry, this weekend I was with my girlfriend.
Above some links:
http://java.sun.com/developer/Books/javaprogramming/JAR/basics/manifest.html
http://java.sun.com/j2se/1.3/docs/guide/jar/jar.html
But basically you have to create a subdirectory called "META-INF" in the root of your application and put the MANIFEST.MF inside this subdirectory. You�ll have to define the property "Class-Path" in the MANIFEST.MF, putting the JAR files that your application need. Try to get some available and free JAR file, like struts.jar, open it, analise the MANIFEST.MF of this jar, and try to do similarly.

Similar Messages

  • How to import custom java jar/class into oracle to be used in java proc ?

    Hi
    I would like to know how to import custom java jar/class files into oracle to be used in java stored procedure.
    I am developing a oracle pl/sql procedure to call java program. The java program will be created as procedure and will be published.
    But, my question is that I do have a other external jar/class file that need to be imported into this java program.
    example
    raise_sal.java
    import java.util.*;
    import oracle.sql.*;
    <<reference other java programs >>
    import cmpmsgsvc.xxxx.* ;
    import cmpmsgsvc.yyyy.* ;
    import cmpmsgsvc.zzzz.* ;
    how do I import the cmpmsgsvc jar/class file into oracle so that I don't have any
    compilation errros on raise_sal.java program ??
    what are the steps to import/compile and validate to do this?
    thanks for your help in advance.
    Thanks
    rrb.

    Kuassi
    Problem is that, I have 6 jar files that are needed to be included in the main java program. And, there are more than 50+ classes, propertiers in those 6 jar files.
    It might be not good idea to have all those 50+ classes in the production database.
    Is there anyway that I keep all those 6 jar files in unix box (our's is oracle erp installation with oracle being installed on unix box) and just refer them in the main java program. I mean database will be loaded with main java program and it should able to refer other 6 jar files from unix.
    if we create a directory and keep all jar files in there and include that directory in classpath variable, does this works? or what is other method?
    Please let me know.
    Thanks

  • Help with Java JAR file opbfuscation.

    I am looking for a free (no $) for use on commercial java code
    code obfuscation program, which can beat the Jode decompiler.
    I have tried Proguard, and I have tried Joga
    (using Jode itself for obfuscation is too complex for my purposes).
    Is there a simple way to beat decompilers like Jode and DJ,
    without a financial outlay if possible,
    given how easy it is to decompile Java bytecode?

    All interesting remarks, everyone!
    Proguard doesn't prevent decompilation on something very small, like a jar
    with one or two classes.
    Proguard is free(no money) for use over commercial java code,
    and is itself a java jar, so it will run on Windows,
    Mac and Linux platorfms.
    It also correctly obfuscates and links external java libraries
    and references to the man jar/class in a very systematic way.
    I'm just wondering if there is something similar to proguard on licensing arrangements,
    working over small amounts of code, and beating
    the decompilers (like Jode).
    I have used the code obfuscation that Dr.Java performs on it's classes during compilation.
    And while the resulting class file tested does confound Jode,
    JD-Gui ("Java decompiler") instantly beats the results of Dr.Java.
    Considering how easy it is to break class files, I was figuring that either Sun
    or another would offer a free/open source/cheap way to secure these class files,
    without resulting to Zelix Klassmaster, and instead of leaving a mess
    of decompiled source code, prevent decompilation of java byte
    code even happening at all?
    Any ideas?
    Edited by: Zac1234 on Jul 5, 2009 10:55 PM

  • JAR compilation problem

    hey guys,
    i have a problem adding a C library to a jar file,
    probles is that i dont know how to do it,lol
    i've downloaded avetanaBluetooth interface for BlueZ stack for Linux OP system:
    http://sourceforge.net/projects/avetanabt/
    instruction on compiling avetanaBluetooth library i found at:
    http://btfs.sourceforge.net/abthowto.htm
    also the instruction sais that you have to import "sources from sources/de and sources/javax", but you also have to import sources/com
    there is a test program in the package named: JSRTest.java which resides in de.avetana.bluetooth
    when JAR library is compiled, program can be called:
    java -jar avetanaBluetooth.jar
    (if you named compiled JAR file avetanaBluetooth.jar)
    problem that i have is with: "import the C library that you've compiled just now" statement from the above site instruction, im using Eclipse IDE
    (C compilation details are in the avetana package under HOWTOCOMPILE.txt)
    when i just complie /de, /javax and /com and try to run the JSRTest from JAR file i get: Native Library libavetanaBT.so not in CLASSPATH
    anything else i tried gave me same msg
    can someone advise me how to complie files properly?
    cheers :)

    Have anybody found a solution to it.
    Please tell me
    e-mail: [email protected]
    yahoo_id: vaish_ankur_cdac
    Ankur

  • JavaMail error with "java -jar" on 1.6

    The following code sends an email. The following ant build script compiles the code, creates a jar, runs the program using "java Test", and runs the program using "java -jar test.jar". Both runs work with Sun's 1.5 JRE. With Sun's 1.6 JRE, it does not work when using "java -jar" (my output is following the code). I am not sure why. I thought it might be conflicting versions of JavaMail and the JAF in Java6, but I have the latest JavaMail. I guess it is an issue with how libraries are loaded when using "java -jar", but I am not sure how to resolve this.
    If you want to run this, simply drop mail-1.4.1.jar and activation-1.1.1.jar into the same directory as these two files, set your.mail.server.here and [email protected], and run ant.
    Test.java
    import java.util.Properties;
    import javax.mail.*;
    import javax.mail.internet.*;
    public class Test {
        public static void main( String[] args )
            throws Exception {
            String host = "your.mail.server.here";
            String from = "[email protected]";
            String to = from;
            String subject = "Test JavaMail";
            Address[] toRecipients = new Address[1];
            toRecipients[0] = new InternetAddress( to );
            Properties properties = System.getProperties();
            properties.put( "mail.smtp.host" , host );
            Session session = Session.getDefaultInstance( properties, null );
            MimeMessage message = new MimeMessage( session );
            Address fromAddress = new InternetAddress( from );
            message.setFrom( fromAddress );
            message.setRecipients( Message.RecipientType.TO, toRecipients );
            message.setSubject( subject );
            message.setText( "this is the body" );
            Transport.send( message );
    build.xml
    <project name="test" basedir="." default="all">
        <property name="jar.path" value="test.jar" />
        <path id="classpath">
            <pathelement location="mail-1.4.1.jar" />
            <pathelement location="activation-1.1.1.jar" />
        </path>
        <target name="clean">
            <delete>
                <fileset dir=".">
                    <include name="${jar.path}" />
                    <include name="Test.class" />
                </fileset>
            </delete>
        </target>
        <target name="build">
            <javac destdir="." srcdir=".">
                <classpath refid="classpath" />
                <include name="Test.java" />
            </javac>
        </target>
        <target name="jar">
            <manifestclasspath property="mf.classpath" jarfile="${jar.path}">
                <classpath refid="classpath" />
            </manifestclasspath>
            <jar destfile="${jar.path}" basedir="." update="no" index="true">
                <include name="Test.class" />
                <manifest>
                    <attribute name="Manifest-Version" value="1" />
                    <attribute name="Class-Path" value="${mf.classpath}" />
                    <attribute name="Main-Class" value="Test" />
                </manifest>
                <indexjars>
                    <path refid="classpath" />
                </indexjars>
            </jar>
        </target>
        <target name="run">
            <echo message="This will work in 1.5 and 1.6" />
            <java classname="Test">
                <classpath refid="classpath" />
                <classpath location="${jar.path}" />
            </java>
        </target>
        <target name="runjar">
            <echo message="This will not work in 1.6" />
            <java jar="${jar.path}" fork="true" />
        </target>
        <target name="all" depends="clean,build,jar,run,runjar" />
    </project>
    output (with 1.6)
         [java] Exception in thread "main" javax.mail.MessagingException: IOException while sending message;
         [java]   nested exception is:
         [java]     javax.activation.UnsupportedDataTypeException: no object DCH for MIME type text/plain; charset=us-ascii
         [java]     at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:676)
         [java]     at javax.mail.Transport.send0(Transport.java:189)
         [java]     at javax.mail.Transport.send(Transport.java:118)
         [java]     at Test.main(Unknown Source)
         [java] Caused by: javax.activation.UnsupportedDataTypeException: no object DCH for MIME type text/plain; charset=us-ascii
         [java]     at javax.activation.ObjectDataContentHandler.writeTo(DataHandler.java:870)
         [java]     at javax.activation.DataHandler.writeTo(DataHandler.java:301)
         [java]     at javax.mail.internet.MimeBodyPart.writeTo(MimeBodyPart.java:1403)
         [java]     at javax.mail.internet.MimeMessage.writeTo(MimeMessage.java:1745)
         [java]     at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:636)
         [java]     ... 3 more

    I spent quite a bit of time looking into this. Thanks for the reproducible test
    case, it was essential to figuring out the problem!
    The problem appears to be a bug in the jar file index. The jar file index doesn't
    include the META-INF directory, which means JavaMail can't find the config
    files it's looking for in mail.jar. If you change the ant build file to set index="false",
    it will work as expected. If you really need the index, you can fix it by using
    the jar command explicitly - "jar i test.jar".
    It looks like this is a bug in ant.

  • BPM 11G : Business Catalog : Java JAR Files

    Folks,
    We have invested a lot of effort & time in developing Business Processes in ALBPM 6.5. One of the critical features in ALBPM 6.5 was the Business Catalog - if I had a set of Java Utility Classes bundled in a JAR Archive, I could " catalog " it & reference & reuse the classes via the PBL Code.
    We are now evaluating our Migration Approach to Oracle SOA 11G & we have a few questions :-
    1. Does Oracle BPM 11G also have the facility of directly " cataloging " Java JAR Archives ?
    2. If no, what is the best approach, in your viewpoint, to migrate business logic that is present in many such JAR archives.
    We are looking at abstracting the business logic in Web Services - however, the ideal path we are looking at is to retain our investment in the Business Catalog JAR Files.
    Please do let me know your thoughts & opinions.
    Thanks in advance,
    Sandeep Seshan

    There are 2 options you have:
    1. If you access the java code from within a BPEL process instead you can use the java embedding activity to call these classes directly.
    2. You expose your java classes through a spring context and use the spring component to expose the required classes as services within your composite which you can wire directly to your BPMN process.
    Thanks,
    Adam DesJardin

  • Error while running (java -jar orion.jar -install)  Need yr help ?

    Hi,
    I have
    Win 2000 Professional
    Oracle 9i release 1and have the Pre-Requisites of MapViewer as follows.
    OC4J_extended (Pre-Requisite for MapViewer)
    XML Parser (Built-in OC4J)
    Oracle 9iI don't know whether I have Oracle Client or not which is also pre-requisite for MapViewer ? I think it is built-in with any of the above... most probably with Oracle 9i !!!
    I have JDK1.3 as wellI have Oracle9iAS release 1.0.2.2.2a, but I don't want to use it, as I have OC4J standalone...
    I want to have the configuration, for using Oracle Spatial/MapViewer.... How can I do that ? I need steps/procedure...
    I am having problems in configuring OC4J which I have downloaded. I have unzipped OC4J_Extended in Oracle 9i Database home directory (not in Oracle 9iAS home directory... because I dont have installed iAS)
    Its installation guide asks for installation through the following command
    java -jar orion.jar -installbut after unzip, I don't get any file named "orion.jar"
    What should I do ? Where am wrong ? Should I have to use 9iAS for using MapViewer in any case, if so which version ? I need the heirarchy of steps ?
    I m really stucked !!!
    Any help would be highly appreciated.
    Thanx
    Zaaf.

    Hi,
    If you are just using OC4J, you should only need to do:
    java -jar oc4j.jar -install
    Also note that you should not install oc4j in the oracle_home
    directory. If/when you upgrade oracle to apply patches, etc
    it will overwrite/cause problems with your oc4j install if you
    put it in the oracle_home directory. Put it in any other directory.
    The only part of Oracle9iAS needed to run mapviewer is oc4j.
    After that is installed, then follow the instructions in the MapViewer
    User's Guide (available on OTN).

  • Getting error while running command java -jar oc4j.jar -install

    java -jar oc4j.jar -install
    ON RUNNING The above command getting below error , is it because Java home is not set?
    Warning: -jar not understood. Ignoring.
    Exception in thread "main" java.lang.NoClassDefFoundError: oc4j.jar
    at gnu.gcj.runtime.FirstThread.run() (/usr/lib/libgcj.so.5.0.0)
    at JvThreadRun(java.lang.Thread) (/usr/lib/libgcj.so.5.0.0)
    at JvRunMain(java.lang.Class, byte const, int, byte const, boolean) (/usr/lib/libgcj.so.5.0.0)
    at __gcj_personality_v0 (/oracle/u01/app/oracle/product/10.2.0/db_1/oc4j/j2ee/home/java.version=1.4.2)
    at __libc_start_main (/lib/tls/libc-2.3.4.so)
    at JvRegisterClasses (/oracle/u01/app/oracle/product/10.2.0/db_1/oc4j/j2ee/home/java.version=1.4.2)
    navisdb.igglobal.com(express)$ javac
    ksh: javac: not found
    ENVIORNMENT DETAIL : RED HAT LINUX ENTERPRISE EDITION
    Extracted OC4J_extended.zip file at oracle 10g installation location.

    does this command work?
    /home/oracle:MCSE>gij --showversion
    gij (GNU libgcj) version 3.4.6 20060404 (Red Hat 3.4.6-11)

  • Java Class (Compiled with JDK6_u12) that works with UCCX 9.0.2, don´t work with UCCX 10.5

    I have a Java Class (Compiled with JDK6_u12) that works with UCCX 9.0.2, after upgrade it don´t work with UCCX 10.5
    I get the error message: "Failed to access the WSDL at: https://www.brightnavigator.se/brightservice/brightservice.asmx?WSDL. It failed with: Got java.lang.RuntimeException: Unexpected error: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty while opening stream from https://www.brightnavigator.se/brightservice/brightservice.asmx?WSDL.; nested exception is: javax.xml.ws.WebServiceException: Failed to access the WSDL at: https://www.brightnavigator.se/brightservice/brightservice.asmx?WSDL. It failed with: Got java.lang.RuntimeException: Unexpected error: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty while opening stream from https://www.brightnavigator.se/brightservice/brightservice.asmx?WSDL. (line: 1, col: 47)
    Does anyone know about this ?

    Did you ever find a resolution to this issue? I have a similar issue after upgrading from 7 to 10.5. I have loaded all provided certificates to the tomcat-trust store, restarted Tomcat Services and still get the same error
    Thanks

  • Java -jar application.jar not finding file?

    I have an application program that contains the
    following two lines of code:
    FileInputStream sf = new FileInputStream "CustomWorld.ini");
    settings.load(sf);
    and when I run it as:
    java application
    it runs fine but if I run it as:
    java -jar -classpath .;application.jar application.jar
    it can't find the "CustomWorld.ini" file. Why is that
    and how can I fix it?
    Many thanks for your help.
    PS: to create the jar file I used:
    jar -cvfm application.jar application.mf application.class CustomWorld.ini

    Once your CustomWorld.ini file is in the jar, you can no longer access it directly with a FileReader. JDK 1.1 included resource locators to java.lang.Class...
    URL url = application.class.getResource("/CustomWorld.ini");
    if (url != null) { // resource was found
       InputStream in = url.openStream();
       settings.load(in);
    } else {
       // fail gracefully or use defaults
    }Note that the CustomWorld.ini file will need to be in the classpath or the root folder of the jar file for this to work.
    Regards,
    -Troy

  • Java -jar OrgFormatter.jar

    Hi All,
    I'm very new to Java. I'm trying to run this jar file and getting following error.
    java -jar OrgFormatter.jar VarshaTest060404.txt varshatest
    Failed to load Main-Class manifest attribute from OrgFormatter.jar
    OrgFormatter file takes two arguments <input file> and <output file>
    Please help me here.
    Thanks much
    Var

    if it doesn't work( the think is about the creating manifest file) you should study on the manifest files. I am wathching this topic

  • Java -jar -myApp.jar works but ....

    Hi there,
    I have a problem : using ant, I have exported my application into an executable jar file.
    When in the console, I type "java -jar myApp.jar" . Everything works well.
    But if, I do double click on the jar file, nothing happens. In fact, I can see a new Instance of javaw.exe in the "task manager" but nothing happens.
    It's kind of weird ...
    Has anybody an idea about that ??
    thanks in advance
    sylvain_2020

    I am having a similar problem.
    java -jar foo.jar works great, but double clicking seems to hang the app at a certain point.
    Unable to figure out what's going on, I've been putting some "JOptionPane.showMessageDialog()" calls to see how far it's getting. It appears to be hanging up when it tries to instantiate one of my classes that extends JPanel. I have a dialog appear right before calling the constructor (and I see that one), but I don't see the dialog that's in the constructor as the first executed line (so that it must hang up somewhere before that). I've also removed all constructors from the attribute declarations. That made me think it had something to do with the constructor of JPanel, over which I have no control.
    However, I can instantiate JPanel no problem.
    What the heck is going on???

  • Java -jar Test.jar  option is not identifing the CLASSPATH on UNIX BOX

    Hi All,
    java -jar Test.jar
    I am trying to execute Test.jar file using -jar option. I am able to excute the Test.jar file but it is not identifing the CLASSPATH set for other JAR files which is used in part of Test.jar. Saying java.lang.NoClassDefFoundError: for the class which are set in CLASSPATH.
    The same is able to identify the CLASSPATH if i excute the Test.class file directly with out -jar option like
    java Test. In this case everything is working fine.
    Can any one tell me why it is not identifying the classpath if i use or execute with java -jar Test.jar option.
    Thanks,
    sha

    When you use the -jar option, the only classpath that is used is the Class-Path in the manifest file of the jar. If there is no Class-Path, then only the jar is searched for classes. If there is a Class-Path, the paths must be relative to the jar file.

  • Java -jar NewOW.jar

    Hello!
    I get an error when trying to run my apps jar ...
    Directory of F:\Documents and Settings\Richard\NewOW\dist
    01/17/2006  07:38 PM    <DIR>          .
    01/17/2006  07:38 PM    <DIR>          ..
    01/17/2006  07:38 PM           595,646 NewOW.jar
                   1 File(s)        595,646 bytes
                   2 Dir(s)  46,755,405,824 bytes free
    F:\Documents and Settings\Richard\NewOW\dist>java -jar NewOW.jar
    Exception in thread "main" java.lang.NoClassDefFoundError: org/jdesktop/layout/G
    roupLayout$Group
    F:\Documents and Settings\Richard\NewOW\dist>I dont know what I need to check from this error
    runs fine in the IDE
    Thanks!

    Just as reported, Java can't find
    org/jdesktop/layout/GroupLayout$Group because
    you aren't providing it. You must place a copy in
    your NewOW.jar and create a Class-Path: entry in the
    manifest file.
    If your're going to use NetBeans, you really need a
    good understanding of classpath and jars, and what
    the IDE will do, and what you have to do.
    If you replace your NB beta version with the RC1
    version, it will do more for you.Running RC1 now ..... and jar run just great without me changing anything!

  • Java -jar oc4j.jar -properties

    hi,
    I run following this one. i got a error please rectify that
    java -jar oc4j.jar -properties
    *09/05/13 16:11:11 Invalid jsp taglib location: C:\Documents and Settings\nvinodh*
    *\Desktop\oc4j\j2ee\home\%s_javapOracleHome%\j2ee\home\jsp\lib\taglib does not ex*
    ist or is not a directory
    09/05/13 16:11:11 Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)
    initialized
    thanks
    with regards

    Greetings,
    From the error listed it appears that you have a path that is specific to your development machine which does not exist on your server. It is good practice to avoid placing jars and libraries that your application is dependent upon in directory structures which only exist on your development machine. So if you have oc4j on your dev box, put the taglib in a path relative to an ORACLE_HOME environment variable and deploy taglibs to same on the server.
    -Michael

Maybe you are looking for