Hi,
Well, if you don't know the number of the parameters beforehand, you could use naming like param1, param2, param3.... etc.
Then you could use loop like e.g. this:
int i=1;
String param = null;
while((param = ap.getParameter("param"+i)) != null)
{
//...do something....
i++...
Hi,
Try new SimpleDateFormat("hhmma");
If you look from java API documentation, the 'h' pattern is defined to be "hour in am/pm (1~12)"
-Vepo
Hi,
You can use Runtime.exec() to execute batch files just like any other executable files. I'm not sure what kind of bat file you are going to execute (what you except it to do), but this example below works fine. It runs a batch file that starts a java application named test.
a simple batch...
Hi jamescpp,
I thinks you code work ok itself, but when I tried to resolve this problem I found an very interesting thing: when you login like that the verbose mode is set to off. This is the reason why you can't see the whole server response. I had a command-file like this:
username
password...
Hi,
To use ICMP you must have access to low-level network data (e.g. raw sockets in C). In java, Sockets are assumed be either TCP or UDP sockets and you don't have access to a packet level data. You could use implement ping with C and add it to your java application using JNI. Or you could use...
Hi,
There is also a isDigit() method but it is only for characters. Alternative solution would be (but i'd prefer use that NumberFormatException catching):
String s = "12";
if(isdigit(s))
{
System.out.println(s + " is digit.");
}
else
{
System.out.println(s + "...
Hi Casey,
Here is a _very_ simple example, but I think you get the idea from it.
import javax.swing.*;
import java.awt.event.*;
public class MListener extends JFrame implements MouseListener
{
public static void main(String[] argv)
{
new MListener();
}
public MListener()
{...
Hi,
Your class files should be in directory com\me\MyClass\, so jar-package must be created from the root. Lets assume that your sources are located in c:\classes\com\me\MyClass.
You have to create a jar package from c:\classes\
jar cvf ownPackage.jar com\me\MyClass\*.class
As you can see...
Hi,
Maybe one of the easiest way is to use BASE64Encoder/Decoder (comes with Sun's SDK):
import sun.misc.BASE64Encoder;
import sun.misc.BASE64Decoder;
public class B64Test
{
public static void main(String[] argv) throws Exception
{
// Encoding....
BASE64Encoder encoder = new...
Hi,
That's true that you need always declare a variable before you use it (i.e. define it's type).
But after you have to declared the variable, you don't have to (you mustn't) declare it again. In this case you have declared the class member variables after you can use them in any method...
Hi,
Firstly I have to say that I not so familiar with runtime exec that I could explain that error, but try to execute that command using rt.exec("cmd /c " + ComUtility.getBlisProperty("RemoteBillSys"));
-Vepo
Hi asiavoices,
You have accidently created a new JButton reference in the constructor.
See for example:
private JButton myButton1;
and
JButton myButton1 = new JButton("Button 1");
When you do this, the scope of the myButton1 object that you initialized in the constructor is only...
Hi,
That example cleared the situation, you are getting a java.lang.StackOverflowError because of that recursive call (fast ctrl+c solved situation), so that's why there is no help from catching the Exception. That Error causes JVM to halt, after it prints the stackTrace, which is quite long in...
Okay, here is an easier solution (if you are not using jdk1.3 as I do...)
So I checked out couple of web pages and found this:
http://www.skylit.com/javamethods/faqs/scrollout.html
(Supposing this was about compiler errors...)
-Vepo
Hi Koldark,
Do you mean runtime errors or compiler errors? Runtime errors are easy to write to the file: Just add try - catch to your source and write the error inside the catch-block
E.g.
try
{
do something...
}
catch(Exception e)
{
somewriter.println(e.toString());
}
But if you mean...
Hi,
I don't understand why you want to use switch-statement ;) It doesn't fit very well for this kind of situations... and wushutwist is right, that kind of 'hack-solutions' are hard to maintain later.
But, however, here is one possible way to do it using switch statement:
public class test...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.