Jar & CommApi problem

Hi,
I have an application that uses Java Communications API (javax.comm.api) under Windows 2000. Everything works just fine when I use class files. But when I put classes into a jar file, the application can't find any ports.
The CommApi documentation says: The javax.comm.properties file must be installed to your <jdk>/lib directory. If it is not, no ports will be found by the system.
So, the problem clearly is how to make jar file that finds the specific file?
This is how i packed my jar file:
jar cfmv my.jar mymanifest.txt *.classmymanifest.txt looks like this:
Manifest-Version: 1.0
Main-Class: MyMainClass
Class-Path: comm.jarcomm.jar contains CommApi classes.
CommApi also needs win32comm.dll file, which should be installed into <jdk>/bin directory.
Any help will be appreciated.

Hello there,
I'm facing this problem too.
Scenario:
I've build an application which uses javax.comm to connect to a given virtual serial port COMx.
I've copied all 3 required files to specified paths:
-comm.jar in ../jre/lib/ext/commapi (even in ../jre/lib/ext/)
-javax.comm.properties in ../jre/lib/
-win32comm.dll in ../jre/bin/ (even in ../jdk/bin/)
And added the path to comm.jar in Compile-time Libraries in NetBeans
When I'm running the application in NetBeans, it works. I get the available serial ports and can connect to them.
But when I'm building the executable .jre file, no ports are found.
The command:
newportList = CommPortIdentifier.getPortIdentifiers();leaves newportList void.
My manifest.mf file contains:
Manifest-Version: 1.0
Class-Path: lib/comm.jar lib/swing-layout-1.0.3.jar
Main-Class: emailtosms.eMailtoSMSgui
Ant-Version: Apache Ant 1.7.1
Created-By: 11.3-b02 (Sun Microsystems Inc.)
Also in /dist/lib/ directory i have both libraries (including comm.jar)
By double clicking my jar application everything works, the GUI has no problems, a database connection (MySQL) can be established,
except for the part that uses javax.comm api and no ports are found whatsoever.
Any help is greatly appreciated!

