Please help me, how can JAVA program use USB to communicate?

The serial port communication I used before had a relatively slow transmission speed, and now I want to use USB for transmission. I don’t know much about USB, but I know that the transmission speed of USB is incomparable to that of a serial port. I have used a USB copy cable before. After installing the driver, it is possible to use the built-in software to send data to two PCs, but Now I want to embed it into a JAVA program, but I don’t know if it’s feasible. I’ve seen on the Internet that it only supports LINUX. My operating system is still WINDOWS. Please give me some ideas! 2 solutions #1 1. What is the built-in software? 2. Is the driver only for built-in software or does it provide any kind of interface? 3. If no interface is provided, you can try Java to communicate with your own software. 4. If an interface is provided, it is recommended that Java directly introduce the interface. #2 Without an interface, it is just an EXE execution program. Can copy files.

Regarding the problem of javamail, please help me!

import org.apache.commons.mail.*; /** * Send information to the consultant’s email address * * @param title, content, SMTP service name, sender email address, sender username, sender password, recipient email address */ public void sendInfo(String replyTitle,String htmlReplyContent,String SmtpName, String fromMailAddress,String mailUsersName,String mailUsersPsWord, String toMailAddress) throws Exception { HtmlEmail email = new HtmlEmail(); try{ email.setDebug(true); email.setHostName(SmtpName); email.setAuthentication(mailUsersName,mailUsersPsWord); email.addTo(toMailAddress,””); email.setFrom(fromMailAddress,””); email.setSubject(replyTitle); email.setHtmlMsg(htmlReplyContent); email.send(); } finally { } } After executing the last step “email.send();”, the following error is reported: DEBUG: JavaMail version 1.3 DEBUG: java.io.FileNotFoundException: F:\Program Files\Java\jdk1.5.0_06\jre\lib\javamail.providers (The system cannot find the specified file.) DEBUG: !anyLoaded DEBUG: not loading resource: /META-INF/javamail.providers DEBUG: successfully loaded resource: /META-INF/javamail.default.providers DEBUG: Tables of loaded providers DEBUG: Providers Listed By Class Name: {com.sun.mail.smtp.SMTPTransport=javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Sun Microsystems, Inc], com. sun.mail.imap.IMAPStore=javax.mail.Provider[STORE,imap,com.sun.mail.imap.IMAPStore,Sun Microsystems, Inc], com.sun.mail.pop3.POP3Store=javax.mail.Provider[ STORE,pop3,com.sun.mail.pop3.POP3Store,Sun Microsystems, Inc]} DEBUG: Providers Listed By Protocol: {imap=javax.mail.Provider[STORE,imap,com.sun.mail.imap.IMAPStore,Sun Microsystems, Inc], pop3=javax.mail.Provider[STORE,pop3 ,com.sun.mail.pop3.POP3Store,Sun Microsystems, Inc], smtp=javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Sun Microsystems, Inc]} DEBUG: successfully loaded resource: /META-INF/javamail.default.address.map DEBUG: !anyLoaded DEBUG: not loading resource: /META-INF/javamail.address.map DEBUG: java.io.FileNotFoundException: F:\Program Files\Java\jdk1.5.0_06\jre\lib\javamail.address.map (The system cannot find the specified file.) DEBUG: getProvider() returning javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Sun Microsystems, Inc] DEBUG SMTP: useEhlo true, useAuth true DEBUG SMTP: useEhlo true, useAuth true DEBUG: SMTPTransport trying to connect to host “smtp.sohu.com”, port 25 An exception occurred during the message reply operation and the…

A java interview question, please help me

1-9 9 numbers a-i9 letters randomly composed string Such as: 1abc3567dgihee How to turn numbers into corresponding letters of the alphabet, and turn letters into numbers corresponding to the positions of letters in the alphabet? For example, 1 corresponds to a 2 corresponds to b 3 corresponds to c 8 solutions #1 I thought about it myself, but there is no suitable idea. Random string numbers and letters are interchanged. #2 public static void main(String[] args) { String str = “1abc3567dgihee”; StringBuilder result = new StringBuilder(); Map map = new HashMap(); String zm=”abcdefghi”; String num = “123456789”; for(int i=0;i<9;i++) { map.put(zm.charAt(i), num.charAt(i)); map.put(num.charAt(i), zm.charAt(i)); } for(int i=0;i<str.length();i++) { result.append(map.get(str.charAt(i))); } System.out.println(result.toString()); } #3 Direct replacement method #4 Quoting the reply from ITjavaman on the 2nd floor: public static void main(String[] args) { String str = “1abc3567dgihee”; StringBuilder result = new StringBuilder(); Map map = new HashMap(); String zm=”abcdefghi”; String num = “123456789”; for(int i=0;i<9;i++) { map.put(zm.charAt(i), num.charAt(i)); map.put(num.charAt(i), zm.charAt(i)); } for(int i=0;i<str.length();i++) { result.append(map.get(str.charAt(i))); } System.out.println(result.toString()); } Thank you. The method I wrote myself is very troublesome. public static void main( String[] args ) { List list=new ArrayList(); String [] letters={“a”,”b”,”c”,”d”,”e”,”f”,”g”,”h”,”i”}; String test=”123edfhi65eedacb”;         String[] testArr=test.split( “” ); Pattern reg1=Pattern.compile(…

How to execute enumeration in java through reflection, please help me!

How to execute enumeration in java through reflection, please help me!

[size=16px]public class CommonConstants { /** *@desc Order type * @author tangkun * */ public enum ORDERTYPESTATE { HEADQUARTERSORDERS(“Headquarters Order”, 0), DEALERORDERS(“To be sold”, 1), DIRECTORDERS( “Direct Sales Order”, 2); private final String name; private final Integer value ; ORDERTYPESTATE(String name, Integer value) { this.name = name; this.value = value; } public String getName() { return name; } public Integer getValue() { return value; } } public static void main(String[] args) throws Exception { Class class1 = Class .forName(“com.tangkun.utils.CommonConstants$ORDERTYPESTATE”); Field[] field = class1.getFields(); for ( Field field2 : field) { field2.setAccessible(true); Class class2 = field.getClass();                                                                                                                                                                            Want to dynamically call the value of the variable in the enumeration */ Method[] methods = class2.getDeclaredMethods(); for (Method method : methods) { System.out.println(method.getName()); } } } } [/size] 11 solutions #1 public static void main(String[] args) throws Exception { Class class1 = Class .forName(“learning.CommonConstants$ORDERTYPESTATE”); ORDERTYPESTATE order = ORDERTYPESTATE.DEALERORDERS ; Method[] methods = class1.getDeclaredMethods(); for (Method method : methods) { if(method.getName().startsWith(“get”)){ System.out.println(method.getName() + “: ” + method.invoke(order)); } } } Is this what the poster wants? #2 sky_walker85: In my actual application scenario, I pass an “ORDERTYPESTATE” through a custom label to get the selection list to generate the drop-down box (select), so I cannot use…

There is an error in java link access database, please help me

