Results 1 to 16 of 16
  1. #1
    miodzio is offline Member
    Join Date
    Feb 2014
    Posts
    8
    Rep Power
    0

    Default RXTXcomm library and problem with run without cmd

    Hi
    I have a problem with run my application without cmd. In NetBeans and in cmd my app is working without any msg or error, but when im trying to run by double click, nothing happend, but if I "//" fragment using rxtxcomm lib, app is running by double click

    Is there anything I can do with this problem?

  2. #2
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    3,876
    Rep Power
    5

    Default Re: RXTXcomm library and problem with run without cmd

    Sure. I just don't know what the problem is just yet. "It doesn't run by double click". So I guess you want to make an executable jar. Is the jar actually executable then? I guess not.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  3. #3
    miodzio is offline Member
    Join Date
    Feb 2014
    Posts
    8
    Rep Power
    0

    Default Re: RXTXcomm library and problem with run without cmd

    Quote Originally Posted by gimbal2 View Post
    Sure. I just don't know what the problem is just yet. "It doesn't run by double click". So I guess you want to make an executable jar. Is the jar actually executable then? I guess not.
    it's allready executable .jar, but if I have function's using RXTXcomm library it's doesn't run by double click, but in cmd, java -jar app.jar work good with and without RXTXcomm function's

  4. #4
    miodzio is offline Member
    Join Date
    Feb 2014
    Posts
    8
    Rep Power
    0

    Default Re: RXTXcomm library and problem with run without cmd

    in new application, I can run by double click on .jar
    but application can do this command - "portList = CommPortIdentifier.getPortIdentifiers();" and each other with rxtx lib (don't do next lines);
    But when im running application in CMD "java -jar app.jar" everything work fine



    import java.util.Enumeration;
    import gnu.io.CommPortIdentifier;

    public class RS232Base {

    private Enumeration portList = null;
    private CommPortIdentifier portId = null;
    private String defaultPort = null;
    private boolean portFound = false;
    private int baudRate = 0;

    public RS232Base(String defaultPort, int baudRate){
    this.defaultPort = defaultPort;
    this.baudRate = baudRate;

    }

    public void checkPorts(){


    portList = CommPortIdentifier.getPortIdentifiers();
    Widok.wartoscPlacowka.setText("-");
    while(portList.hasMoreElements()){
    portId = (CommPortIdentifier)portList.nextElement();
    if(portId.getName().equals(defaultPort)){
    portFound = true;
    new SerialProgram(portId, baudRate);

    }
    }

    if(!portFound){
    Error error = new Error();
    error.setVisible(true);
    error.setLocationRelativeTo(null);
    error.error.setText("Podepnij adapter Bluetooth");
    }
    }
    }

  5. #5
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    3,876
    Rep Power
    5

    Default Re: RXTXcomm library and problem with run without cmd

    can you create a very simple application without any external libraries (something stupid that only shows an empty JFrame or something) and make that run through as executable jar by double clicking it?

    At this point what you describe would make me assume that your computer isn't properly setup to run a .jar file through javaw.exe, otherwise there is no reason why it would work with java -jar and not by double clicking it.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  6. #6
    miodzio is offline Member
    Join Date
    Feb 2014
    Posts
    8
    Rep Power
    0

    Default Re: RXTXcomm library and problem with run without cmd

    It's running by double click. Now as I wrote, it cant use functions from external library or something like that when it's not executed from CMD

  7. #7
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    3,876
    Rep Power
    5

    Default Re: RXTXcomm library and problem with run without cmd

    Oh sorry, I have a little trouble understanding what you write.

    So it is running - that means you are getting an error. Post the error with the full stacktrace.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  8. #8
    miodzio is offline Member
    Join Date
    Feb 2014
    Posts
    8
    Rep Power
    0

    Default Re: RXTXcomm library and problem with run without cmd

    There is no error. Adding 4 photos (From NetBeans, From CMD, from doubleclick, bonus(when app stops to work))

    java.awt.EventQueue.invokeLater(new Runnable() {
    public void run() {

    //System.load("rxtxSerial");
    new Widok().setVisible(true);




    String port="";

    try {
    port = RegisterReader.getValue("HARDWARE\\DEVICEMAP\\SERI ALCOMM\\", "\\Device\\BthModem0");
    }
    catch(Exception e){
    System.out.println(e);
    }

    RS232Base serial = new RS232Base(port, 115200);
    serial.checkPorts();
    }
    });

    thets how I run code from class


    RXTXcomm library and problem with run without cmd-netbeans.jpgRXTXcomm library and problem with run without cmd-cmd.jpgRXTXcomm library and problem with run without cmd-doubleclick.jpgRXTXcomm library and problem with run without cmd-check.jpg

  9. #9
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    3,876
    Rep Power
    5

    Default Re: RXTXcomm library and problem with run without cmd

    I see, so the way you know it is "not working" is because that little character does not appear in the GUI.

    I'm stumped. What happens when you don't use 'java' on the command prompt, but 'javaw' ? That's the executable used when you run something by double clicking on the jar.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  10. #10
    miodzio is offline Member
    Join Date
    Feb 2014
    Posts
    8
    Rep Power
    0

    Default Re: RXTXcomm library and problem with run without cmd

    And when i open by double click, application don't catch data from serial port(created by bluetooth).
    When i open app from CMD with command javaw -jar, apps open like with java -jar.

  11. #11
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,949
    Rep Power
    19

    Default Re: RXTXcomm library and problem with run without cmd

    You need to find out where errors are logged:
    Java Code:
    try {
       port = RegisterReader.getValue("HARDWARE\\DEVICEMAP\\SERI ALCOMM\\", "\\Device\\BthModem0");
    }
    catch(Exception e){
       System.out.println(e);
    }
    Because if the above throws an exception then I'm not sure where javaw will stick the output.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  12. #12
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    3,876
    Rep Power
    5

    Default Re: RXTXcomm library and problem with run without cmd

    I'll just explain why I asked you to try javaw.exe: I'm suspecting there are two different Java runtimes being used here.

    Can you somehow print the output of

    Java Code:
    System.getProperty("java.version")
    in your GUI, to compare it to what it is when you double click on the jar and when you run it in any other way?


    Quote Originally Posted by Tolls View Post
    You need to find out where errors are logged:
    Java Code:
    try {
       port = RegisterReader.getValue("HARDWARE\\DEVICEMAP\\SERI ALCOMM\\", "\\Device\\BthModem0");
    }
    catch(Exception e){
       System.out.println(e);
    }
    Because if the above throws an exception then I'm not sure where javaw will stick the output.
    The problem is that this is happening only when double clicking the jar, so there is no place for that output to appear (no command prompt). The output would have to be redirected to a file or something.
    Last edited by gimbal2; 03-24-2014 at 04:34 PM.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  13. #13
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,949
    Rep Power
    19

    Default Re: RXTXcomm library and problem with run without cmd

    That's what I thought.
    Which means if, for example, there was some issues while running (via javaw) then there's no way to know with the current code.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  14. #14
    miodzio is offline Member
    Join Date
    Feb 2014
    Posts
    8
    Rep Power
    0

    Default Re: RXTXcomm library and problem with run without cmd

    You'r right Gimbal2, I have other version in CMD(1.7.0_25) and with doubleclick (1.7.0_51). I'll try with the same version

  15. #15
    miodzio is offline Member
    Join Date
    Feb 2014
    Posts
    8
    Rep Power
    0

    Default Re: RXTXcomm library and problem with run without cmd

    Yes It's working. Thanks a lot

  16. #16
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    3,876
    Rep Power
    5

    Default Re: RXTXcomm library and problem with run without cmd

    Weird that there is a difference though :/ I guess one of your installations is broken. I would uninstall everything related to Java and then install only the most recent one.
    Last edited by gimbal2; 03-25-2014 at 09:30 AM.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

Similar Threads

  1. Problem with JUNG library
    By nikos6707 in forum Java 2D
    Replies: 1
    Last Post: 11-02-2011, 03:30 PM
  2. external library problem
    By jperson in forum Eclipse
    Replies: 2
    Last Post: 05-17-2011, 09:25 AM
  3. Replies: 0
    Last Post: 04-16-2011, 08:22 AM
  4. Problem with .jar iReport (library ?)
    By mine0926 in forum NetBeans
    Replies: 6
    Last Post: 11-27-2010, 12:55 AM
  5. problem in loading library
    By rams in forum New To Java
    Replies: 0
    Last Post: 11-04-2008, 08:19 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •