FTP through JAVA
Hi, I'm writing an application to transfer (get) some files from multiple solaris servers periodically for pot processing. I've used a socked connection at port 21 and successfully established a connection. The problem i'm havng is that each other command than PWD and CWD are being rejected with message "command not understood".
I'm writing this app for windows platform. Can anybody please come up with suggestions as i'm badly stuck!
Thanks\\
Haroon Mughal
HI everyone,
You can use the com.sun package. There they have a FTPClient class.
Alternatively you can connect to a ftp site using the URL class as below
URL url = new URL("ftp://user:[email protected]/polo.zip");Connect to the site and get the inputstream and read the file using streams.
If your ftp site uses normal url without the pass and username then simple use the Authenticator class to authenticate yourself in if you need authentication
Let me know me know whether it works
Richard West
Similar Messages
-
Q: FTP through java?
Hello,
I am trying to do an FTP through java. Does anybody know how I can spawn an FTP process and send ftp commands to it from my java program?
I am on a Solaris system BTW.
Thankyou in advance...I see you haven't assigned any duke dollars to your question. Let me tell you how does the Duke Dollar system work. Observe the following example...
I know the answer.
My rates are as follows:
zero duke dollars - vague hint
one to five duke dollars - +definite answer
six to ten duke dollars - +full file/package name
ten to fiteen duke dollars - +URL information
more than fifteen duke dollars - +full URL with download information
Pick your choice and select the appropriate answer:
0 - There are premade classes that allow you to use FTP in Java.
1 - 5 IBM have created a package that will allow you to do things that you desire.
6-10 You should be looking for the FTP Beans Suite by IBM It comprises of two beans - the FTPProtocol bean and the FTPUI bean, both are very useful, especially in your situation.
11-15 You can find this suite at http://www.alphaworks.ibm.com
16+ go here http://www.alphaworks.ibm.com/ab.nsf/bean/FTP to add file transfer functions to your applications... without writing a line of code. -
Error while downloading through ftp using Java
I have attempted to download a file using ftp through java this is my code
import sun.net.www.protocol.ftp.FtpURLConnection;
import sun.net.ftp.FtpClient;
import sun.net.TelnetInputStream;
import java.net.*;
import java.io.*;
import javax.swing.*;
import java.awt.*;
public class PasswordedPageViewer {
public static void main (String[] args) {
try {
//Open the URLConnection for reading
FtpClient cli = new FtpClient();
cli.openServer("mycgiserver.com", 21);
cli.login("//Username//", "//password//");
TelnetInputStream ins = cli.get("mail.jsp");
BufferedReader d = new BufferedReader(new InputStreamReader(ins));
while(d.readLine().length()>0){
System.out.println(d.readLine());
catch (MalformedURLException e) {
System.err.println(args[0] + " is not a parseable URL");
catch (IOException e) {
e.printStackTrace();
System.err.println(e);
} // end main
} // end SourceViewer2
But this keeps failing and returning the following error message
sun.net.TelnetProtocolException: misplaced CR in input
at sun.net.TelnetInputStream.read(TelnetInputStream.java:96)
at sun.net.TelnetInputStream.read(TelnetInputStream.java:130)
at sun.net.TelnetInputStream.read(TelnetInputStream.java:115)
at java.io.InputStreamReader.fill(InputStreamReader.java:173)
at java.io.InputStreamReader.read(InputStreamReader.java:249)
at java.io.BufferedReader.fill(BufferedReader.java:139)
at java.io.BufferedReader.readLine(BufferedReader.java:299)
at java.io.BufferedReader.readLine(BufferedReader.java:362)
at PasswordedPageViewer.main(PasswordedPageViewer.java:30)
sun.net.TelnetProtocolException: misplaced CR in input
Can anyone helpEven so. Try simplifying. You only need one sun.* class:
import java.io.*;
import sun.net.ftp.FtpClient;
public class FtpGet {
public static void main( String[] argv ) throws Exception {
FtpClient c = new FtpClient();
c.openServer( "ftp.yourplace.com" );
c.login( "user", "password );
InputStream in = c.get( "yourFile.txt" );
BufferedReader r = new BufferedReader(new InputStreamReader(in));
String line = r.readLine();
while ( null != line ) {
System.out.println( line );
line = r.readLine();
} -
Getting result from a telnet command through Java
Hi,
I've been using a set of classes found here: http://javatelnet.org/
to do telnet through Java in a non-interactive mode.
However I've got a problem when retrieving the result of a command sent to the remote host: the classes read the stream until the prompt is encountered; my problem is I must execute commands on several remote hosts, and the prompt is not necessarily the same on all hosts.
Is there a simple means to establish a telnet connection through Java and retrieve the result of the commands?
Any help would be appreciated.Thanks again, this is a very good article
I see it is still the same strategy to get the result of a command : wait 'til the prompt is sent. Maybe there is just no other way to get it .
But as I don't know the prompt on the different hosts I have to query, this won't do it.
The article gave me an idea though : I only need to count the files in a directory on the remote host; until now I was trying to send the 'ls | wc -l' command by Telnet.
Maybe I can simply do it by FTP (retrieve the list of files, and then count the lines with JAVA). -
Hot to call forms11g fmx file through Java executable
Hi,
Iam having one file in some folder which will come through FTP , whenever file comes to the folder i should call the some form fmx file through JAVA so that my form will take care rest of the things .
My question is how to call fmx through Java executable in windows environment.
thanks in advance
GVHi All,
Thnaks for the Info. But my requirement is different.
1) whenever i received a file through FTP from other server to my server , some folder say d:\Test
a) some batch program has to trigger and first it should take the backup of the received file to some other folder say d:\archive
b) some batch program has to trigger to call the forms fmx file so that form will take care of reading from the file and put the data to database for the received file in d:\Test.
Assume that it is in windows environment/Linux Environment . How i can achieve these tasks. There should not any user intervention in this , everything is automatic.
Please guide me any solutions
Thanks in advance
GV -
How to change system time through java program
Hi
I want to know, how to change system time through java program.
give me a idia with example.
ThanksThere isn't any core Java API for this. Use JNI or call an external process with Runtime.exec().
~ -
Need Help-How Store the input parameter through java bean
Hello Sir,
I have a simple Issue but It is not resolve by me i.e input parameter
are not store in Ms-Access.
I store the input parameter through Standard Action <jsp:useBean>.
jsp:useBean call a property IssueData. this property exist in
SimpleBean which create a connection from DB and insert the data.
At run time servlet and server also show that loggging are saved in DB.
But when I open the table in Access. Its empty.
Ms-Access have two fields- User, Password both are text type.
Please review these code:
login.html:
<html>
<head>
<title>A simple JSP application</title>
<head>
<body>
<form method="get" action="tmp" >
Name: <input type="text" name="user">
Password: <input type="password" name="pass">
<input type="Submit" value="Submit">
</form>
</body>
</html>LoginServlet.java:
import javax.servlet.*;
import javax.servlet.http.*;
public class LoginServlet extends HttpServlet{
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException{
try
String user=request.getParameter("user");
String pass=request.getParameter("pass");
co.SimpleBean st = new co.SimpleBean();
st.setUserName(user);
st.setPassword(pass);
request.setAttribute("user",st);
request.setAttribute("pass",st);
RequestDispatcher dispatcher1 =request.getRequestDispatcher("submit.jsp");
dispatcher1.forward(request,response);
catch(Exception e)
e.printStackTrace();
}SimpleBean.java:
package co;
import java.util.*;
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.sql.*;
import java.util.*;
public class SimpleBean {
private String user="";
private String pass="";
private String s="";
public String getUserName() {
return user;
public void setUserName(String user) {
this.user = user;
public String getPassword() {
return pass;
public void setPassword(String pass) {
this.pass = pass;
public String getIssueData() //method that create connection with database
try
System.out.println("Printed*************************************************************");
getUserName();
getPassword();
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
System.out.println("Loading....");
Connection con=DriverManager.getConnection("jdbc:odbc:simple");
System.out.println("Connected....");
PreparedStatement st=con.prepareStatement("insert into Table1 values(?,?)");
System.out.println("~~~~~~~~~~~~~~~~~~~~");
String User=getUserName();
st.setString(1,User);
String Password=getPassword();
st.setString(2,Password);
st.executeUpdate();
System.out.println("Query Executed");
con.close();
s= "Your logging is saved in DB ";
System.out.println("Your logging is saved in DB *****************");
return(s);
catch(Exception e)
e.printStackTrace();
return "failed";
}submit.jsp:
This is Submit page
<html><body>
Hello
Student Name: <%= ((co.SimpleBean)request.getAttribute("user")).getUserName() %>
<br>
Password: <%= ((co.SimpleBean)request.getAttribute("pass")).getPassword() %>
<br>
<jsp:useBean id="st" class="co.SimpleBean" scope="request" />
<jsp:getProperty name="st" property="IssueData" />
</body></html>web.xml:<web-app>
<servlet>
<servlet-name>one</servlet-name>
<servlet-class>LoginServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>one</servlet-name>
<url-pattern>/tmp</url-pattern>
</servlet-mapping>
<jsp-file>issue.jsp</jsp-file>
<jsp-file>submit.jsp</jsp-file>
<url-pattern>*.do</url-pattern>
<welcome-file-list>
<welcome-file>Login.html</welcome-file>
</welcome-file-list>
</web-app>Please Help me..Thanks.!!!
--Dear Sir,
Same issue is still persist. Input parameter are not store in database.
After follow your suggestion when I run this program browser show that:i.e
This is Submit page Hello Student Name: vijay
Password: kumar
<jsp:setProperty name="st" property="userName" value="userValue/> Your logging is saved in DB
Please review my code.
login.html:
{code}<html>
<head>
<title>A simple JSP application</title>
<head>
<body>
<form method="get" action="tmp" >
Name: <input type="text" name="user">
Password: <input type="password" name="pass">
<input type="Submit" value="Submit">
</form>
</body>
</html>{code}
LoginServlet.java:
{code}import javax.servlet.*;
import javax.servlet.http.*;
public class LoginServlet extends HttpServlet{
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException{
try
String userValue=request.getParameter("user");
String passValue=request.getParameter("pass");
co.SimpleBean st = new co.SimpleBean();
st.setuserName(userValue);
st.setpassword(passValue);
request.setAttribute("userValue",st);
request.setAttribute("passValue",st);
RequestDispatcher dispatcher1 =request.getRequestDispatcher("submit.jsp");
dispatcher1.forward(request,response);
catch(Exception e)
e.printStackTrace();
}{code}
SimpleBean.java:
{code}package co;
import java.util.*;
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.sql.*;
import java.util.*;
public class SimpleBean {
private String userValue="";
private String passValue="";
private String s="";
public String getuserName() {
return userValue;
public void setuserName(String userValue) {
this.userValue = userValue;
public String getpassword() {
return passValue;
public void setpassword(String passValue) {
this.passValue= passValue ;
public String getissueData() //method that create connection with database
try
System.out.println("Printed*************************************************************");
getuserName();
getpassword();
Class.forName("oracle.jdbc.driver.OracleDriver");
System.out.println("Connection loaded");
Connection con=DriverManager.getConnection("jdbc:oracle:thin:@VijayKumar-PC:1521:XE","SYSTEM","SYSTEM");
System.out.println("Connection created");
PreparedStatement st=con.prepareStatement("insert into vij values(?,?)");
System.out.println("~~~~~~~~~~~~~~~~~~~~");
String userName=getuserName();
st.setString(1,userName);
String password=getpassword();
st.setString(2,password);
st.executeUpdate();
System.out.println("Query Executed");
con.close();
s= "Your logging is saved in DB ";
System.out.println("Your logging is saved in DB *****************");
return(s);
catch(Exception e)
e.printStackTrace();
return "failed";
}{code}
submit.jsp:
{code}This is Submit page
<html><body>
Hello
Student Name: <%= ((co.SimpleBean)request.getAttribute("userValue")).getuserName() %>
<br>
Password: <%= ((co.SimpleBean)request.getAttribute("passValue")).getpassword() %>
<br>
<jsp:useBean id="st" class="co.SimpleBean" scope="request" />
<jsp:setProperty name="st" property="userName" value="userValue/>
<jsp:setProperty name="st" property="password" value="passValue"/>
<jsp:getProperty name="st" property="issueData" />
</body></html>web.xml:<web-app>
<servlet>
<servlet-name>one</servlet-name>
<servlet-class>LoginServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>one</servlet-name>
<url-pattern>/tmp</url-pattern>
</servlet-mapping>
<jsp-file>submit.jsp</jsp-file>
<url-pattern>*.do</url-pattern>
<welcome-file-list>
<welcome-file>Login.html</welcome-file>
</welcome-file-list>
</web-app>Sir I can't use EL code in jsp because I use weblogic 8.1 Application Server.This version are not supported to EL.
Please help me...How store th input parameter in Database through Java Bean -
Error while running executable file through java in WinNT
I would like to run an executable file with Java.
- If I try with notepad or paint, i.e. Windows Applications,
I have no problem.
- I also can run Non-Windows-Own Applications, except one.
I get an error message, if I want to run this program through Java.
I have tried following commands to run an executable file.
Runtime.getRuntime().exec("cmd.exe /c "+command);
Runtime.getRuntime().exec("cmd.exe /c start "+command);
Runtime.getRuntime().exec("cmd.exe /c start /wait "+command);
Runtime.getRuntime().exec("cmd.exe /k start "+command);
command : the path to the executable file
I can run the application directly, if I click the icon on desktop,
but not through Java.
here is the error message I get
screenshot : http://www.aykut.de/error_message.jpg
Text : "Security Check failure"
The Logon System has been tampered with.
The Administrator will need to re-install.
my Idea :
The application is "old".
I think it was written for Win 3.1.
Therefore I don't know if there is any other
possibilty to run a "DOS Exe File" through Java.I have just figured out how it works,
if somebody else here in forum have this problem,
here is the solution :
String path = "F:\...\...\Application.exe";
String envDir = path.substring(0, path.lastIndexOf("\\"));
String[] command = {"cmd.exe", "/c", "start", "/wait", "/D"+envDir, path};
Process process = Runtime.getRuntime().exec(command);
"start /Dpath" => path: environment directory F:\...\...\
"start /wait" => wait until Application.exe terminates
if you use Win95 or Win98 use command.com instead of cmd.exe
Aykut -
Error while trying to access BPEL process through java on localhost
I have a service (CreditRatingService that comes along with install) running on the BPEL engine. Trying to invoke it through java. However, I get an exception. Below is more information. Appreciate any help.
My method
public String invokeBpel()
Map payload;
Hashtable jndi = null;
try
String ssn ="1234";
String xml = "<ssn xmlns=\"http://services.otn.com\">" + ssn + "</ssn>";
Locator locator;
locator = new Locator("default","welcome1",jndi);
IDeliveryService deliveryService =
(IDeliveryService)locator.lookupService(IDeliveryService.SERVICE_NAME );
NormalizedMessage nm = new NormalizedMessage( );
nm.addPart("payload", xml );
NormalizedMessage res =null;
try
res = deliveryService.request("CreditRatingService","process", nm);
catch(RemoteException oNameEx)
System.out.println(oNameEx.getMessage());
payload = res.getPayload();
System.out.println( "BPELProcess CreditRatingService executed!<br>" );
System.out.println( "Credit Rating is " + payload.get("payload") );
catch (Exception e)
System.out.println("This is the exception" + e);
System.out.println(e.getStackTrace());
finally
return "toPage3";
}//end method
Exception text
Failed to create "ejb/collaxa/system/DeliveryBean" bean; exception reported "javax.naming.NameNotFoundException: ejb/collaxa/system/DeliveryBean not found
Env
ADF Business Components:10.1.3.39.84
BPEL Designer 10.1.3.1.0 (Build 061009.0802)
CVS Version Internal to Oracle JDeveloper (client-only)
Java™ Platform 1.5.0_06
Oracle IDE 10.1.3.39.84
Struts Modeler Version 10.1.3.39.84
UML Modelers Version 10.1.3.39.84
Versioning Support 10.1.3.39.84Hashtable jndi = null;
try
String ssn ="1234";
String xml = "<ssn xmlns=\"http://services.otn.com\">" + ssn + "</ssn>";
Locator locator;
locator = new Locator("default","welcome1",jndi);
this implies to be in the same initial context then the bpel engine, whicuh you cannot be as long as you are not either part of the ejb code of orabpel or a child of it. and if you are you can use the Locator API without the jndi properties.
hth clemens -
Issue with sending mail through java stored procedure in Oracle
Hello
I am using Oracle 9i DB. I created a java stored procedure to send mail using the code given below. The java class works fine standalone. When its run from Java, mail is sent as desired. But when the java stored procedure is called from pl/sql "Must issue a STARTTLS command first" error is thrown. Please let me know if am missing something. Tried the same code in 11.2.0.2 DB and got the same error
Error:
javax.mail.MessagingException: 530 5.7.0 Must issue a STARTTLS command first. va6sm31201010igc.6
Code for creating java stored procedure: (T1 is the table created for debugging)
==================================================
create or replace and compile java source named "MailUtil1" AS
import java.util.Enumeration;
import java.util.Properties;
import javax.mail.Message;
import javax.mail.Session;
import javax.mail.Transport;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeMessage;
public class MailUtil1 {
public static void sendMailwithSTARTTLS(String host, //smtp.projectp.com
String from, //sender mail id
String fromPwd,//sender mail pwd
String port,//587
String to,//recepient email ids
String cc,
String subject,
String messageBody) {
try{
Properties props = System.getProperties();
props.put("mail.smtp.starttls.enable", "True"); // added this line
props.put("mail.smtp.host", host);
props.put("mail.smtp.user", from);
props.put("mail.smtp.password", fromPwd);
props.put("mail.smtp.port", port);
props.put("mail.smtp.auth", "true");
#sql { insert into t1 (c1) values ('1'||:host)};
Session session = Session.getDefaultInstance(props, null);
MimeMessage message = new MimeMessage(session);
message.setFrom(new InternetAddress(from));
#sql { insert into t1 (c1) values ('2')};
InternetAddress[] toAddress = new InternetAddress[1];
// To get the array of addresses
for( int i=0; i < toAddress.length; i++ ) { // changed from a while loop
toAddress[i] = new InternetAddress(to);
//System.out.println(Message.RecipientType.TO);
for( int i=0; i < toAddress.length; i++) { // changed from a while loop
message.addRecipient(Message.RecipientType.TO, toAddress);
if (cc!=null) {
InternetAddress [] ccAddress = new InternetAddress[1];
for(int j=0;j<ccAddress.length;j++){
ccAddress[j] = new InternetAddress(cc);
for (int j=0;j<ccAddress.length;j++){
message.addRecipient(Message.RecipientType.CC, ccAddress[j]);
message.setSubject(subject);
message.setText(messageBody);
message.saveChanges();
#sql { insert into t1 (c1) values ('3')};
Enumeration en = message.getAllHeaderLines();
String token;
while(en.hasMoreElements()){
token ="E:"+en.nextElement().toString();
#sql { insert into t1 (c1) values (:token)};
token ="ConTyp:"+message.getContentType();
#sql { insert into t1 (c1) values (:token)};
token = "Encod:"+message.getEncoding();
#sql { insert into t1 (c1) values (:token)};
token = "Con:"+message.getContent();
#sql { insert into t1 (c1) values (:token)};
Transport transport = session.getTransport("smtp");
#sql { insert into t1 (c1) values ('3.1')};
transport.connect(host, from, fromPwd);
#sql { insert into t1 (c1) values ('3.2')};
transport.sendMessage(message, message.getAllRecipients());
#sql { insert into t1 (c1) values ('3.3')};
transport.close();
#sql { insert into t1 (c1) values ('4')};
catch(Exception e){
e.printStackTrace();
String ex= e.toString();
try{
#sql { insert into t1 (c1) values (:ex)};
catch(Exception e1)
Edited by: user12050615 on Jan 16, 2012 12:18 AMHello,
Thanks for the reply. Actually I have seen that post before creating this thread. I thought that I could make use of java mail to work around this problem. I created a java class that succesfully sends mail to SSL host. I tried to call this java class from pl-sql through java stored procedure. That did not work
So, is this not supported in Oracle ? Please note that I have tested this in both 9i and 11g , in both the versions I got the error. You can refer to the code in the above post.
Thanks
Srikanth
Edited by: user12050615 on Jan 16, 2012 12:17 AM -
How to send sms through java program?
hi,
i am trying to send sms through java program.i am usining ubuntu 6.04.i am using modem MC35i.i use the jSMSEnjine.jar and rxtxcomm.jar.
these are the following program.
import org.jsmsengine.*;
import java.util.*;
class SendMessage
public static void main(String[] args)
int status;
// Create jSMSEngine service.
CService srv = new CService("Com2",9600);
//CService srv = new CService("COM2",9600);
System.out.println();
System.out.println("SendMessage(): sample application.");
System.out.println(" Using " + srv._name + " " + srv._version);
System.out.println();
try
// Initialize service.
srv.initialize();
Thread thread =Thread.currentThread();
thread.sleep(1000);
System.out.println(srv);
// Set the cache directory.
srv.setCacheDir(".\\");
// Set the phonebook.
// srv.setPhoneBook("../misc/phonebook.xml");
// Connect to GSM device.
status = srv.connect();
// Did we connect ok?
int st=CService.ERR_OK;
System.out.println(st);
System.out.println(status);
if (status == CService.ERR_OK)
// Set the operation mode to PDU - default is ASCII.
srv.setOperationMode(CService.MODE_PDU);
// Set the SMSC number (set to default).
srv.setSmscNumber("");
// Print out GSM device info...
System.out.println("Mobile Device Information: ");
System.out.println(" Manufacturer : " + srv.getDeviceInfo().getManufacturer());
System.out.println(" Model : " + srv.getDeviceInfo().getModel());
System.out.println(" Serial No : " + srv.getDeviceInfo().getSerialNo());
System.out.println(" IMSI : " + srv.getDeviceInfo().getImsi());
System.out.println(" S/W Version : " + srv.getDeviceInfo().getSwVersion());
System.out.println(" Battery Level : " + srv.getDeviceInfo().getBatteryLevel() + "%");
System.out.println(" Signal Level : " + srv.getDeviceInfo().getSignalLevel() + "%");
// Create a COutgoingMessage object and dispatch it.
// *** Please update the phone number with one of your choice ***
// String smsLengthTest="Hi"+"\nTesting is going on.Test for sending unlimited number of charecter.So you will get N number of SMS.Initially I trancate the whole string by 70 charecter.Later I will put it upto 90 charecter.Some chararecter should kept for header portion.I don't know the total number.It is just test.If you got the sms u should appreciate me...This is Ripon...I have written sms program";
String smsLengthTest="Hi\n"+"This is Govindo";
int mao=smsLengthTest.length();
System.out.println("Length of sms :"+mao);
String smsNo="9433314095";
smsNo="+91"+smsNo;
if(mao<70)
COutgoingMessage msg = new COutgoingMessage(smsNo,smsLengthTest);
// Character set is 7bit by default - lets make it UNICODE :)
// We can do this, because we are in PDU mode (look at line 63). When in ASCII mode,
// this does not make ANY difference...
msg.setMessageEncoding(CMessage.MESSAGE_ENCODING_UNICODE);
if (srv.sendMessage(msg) == CService.ERR_OK) System.out.println("Message Sent!");
else System.out.println("Message Failed!");
else
// COutgoingMessage msg = new COutgoingMessage(smsNo,smsLengthTest);
// LinkedList messageList;
// messageList = new LinkedList();
// messageList.add(msg);
// LinkedList maooo=new LinkedList();
// maooo=srv.splitLargeMessages(messageList);
int sizelength=0;
int counter=0;
sizelength=smsLengthTest.length();
System.out.println("SMS length :"+sizelength);
int smsCntr=sizelength/70;
System.out.println("smsCntr :"+smsCntr);
counter=smsCntr+1;
int j=70;
int k=0;
try
for(int i=0;i<smsCntr;i++)
String test="";
test=test+i;
test=smsLengthTest.substring(k,j);
System.out.println(test);
System.out.println(test.length());
COutgoingMessage msg = new COutgoingMessage(smsNo, test);
System.out.println("hi this is suman" + smsNo);
// Character set is 7bit by default - lets make it UNICODE :)
// We can do this, because we are in PDU mode (look at line 63). When in ASCII mode,
// this does not make ANY difference...
msg.setMessageEncoding(CMessage.MESSAGE_ENCODING_UNICODE);
if (srv.sendMessage(msg) == CService.ERR_OK) System.out.println("Message Sent!");
else System.out.println("Message Failed!");
k=k+70;
j=j+70;
catch(Exception e)
System.out.println("Error...1");
e.printStackTrace();
e.getMessage();
String lastPortion=smsLengthTest.substring(k);
System.out.println(lastPortion);
COutgoingMessage msg = new COutgoingMessage(smsNo, lastPortion);
// Character set is 7bit by default - lets make it UNICODE :)
// We can do this, because we are in PDU mode (look at line 63). When in ASCII mode,
// this does not make ANY difference...
msg.setMessageEncoding(CMessage.MESSAGE_ENCODING_UNICODE);
if (srv.sendMessage(msg) == CService.ERR_OK) System.out.println("Message Sent!");
else System.out.println("Message Failed!");
// Disconnect from GSM device.
srv.disconnect();
else System.out.println("Connection to mobile failed, error: " + status);
catch (Exception e)
e.printStackTrace();
System.exit(0);
the error is:
SendMessage(): sample application.
Using jSMSEngine API 1.2.6 (B1)
org.jsmsengine.CService@addbf1
0
-101
Connection to mobile failed, error: -101
please help me,its very urgent.come back in about 5 years, we may have time for you by then.
In the meantime, how about contacting the people who wrote that library and asking them nicely for help (rather than trying to order people to drop whatever they're doing and jump through hoops to accommodate your every wish as you're doing here)? -
Inserting a blob in the table through java or Oracle ApplicationFramework
I am new to Oracle framework. I have a requirement to insert one file(i.e blob) into the database from custom location.(ie.D:\sample.txt). through java or OAF. But i am unable to insert the file. Is there any specific function to insert blob fields in the database...........
Did you take a look at
<JDEV_CLIENT_INSTALL_DIR>\jdevdoc\devguide\feat\feat_fileload.htm -
How to get the source code of an HTML page in Text file Through java?
How to get the source code of an HTML page in Text file Through java?
I am coding an application.one module of that application is given below:
The first part of the application is to connect our application to the existing HTML form.
This module would make a connection with the HTML page. The HTML page contains the coding for the Form with various elements. The form may be a simple form with one or two fields or a complex one like the form for registering for a new Bank Account or new email account.
The module will first connect through the HTML page and will fetch the HTML code into a Text File so that the code can be further processed.
Could any body provide coding hint for thatYou're welcome. How about awarding them duke stars?
edit: cheers! -
Running windows command through java code
Hello
i want to execute jar.exe through java code , i have written following piece of code , but it isn't working
ProcessBuilder processBuilder = new ProcessBuilder(new String[]{"cmd.exe","/c","%java_home%\\bin\\jar.exe"});
Process process = processBuilder.start();
BufferedReader inputReader = new BufferedReader(new InputStreamReader(process.getErrorStream()));
String line = inputReader.readLine();
while(line != null){
System.out.println(line);
line = inputReader.readLine();
does anybody knows why
Regards
Edited by: Mayur Mitkari on Mar 5, 2013 10:19 PM
Edited by: Mayur Mitkari on Mar 5, 2013 10:20 PM
Edited by: Mayur Mitkari on Mar 5, 2013 10:20 PMsorry for that , but the
Runtime runtime = Runtime.getRuntime();
Process proc = runtime.exec(new String[]{"cmd.exe","/c","jar"});
proc.waitFor();
int i = proc.exitValue();
this code was different from first one
and in case of Process if runtime .exec is succesful it is wainting for long time , in this case i want if the runtime.exec is succesful something should be returned
Regards -
Running Unix command through Java
Hi
I am trying to run the unix command "rf filename" through Java and it doesnt seem to work.
Can anyone help in this case please
String cm = "rm ";
String delFile = args[0]; // this path is /data/temp/filename.doc
Process p = Runtime.getRuntime.exec(cmd +delFile);Also since i dont have access to delete the file through my login i always login as root for a few commands.
Is there a way i can specify user name & password & then run the command?
Please let me know
ThanxPlease discard the above msg i got a solution by just adding file.delete
thanx
Maybe you are looking for
-
How do I find out what the file size is before I purchase and download a movie?
I cannot find the file size for movies or TV shows anywhere on iTunes. I need to know how big the file is before I download it.
-
HTMLDB_ITEM with scalar subqueries
How does HTMLDB_ITEM work with scalar subqueries? Suppose I want to do something like select c1,c2,c3, (select htmldb_item.checkbox(1,c4) from sometable where ....) from ... If the scalar subquery doesnt return a row, I dont get my checkbox. How else
-
I am working on putting a loaner ASR 1001 into my infrastructure to replace my 7206 VXR. Currently my uplink to my ISP is fiber and runs into an GBIC SX MM transceiver. No issue with connectivity. When i change the fiber patch over to LC I connect
-
Change the black background in white
Hi, is there a way to change the black background of the kuler interface? I need it white because I'm working on a white paper design project. Thanks :-)
-
Project Presets now 'missing' following un/re-install CS4 Prem Pro
A few glitches were hampering me so, tried and tested, I uninstalled and re-installed the WHOLE CS4 Prem Pro. Now, a big handful of Project Presets are missing. I'm now using v. nice HD footage/files and want to utilize their size and defenition.