different output trying to execute same java code

different output trying to execute same java code

i am using net beans 7 ide and java 6 to develop my java projects. i used the following coding to read value from serial port :

import java.io.*;
import java.util.*;
import javax.comm.*;

public class SimpleRead implements Runnable, SerialPortEventListener {

static CommPortIdentifier portId;
 static Enumeration portList;

InputStream inputStream;
SerialPort serialPort;
Thread readThread;

public static void main(String[] args) {


portList = CommPortIdentifier.getPortIdentifiers();
JOptionPane.showMessageDialog(null, "portList :"+portList.hasMoreElements()); 
while (portList.hasMoreElements()) {
  portId = (CommPortIdentifier) portList.nextElement();
  if (portId.getPortType() == CommPortIdentifier.PORT_SERIAL) {
   if (portId.getName().equals("COM3")) {
         SimpleRead reader = new SimpleRead();
  }
}

} }

public SimpleRead() {
 ....

...... }

public void run() {
  try {
    Thread.sleep(20000);
  } catch (InterruptedException e) {System.out.println(e);}
}

public void serialEvent(SerialPortEvent event) {
  switch(event.getEventType()) {
    .....

...... ..... ...... } } }

When i execute from netbeans, JOptionPane showing "portList : true" but when i double click on the jar file and tried to run, JOptionPane showing "portList : false"

Why there is different output trying to execute same java code

View Answers









Related Tutorials/Questions & Answers:
different output trying to execute same java code
different output trying to execute same java code  i am using net beans 7 ide and java 6 to develop my java projects. i used the following coding... output trying to execute same java code (adsbygoogle
different output trying to execute same java code
different output trying to execute same java code  i am using net beans 7 ide and java 6 to develop my java projects. i used the following coding... " portList : false" Why there is different output trying to execute same java
Advertisements
different output trying to execute same java code
different output trying to execute same java code  i am using net beans 7 ide and java 6 to develop my java projects. i used the following coding... " portList : false" Why there is different output trying to execute same java
SHOWING ERROR CODE 1064 WHILE TRYING TO EXECUTE PROCEDURE
SHOWING ERROR CODE 1064 WHILE TRYING TO EXECUTE PROCEDURE  I AM TRYING A SP BUT IT IS NOT SAVING AND WORKING.DOES THE STORED PROCEDURE WORK PARTLY... ARE WORKING PROPERLY. BUT WHEN I AM TRYING TO EXECUTE THEM INSIDE
How to ensure the same output by java code on 32 bit m/c and 64 bit m/c
How to ensure the same output by java code on 32 bit m/c and 64 bit m/c  How to ensure the same output by java code on 32 bit m/c and 64 bit m/c
How to print different Messge for the same NumberFormatException on different cause objects in JAVA?
How to print different Messge for the same NumberFormatException on different cause objects in JAVA?  How to print different Messge for the same NumberFormatException on different cause objects in JAVA? try { int
login for different user in the same page
login for different user in the same page  how can i do the login for different user in the same page throug jsp
Java error cannot find symbol
of a"+a); } } Output : When you compile and execute the program output...Java error cannot find symbol In this section you will learn about "cannot find symbol" in java. Java cannot find symbol is a type of error occurs
Java code for Saving Marathi (Indian local language ) in Mysql and retrieving the same
Java code for Saving Marathi (Indian local language ) in Mysql and retrieving... going to save the marathi data into mysql and trying to retrieving the same from...; And my output is : Same o/p I gets in eclipse console. Can you tell me the solution
java code to validate column content of 2 different tables in 2 different databases.
java code to validate column content of 2 different tables in 2 different... at different server and display output( in excel format) using JAVA. if matched... that the migrated data is correct by creatng a script to run written in java
Servlet signup same output - JSP-Servlet
Servlet signup same output  Ok i solved the problem of content type by res.setContentType("text/plain"), but the output is same it always prints....   Hi friend, Plz give full details with source code to solve
how to write code for this output?
how to write code for this output?   1 2 2 3 3 3 4 4 4 4 5 5 5 5 5
Updating rows who has same id with different values for each row from java program
Updating rows who has same id with different values for each row from java..." as a value for sname column from java program. Same for records with sid 2 value... rows with same id. student table: sid sname age 2 aruna 25 2
Java Read Lines from Text File and Output in Reverse order to a Different Text File
Java Read Lines from Text File and Output in Reverse order to a Different Text... to another text file. When that is done the output values of that file need to display in a JTextArea field. I have a good share of the code done and an area
inserting same data to different tables in oracle
inserting same data to different tables in oracle  Hi there ...! i have to insert un,pwd, to three oracle tables, like admin, user, stud, but i want pickup these table names from a drop down list in html...is there any chance can
inserting same data to different tables in oracle
inserting same data to different tables in oracle  Hi there ...! i have to insert un,pwd, to three oracle tables, like admin, user, stud, but i want pickup these table names from a drop down list in html...is there any chance can
inserting same data to different tables in oracle
inserting same data to different tables in oracle  Hi there ...! i have to insert un,pwd, to three oracle tables, like admin, user, stud, but i want pickup these table names from a drop down list in html...is there any chance can
inserting same data to different tables in oracle
inserting same data to different tables in oracle  Hi there ...! i have to insert un,pwd, to three oracle tables, like admin, user, stud, but i want pickup these table names from a drop down list in html...is there any chance can
inserting same data to different tables in oracle
inserting same data to different tables in oracle  Hi there ...! i have to insert un,pwd, to three oracle tables, like admin, user, stud, but i want pickup these table names from a drop down list in html...is there any chance can
inserting same data to different tables in oracle
inserting same data to different tables in oracle  Hi there ...! i have to insert un,pwd, to three oracle tables, like admin, user, stud, but i want pickup these table names from a drop down list in html...is there any chance can
how to execute this code - JSP-Servlet
how to execute this code  hi guys can any help me in executing this bank application http://www.roseindia.net/jsp/bank.shtml, i need to use any database plz tell me step-to-step procedure for executing this,i need to create
I am trying to assign a variable the value of 0123, but it keeps coming up with a different number, what’s the problem?
I am trying to assign a variable the value of 0123, but it keeps coming up with a different number, what?s the problem?  I am trying to assign a variable the value of 0123, but it keeps coming up with a different number, what?s
I am trying to assign a variable the value of 0123, but it keeps coming up with a different number, what’s the problem?
I am trying to assign a variable the value of 0123, but it keeps coming up with a different number, what?s the problem?  I am trying to assign a variable the value of 0123, but it keeps coming up with a different number, what?s
ModuleNotFoundError: No module named 'sphinx_execute_code'
ModuleNotFoundError: No module named 'sphinx_execute_code'  Hi, My... named 'sphinx_execute_code' How to remove the ModuleNotFoundError: No module named 'sphinx_execute_code' error? Thanks   Hi
How can I output text typed in textarea by user on the same page?
How can I output text typed in textarea by user on the same page?  I... would like to take the comments and append them to the same page for all to see. Is this posibble and if so could you give me the code and instructions to do
Execute .dll file in java?
Execute .dll file in java?  please anybody give me solution for executing .dll files in java
How send different files to browser at same time ..example(pdf&html) want display in same request using servlet
How send different files to browser at same time ..example(pdf&html) want display in same request using servlet  package com.readfiles; import...); } } }![alt text][1] [1]: http://How send different files to browser at same time
diff between encapsulation and abstraction code with output
diff between encapsulation and abstraction code with output   diff between encapsulation and abstraction code with output
diff between encapsulation and abstraction code with output
diff between encapsulation and abstraction code with output   diff between encapsulation and abstraction code with output
diff between encapsulation and abstraction code with output
diff between encapsulation and abstraction code with output   diff between encapsulation and abstraction code with output
updating rows which contains same id, different value for each row
updating rows which contains same id, different value for each row  .... Like this table may contains multiple records with same sid. Here my requirement is "I have to update those records which contains same sid basing on one
What is the equivalent method in Java which is equivalent to clrscr() in c/c++ . The code should help to clear the output screen ?
What is the equivalent method in Java which is equivalent to clrscr() in c/c++ . The code should help to clear the output screen ?  Hello to all, I have searched the net to know that is there any equivalent method for clrscr
Can JavaScript code be broken in different lines?
Can JavaScript code be broken in different lines?  Can JavaScript code be broken in different lines
how to distinguish engines having same code - Struts
introduced a new engine for testing purpose it has almost same code as previous engine...how to distinguish engines having same code  hi we are using struts... as both access same database .file is kept in central repository both engine
can i Execute PHP code inside python script?
can i Execute PHP code inside python script?    can i Execute PHP code inside python script
Does finally always execute in Java?
Does finally always execute in Java?  Does finally always execute in Java
java program of different shapes
java program of different shapes  pls help me to get the code of a java program of different shapes using menu
Does finally always execute in Java?
Does finally always execute in Java?  Hi, I am learning exception handling in Java. I want to know if finally{} block is always executed or not in Java? Does finally always execute in Java? Thanks
Does finally always execute in Java?
Does finally always execute in Java?  Hi, I am learning exception handling in Java. I want to know if finally{} block is always executed or not in Java? Does finally always execute in Java? Thanks
Does finally always execute in Java?
Does finally always execute in Java?  Hi, I am learning exception handling in Java. I want to know if finally{} block is always executed or not in Java? Does finally always execute in Java? Thanks
Java Execute Jar file
operating system or platform. To execute a JAR file, one must have Java... are different from other files as they have a hexadecimal field code on the first...JAR stands for Java ARchive and is platform independent. By making all
I didn't gat an output for this code, plz send me a correct code
I didn't gat an output for this code, plz send me a correct code  Hi, Here is my code: import java.awt.event.*; import java.awt.event.KeyAdapter; import java.awt.event.KeyEvent; import javax.swing.*; import java.sql.*; public
how to get values for same column name from two different tables in SQL
how to get values for same column name from two different tables in SQL  how to get values for same column name from two different tables in SQL???? column name is emp_id loacated in these two tables company,employee
Class and interface in same file and accessing the class from a main class in different package
and Fly.java needs to be in same package. If I keep Fly.java in different...Class and interface in same file and accessing the class from a main class in different package  Hello everyone; I was going through some design
Class and interface in same file and accessing the class from a main class in different package
and Fly.java needs to be in same package. If I keep Fly.java in different...Class and interface in same file and accessing the class from a main class in different package  Hello everyone; I was going through some design
output java - Java Beginners
; } a. what is the output of the ff. java statement:? i. System.out.println (secret...output java  public static int secret(int one) { int i; int...?  Hello Are you beginner? Ok, The first Output is 125
how to execute a unix shell script from a java program
the script name from a java code .once you execute this java program...how to execute a unix shell script from a java program  well , i am... solution . could anyone please give a sample code as of how to do this... what i am
Are J2EE and Java Advanced the same?
Are J2EE and Java Advanced the same?  Hi, I am checking J2EE and Advanced Java. Are J2EE and Java Advanced the same? Thanks   Hi, J2EE is now renamed to JEE in latest version of Java platform, which is Specification
try to execute this code getting class cast exception, please resolve it.
try to execute this code getting class cast exception, please resolve it.  package test; import java.util.Arrays; import java.util.HashSet; import java.util.List; import java.util.Set; public class Over { static int k
jsp code for display of data from database and snap shot of the output
jsp code for display of data from database and snap shot of the output ... the things i have entered in the same page inside the corresponding fields... project next week..i want to se the snapshots of the output   Please visit

Ads