12345678910111213141516171819 Please enter the code<% try{Class. forName(“sun.jdbc.odbc.JdbcOdbcDriver”);                                                                                     catch(Exception ex){ out.print(ex);                                                                                                                                                                      > String url = “jdbc:odbc:driver={Microsoft Access Driver (*.mdb)};DBQ=”+”D://MyeclipseDate//JSPtest//tt.mdb”; Connection con = DriverManager.getConnection(url); Statement st = con.createStatement(); String sql = “select * from one”; ResultSet rs = st.executeQuery(sql); while(rs.next()){ %> kkkkkk  < % } rs.close(); st.close(); con.close(); }catch(Exception e){out.print(e);} %> java.sql.SQLException: Microsoft ??????????????????

Please tell me how to use php regular expressions, please help me

Please tell me how to use php regular expressions, please help me.I want to make a friendly link detection method to detect whether the other website has a friendly link to my website, that is, to determine whether it has the address of my website; For example: The address of my website is www.csdn.net, But some websites sometimes add rel=”nofollow” to the link, so the friendly link is meaningless. ; I didn’t learn regular expressions well. How can I detect whether this has been added? There are several situations, such as: HTML code csdn HTML code csdn HTML code csdn HTML code csdn HTML code csdn The following is the code I found on the Internet for other people to detect addresses: PHP code $out=strtolower(@file_get_contents(http://www.xxx.com)); if($out){ $out=str_replace(“\r\n”,””,$out); $out=str_replace(“\r”,””,$out); $out=str_replace(“\n”,””,$out); $havelink=preg_match_all(‘/(.*?)/i’, $out, $m); if($havelink||strstr($robots,’nofollow’)){ echo “Friendly link exists”; } } Ask for expert help ——Solution——- ————- In a roundabout way, I am also very weak in regular expressions. I need to find links related to myself and then determine whether there is a key code PHP code $array = <<csdn csdn csdn csdn HTML; preg_match_all('/()/is', $array, $match); if (isset($match[1])) { foreach ($match[1] as $html) { if (stripos($html, 'rel="nofollow"') !== FALSE) echo…

PHP related problems, you will definitely know it, please help me, a newbie, solve it.

PHP problem, you must know it, please help me, a newbie, to solve itThe page originally showed that the data read from the database is sorted by time. I want to add two buttons, one is sorted by age, and the other is sorted by time. . My question is how to execute “select * from log order by l_age” with one click of the control sorted by age;“select * from log order by l_time” with one click of the control sorted by time. You can use the onclick event of submit or select. Or do you have a better way? Thank you ——Solution——————– Form Construct query string$orderkey = isset($_GET[‘orderkey’]) && $_GET[‘orderkey’] == ‘Sort by age’ ? ‘l_age’ :’l_time’ ;$sql = “select * from log order by $orderkey”; ——Solution——————– PHP code Sort by age

Questions about ThinkPHP, please help me

ThinkPHP problem, please help meI just started using ThinkPHP and I am not familiar with many placesNow I have uploaded a file and want to save the path of the uploaded file to the database. However, after I enable debugging , it can be stored in the database normally.When I turn off debugging, the local path of the file is empty. What’s going on? ? ? The local path format is as follows:C:/AppServ/www/Extend/ABL.sysI am wondering now, does THinkPHP check the adding of data after debugging is turned off? I want it to be stored normally, what should I do? ——Solution——————– Clear the cache first. TP uses the cache when debugging is turned off. I’ve had this problem before

Please help me, PHP master, what to do with this string&#183

Please help PHP master how to deal with this string·$str = “http://www.test.com/imges/1.jpg–1,http://www.test.com /imges/3.jpg–2,http://www.test.com/imges/3.jpg–3”; I don’t know how to write regular expressions for the results I want />$str1 = “http://www.test.com/imges/1.jpg,http://www.test.com/imges/3.jpg,http://www.test. com/imges/3.jpg”; $str2 = “1,2,3”; Please help me ——Solution——————– PHP code $str = “http://www.test.com/imges/1.jpg–1,http://www.test.com/imges/3.jpg–2,http://www.test. com/imges/3.jpg–3″; $str1= preg_replace(‘/–(\d+)/’,”,$str); preg_match_all(‘/–(\d+)/’,$str,$m); $str2=join(‘,’,$m[1]);

Please help me, I’m interested in this PHP interface for reading mysql. Why can’t I read the data?

Please help me find out why this PHP interface for reading mysql cannot read data???This is to create a database CREATE TABLE IF NOT EXISTS `tm_comment` (`playerID` text NOT NULL,`message` text NOT NULL,`color` text NOT NULL,`fontsize` varchar(3) NOT NULL,` mode` varchar(2) NOT NULL,`playTime` varchar(4) NOT NULL,`date` text NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; This is the writing interface <?php $ vid = $_POST[‘playerID’]; $message =$_POST[‘message’]; $color =$_POST[‘color’]; $fOntsize=$_POST[ ‘fontsize’]; $mode =$_POST[‘mode’]; $playtime =$_POST[‘playTime’]; $date =$_POST[‘date’]; $cOnn=mysql_connect(“localhost”, “root”, “root”); mysql_query(“set names ‘utf8′”,$conn); mysql_select_db(“ultrax”, $conn); $exec=”INSERT INTO `tm_comment` (`playerID`, `message`, `color`, `fontsize`, `mode`, `playTime`, `date`) VALUES (‘$ vid’,’$message’,’$color’,’$fontsize’,’$mode’,’$playtime’,’$date’)”; $result=mysql_query($exec,$conn) ;mysql_close($conn);?> At this time, read the interface <?phpheader(‘Content-Type: text/xml;’);$id=$_GET[‘id’];$link=mysql_connect( “localhost”,”root”,”root”); mysql_select_db(“ultrax”, $link); $q=”SELECT * FROM `tm_comment` WHERE playerID =$id”;mysql_query(“SET NAMES utf8”); $rs = mysql_query($q, $link); if(!$rs){die(“Valid result!”);}echo “\n”;echo “\n”;while($row = mysql_fetch_row($rs))echo “$row[5]$row[1]$row[6]\n”; echo “”;mysql_free_result($rs); ?> Now there is a problem, my interface can write data >But it just can’t be read (I wrote the database IP, user name, password, and database name correctly) – —–Solution——————–$id=$_GET[‘id’]; It is impossible to get the id here because the id column does not exist in your database. ——Solution——————–$ q=”SELECT * FROM `tm_comment` WHERE playerID =’$id’”; Because `playerID` text NOT NULL, ——Solution——————–Correct solution . . . How to…

Contact Us

Contact us

181-3619-1160

Online consultation: QQ交谈

E-mail: [email protected]

Working hours: Monday to Friday, 9:00-17:30, holidays off

Follow wechat
Scan wechat and follow us

Scan wechat and follow us

Follow Weibo
Back to top
首页
微信
电话
搜索