Similar Messages

  • Jar File Problem Using External Packages

    I am having problems creating an Executable jar file that imports classes from my own package.
    I can create an exe jar no problem without using any external packages, but when I use an external package the jar will not execute.
    I am using WindowsXP, my package is in,
    C:/MyClasses/Database
    the class files are stored loose, not in a jar file
    I have tried altering the class-path in the manifest file, but to no joy - I may have not changed the classpath correctly!
    Please help
    Magic

    This is a mine field of "correct programming style."
    External jars, if very general, could be placed in the directory jre/lib/ext.
    In some cases you can unzip the external jars and add them to your own jar.
    The manifest.mf migth be looked into, and of course you need to communicate your patching!
    As you remarked, it might be a problem of class path usage.
    For that the jar tool documentation might explain it better than I.

  • Commapi problems

    hi, i'm having trouble installing the commapi files and use them with the NetBeans IDE. the main problem is that i cannot open the ports because, i believe, the IDE cannot see or use the win32com.dll file.
    any ideas on solving this problem are welcome
    thank you
    Pablo

    hi...
    there are many topics about that... and you need to be more specific plz... ;)
    try this:
    * put win32com.dll in the windows system directory...
    * put the java.comm.properties file accesible in the classpath (normally, is in the lib directory of you JRE instalation)...
    * is the comm api jar file in your classpath?...
    EOF

  • Jacob.jar and Webutil.jar singing problem(URGENT)

    I read the instructions 'Configuring the webutil' and I found that there is not a reference in the file 'signer.properties' which is referenced in the on-line help of Forms Developer (step 4).
    The problem is that when i try to sign the 2 jar files 'frmwebutil , jacob'
    using this command
    E:\oracle\ora92\forms90\WEBUTIL>SIGN_WEBUTIL.BAT e:\oracle\ora92\forms90\java\jacob.jar
    after this command a essage appears:
    Genrating self signing certificate for key=webutil2...
    Keytool error :java .lang.execption:key pair not genrated ,alias <webutil2> already exists
    there were wanings or error while genrating a self singing certifciate . please review them.
    backing up e:\oracle\ora92\forms90\java\jacob.jar as e:\oracle\ora92\forms90\java\jacob.jar.old
    1 file(s) copied..
    singing e:\oracle\ora92\forms90\java\jacob.jar using key=webutil12...
    'jarsigner' is not recognized as an internal or external command.
    Is there a chance that the cause of this problem is that there is not the file 'signer.properties'?
    What can I do ?
    AND WHAT THE NEXT STEP AFTER THIS....
    INDU

    Update the sign_webutil.bat to add the full path before the jarsigner line
    Here is the files I use:
    makecert.bat:
    for /F "eol=# tokens=1,2* delims==" %%i in (signer.properties) do set %%i=%%j
    "%JDK_HOME%\bin\keytool" -genkey -dname "cn=%DN_CN%, ou=%DN_OU%, o=%DN_O%, c=%DN_C%" -alias %JAR_KEY% -keypass %JAR_KEY_PASSWORD% -keystore "%JINIT_HOME%\lib\security\keystore" -storepass jinitiator -validity 360
    @echo Certificate created...
    sign.bat:
    for /F "eol=# tokens=1,2* delims==" %%i in (signer.properties) do set %%i=%%j
    copy /Y %1 %1.unsigned
    @echo on
    "%JDK_HOME%\bin\jarsigner" -keystore "%JINIT_HOME%\lib\security\keystore" -storepass jinitiator -keypass %JAR_KEY_PASSWORD% %1 %JAR_KEY%
    @echo Signing complete...
    Francois

  • .jar (Java) Problem - Nokia 5800 XM

    I am having a problem with installing .jar (java) games/apps to my phone.
    What happens is that it starts installing and then "hangs" at around 75% and the phone doesn't do anything for about 30 secs, the phones seems "hang". I cant run any .jar file because of that. Is this a known problem ? What can i do to fix this ?.
    I tried copying the files to the phone and install from there but the same problem occurs.
    I have the certification set to ALL.
    I get no error just the "hang" problem.
    Can anyone help me? getting frustrated!

    nvm, found the solution now .... they are slide buttons ..... feeling a bit stupid now 

  • Jar file problem , please help

    Hi guys , i am not sure if i am in the right place to have this post in so i'll give it a try
    i know my explanation might be a shot in the dark but i'll try my best
    i have made a program using eclips , to send emails using my email , on certain conditions
    so when that codition happenes on some class in my program
    this class will call the email class and send an email to someone
    now the problem is not in the program , because as along as this program is in eclips and i run the program in eclips , everything goes fine , No errors what so ever
    but , if i make jar file , using eclips "export"
    once i run the program , the program would run , but once the same condition that ihave specified previously happenes , the current class never calls the email class , and no emails would be sent
    i am very confused wether
    1) it throws a class not found for some wierd reason
    2) or the external library that i used to send emails , is not exported
    i tried to check the CLASSPATH file and i think everything seems to be fine , so i dont know what the problem is
    so in short
    if the program is in eclips , every thign goes fine
    if the program is a jar file , then it would work fine but once it needs to send an email , it never does and i can still work on the program , but no emails will be sent
    thanks please some one help me out with this

    for more information here is the senario
    because i see that you guys are some how lost because i am not providing enough information
    so this is a detailed info of the problem
    i have 3 classes
    1) mybankmain (jframe)
    2) mybankbody (all labels and buttons and events included here)
    now: within some events in my program ,
    it calls a class called.....
    3) myEmail
    this class imports two things that are comming from an external jar file , so in short , if the external jar file is not available the program would complain
    i run this on windows xp (SP2)
    now: if this program runs on eclips , it would do everything it is supposed to do and all kind of calculations will be done and emails will be sent on the conditions that i have specified within the program
    if i make a jar file on windows , and i run the jar file , the file would work , all functionalities will work
    EXCEPT: sending an email
    - either my class is not found
    - or external jar file is not found which causes my class not to be able to perform its tasks
    i did only one test
    which is that i switched the main and i made myEmail as a main and i tried to export the jar file
    Result: jar file doesnt work
    the way i view whatever inside my jar file , i use Winrar and it would view everythign in the jar file and i see that all my classes are included there
    if i open my CLASSPATH , i see that there is a pointer to the external jar file
    if i open my manifest : i DO NOT see the exrernal jar file in there but i do see that its pointing to my main class
    class main : mybankmain
    and there is only the version and signiture
    i hope all these additional details would help in determining the problem that ihave been trying to solve for 2 weeks now

  • Jar signing problem? (continue with HOST PJC)

    <1> I've sign jar-file on Oracle9iAS server.
    <2> First form (with bean from that jar-file) loading asked me for "Granting", and after it runs without problem, bean is worked prefectly.
    <3> Second form loading shows me nothing, just explorer hanging.
    I've check JInitiator (1.3.1.9) Control Panel, Certificates tab... there is now any records. Maybe there is problem.
    (I also have(installed) Sun JSDK 1.4.1_01)
    Java Console also doesn't show any errors.
    Again form with bean doesn't loading at the second time.
    What is the problem ?
    Thank You

    Have you read the paper on Signing JAR files for JInitiator 1.3 - it details some changes that you'd be advised to make to your HTML template and the HOST bean code to get around this problem..

  • JAR File problems

    Hello,
    I have a jar file with some code I wrote that accesses a jar file from a 3rd party. I want to include the 3rd party jar files inside my jar file. So I basially have a jar file with my code (unjarred) and include the 3rd party jar files in my jar. In my MANIFEST.MF file I have properly set the Main-Class property correctly, as well as the Class-Path property. I have set my Class-Path value to 3rdparty.jar which is the jar file at the root directory of my jar. When I run my jar file I get a NoClassDefFoundError saying the 3rdparty jar file is not found. I have added a new line at the end of my MANIFEST.MF file, and am actually using ant to create my MANIFEST.MF file. When I unjar my file everything looks correct. What is the problem here? I have made sure the 3rd party classes that my code access are in the jar. What could I be doing wrong??

    Standard Java does not support placing a jar file within another jar.
    You can search for 3rd-party alternatives, ow write your own custom classloader.

  • Updating to signed JARs causes problems for older Java versions?

    Bear with me on this one -- not a Java developer, but an end user of Java products looking for a little clarification.
    We use a product which delivers a Java application via JAR file / web to end users (GlobalScape's EFT server).  With the recent release of Java 7 Update 51, users have been running into issues running these JAR files as they are not properly "signed".  We're working with the vendor to get updated signed JAR files in place, but they've warned us that these new JAR files will cause errors (or maybe not work at all) on folks who aren't running Java 7 Update 51.
    Trying to wrap my head around why that might be.  Best theory I can come up with from perusing threads here along with the Java team blogs is that the new security attributes used in the updated JAR files aren't "trusted" by older versions of Java (prior to Update 51?).
    We're pushing our vendor for clarification, but curious if someone here could help explain.
    Thanks!

    I suspect the problem with 'new JAR files will cause errors' is mainly because the vendor keeps enhancing their product, and may not any more support older JREs, or the new jars are no more compatible For example, we build our product on JDK 1.5 ... as some users out there must use that one because the 'newer and better' release does not work for them.
    But so far, we have not seen any problems running the 'JRE 7 Compliant' applications on older releases ... provided you can make your application run on latest JRE 7.
    In most cases, one can simply remove the previous signature, add (now required) attributes, and sign the same jar again.
    But I have yet to find a vendor that would simply add attributes to some older release and re-sign those. Perhaps they can't repeat the build / QA cycle, and would not 'trust' the re-signed jars.
    Our curse are signed Cryptographic Provider jars.
    Those must be signed by certificates rooted by Sun/Oracle, and adding attributes invalidates that signature - we can re-sign them, but then they won't work. In our case, we are stuck with 5+ year old Bouncy Castle jars, and it does not help us that their 'current' jars are signed with attributes - they are completely incompatible..
    IMHO, Oracle failed to think this all thru - or does not care.

  • Loading icons from jar - linux problem

    Dear,
    I use the folowing code to load an iconImage from a jar file to be used on JButtons:
    private ImageIcon getImageIcon(String iconName){ //gets icon from a file
    ImageIcon icon = null;
    ClassLoader cl = this.getClass().getClassLoader();
    java.net.URL imageURL = cl.getResource("/ExcelInterface/rsrc/"+iconName);
    if (debug) System.out.println(imageURL.toString());
    try{
    if (imageURL != null) {
    icon = new ImageIcon(imageURL);
    }catch (Exception e){
    System.out.println(e.getMessage());
    return icon;
    } // end of getImageIcon(String iconName)
    this works fine on windows.
    On linux everything looks fine (i.e. there are no exceptions, the URL looks fine...) BUT the Icons are not displayed on the buttons.
    Anyone have an idea why?

    I do something similar and although I've never had any problems on Linux only the server side stuff runs there so I've never tried exactly what you are doing. Anyway, my code doesn't have the leading "/" on the URL and the URL is the full path name from the class root, literally "com/inqwell/any/client/arrowup.gif" in my case. Try that and see if it works.

  • Hot Deploy Servlet in JAR file problem

    I've been playing with hot deploying servlets in WLS 5.1. I have SP2
              installed. I have things working fine with individual servlet class files. I
              decided to try hot deploying with jar files.
              I created a servlet, added it to a jar file, and then added the jar file to
              the 'weblogic.http.servlet.classpath'. I then restarted the server. I
              started the console and was able to hot deploy the servlet. So far so good.
              My next test is what failed. I modified the servlet, and rebuilt the jar
              file. I went back to the console, selected the servlet and hit the redeploy
              button. I went back to the browser and hit refresh - nothing, still the old
              servlet.
              It appears that WLS isn't reloading the jar file and the updated servlet.
              Everything works with individual class files.
              Does anyone know how I can cause the reload of updated servlets embedded
              within a jar file?
              Weblogic group - If there is no way now, will support be added soon?
              Thanks,
              Rick
              

    Hi,
              If I use weblogic.servlet.ServletServlet to try just the servlet , It
              works correctly.But When I develop it in a web application , there is a lot
              of hypelink to this servlet,thus I can't use the relative path reference to
              that servlet.I try to set the name of weblogic.servlet.ServletServlet same
              as the webapp,It doesn't work,how do I solve this problem?
              Thank you
              Pan
              Subject: Re: Hot deploy Servlet in webapp
              > http://www.weblogic.com/docs51/classdocs/API_servlet.html#134798
              >
              > It even explains why you shouldn't use it in production environment.
              >
              > Dimitri
              

  • Session EJB with external jar dependacy problem

    I have a Session EJB that I am having trouble adding to my Creator 2 project. The session bean is developed with netbeans 5.0, ejb2.1, for sjsas 8.2 PE. It has one external jar which is compiled into the ejb jar. When I try to add the session bean to my creator 2 project I get a java.lang.reflect.UndeclaredThrowableException. Creator 2 is not finding one of the Exception external jar.
    The only way I have been successful in added the session EJB is also add the external jar. But the project fails when you load the page with javax.naming.NameNotFoundException: No object bound to the name java: xxxxxx I believe the EJB is failing at instantiation.
    Has anyone had this problem and overcome it?
    Thanks,
    Francis

    Finally I found solution.
    Instead of deploying ejb jar to ear I've created a new ear deployment profile (so now I have ejb jar profile and ear profile).
    It contains ejb jar + external jar library and custom manifest.mf with class-path to ext. jar.
    Difference between this and previous version is the old one ear cointained ejb jar and the ejb jar contained ext. jar.
    Now ear contains both ejb jar and ext. jar.
    Rado

  • Deployment Plan / weblogic-ejb-jar.xml:  Problem

    Hello,
    I am trying to use a deployment plan to override the principal name in the weblogic-ejb-jar.xml.
    The deployment-plan looks like this (showing only the important sections)
    <variable-definition>
    <variable>
    <name>SecurityRoleAssignment_ejbRole_PrincipalNames_1</name>
    <value>MY PRINCIPAL 1</value>
    </variable>
    </variable-definition>
    <variable-assignment>
    <name>SecurityRoleAssignment_ejbRole_PrincipalNames_1</name>
    <xpath>/weblogic-ejb-jar/security-role-assignment/[role-name="View-Role"]/externally-defined</xpath>
    <operation>replace</operation>
    </variable-assignment>
    The security-role assignment in the weblogic-ejb-jar.xml looks like this:
    <security-role-assignment>
    <role-name>View-Role</role-name>
         <externally-defined/>
    </security-role-assignment>
    I 've tried to override the element-value of <externally-defined> (a valid tag in the weblogic-ejb-jar.xml ) with help of a deployment-plan.
    When trying to deploy my application (which is organised in the directory-structure: inst_dir/APP inst_dir/PLAN
    the following error occurs:
    VALIDATION PROBLEMS WERE FOUND problem: cvc-complex-type.2.4a: Expected element 'principal-name@http://www.bea.com/ns/weblogic/10.0' instead of 'externally-defined@http://www.bea.com/ns/weblogic/10.0' here in element security-role-assignment@http://www.bea.com/ns/weblogic/10.0:
    This has surprised me, as externally-defined is (according to the documentation) a valid tag.
    I have tried to replace <externally-defined> with an empty <principal-name> tag (which works fine when deploying the application), but causes a security exception, when trying to use the EJB.
    Has anybody an idea if there is a workaround for this problem?
    IMHO the Validatio Problem is not justified at this place then why should an otherwise valid weblogic-ejb-jar.xml (when not using a deployment-plan) suddenly become invalid when a deployment plan is used?
    Thanx a lot in advance!
    Edited by: user10672779 on 02.12.2008 04:09

    Hi again,
    I tried it with the weblogic 10 Namespace Declaration but got then this error:
    failed to load java type corresponding to e=weblogic-ejb-jar@http://www.bea.com/ns/weblogic/weblogic-ejb-jar/1.0/weblogic-ejb-jar.xsd
    and following Exception:
    <02.12.2008 20.00 Uhr CET> <Error> <J2EE> <BEA-160197> <Unable to load descriptor D:\exportapps\tb.ear\app\tb_flowcontrol.jar/META-INF/weblogic-ejb-jar.xml of module tb_flowcontrol.jar. The error is weblogic.descriptor.DescriptorException: Unmarshaller failed
    at weblogic.descriptor.internal.MarshallerFactory$1.createDescriptor(MarshallerFactory.java:152)
    at weblogic.descriptor.BasicDescriptorManager.createDescriptor(BasicDescriptorManager.java:292)
    at weblogic.descriptor.BasicDescriptorManager.createDescriptor(BasicDescriptorManager.java:260)
    at weblogic.application.descriptor.AbstractDescriptorLoader2.getDescriptorBeanFromReader(AbstractDescriptorLoader2.java:774)
    at weblogic.application.descriptor.AbstractDescriptorLoader2.createDescriptorBean(AbstractDescriptorLoader2.java:395)
    at weblogic.application.descriptor.AbstractDescriptorLoader2.loadDescriptorBeanWithoutPlan(AbstractDescriptorLoader2.java:745)
    Caused by: com.bea.xml.XmlException: failed to load java type corresponding to e=weblogic-ejb-jar@http://www.bea.com/ns/weblogic/weblogic-ejb-jar/1.0/weblogic-ejb-jar.xsd
    at com.bea.staxb.runtime.internal.UnmarshalResult.getPojoBindingType(UnmarshalResult.java:329)
    at com.bea.staxb.runtime.internal.UnmarshalResult.determineTypeForGlobalElement(UnmarshalResult.java:296)
    at com.bea.staxb.runtime.internal.UnmarshalResult.determineTypeForGlobalElement(UnmarshalResult.java:306)
    at com.bea.staxb.runtime.internal.UnmarshalResult.determineRootType(UnmarshalResult.java:287)
    at com.bea.staxb.runtime.internal.UnmarshalResult.unmarshalDocument(UnmarshalResult.java:153)
    at com.bea.staxb.runtime.internal.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:65)
    at weblogic.descriptor.internal.MarshallerFactory$1.createDescriptor(MarshallerFactory.java:141)
    Searching the net couldn't supply me with another answer as to use the 90 Namespace Declaration again...
    I think I forgot to mention I am using an exploded directory.
    This all seems very strange.
    cheers.

  • OTA Error code 37 ( jar downloading problem)

    Hi all,
    I am new to j2me and recently creates an apps ..my apps works fine on OTA Provisioning if default url is used for downloading jad/jar....but when i used tomcat server it gives an error while downloading jar file OTA error code 37...i have also configure the mime type in tomcat's web.xml file...and try differnt ways....but still problem not resolved....please anybody help me to remove this error...Thanx in advance
    -JPF

    Hi,
    did you add these 2 MIME types?
    application/java-archive - jar
    text/vnd.sun.j2me.app-descriptor - jad

  • Jar command problem

    Hi
    I am trying to create a jar for my java project. I am using NetBeans so at first i thought that i could have NetBeans create it for me. But the help function just tells me that it is generated automatically in a folder called "dist". The problem is that the dist-folder does not contain any jar-file.
    Then i though i could create it from the command line using the
    jar cf MyJar.jar MyClass.classcommand. But when i try this i get a message saying "'jar' is not recognized as an internal or external command". I tried to re-install my JDK but no luck. My guess is that both the netbeans problem and the command line problem are because of the same reason.
    Anyone know how i could solve this? All answers are appreciated.
    Thank you
    //Patrik

    update your PATH variable.
    see 4. Update the PATH variable (Optional) here http://java.sun.com/javase/6/webnotes/install/jdk/install-windows.html

Maybe you are looking for