Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » Java problem in Eclipse
Java problem in Eclipse [message #195886] Sat, 24 February 2007 06:06 Go to next message
Eclipse UserFriend
Originally posted by: tom.wu.insl-x.com

Hi All,
I am new to Java and write new Java program to connect to my as400
I have problem in } sign
Can you help?
see my code below

thanks


import java.io.*;
import com.ibm.as400.access.*;

public class TEST
{

public static void main(String[] args)
{
// TODO Auto-generated method stub
try
{
AS400 system = new AS400() ;
commandcall cmd = new commandcall(system);
cmd.run("DSPLIB");
as400message[] ml = cmd.getmesagelist() ;
for (int i=0; i<ml.lenght; i++);
{
system.out.println(ml[i].gettext());
}

} <==== keep error in this mark do not know why ??


system.exit(0);

}
}
Re: Java problem in Eclipse [message #195904 is a reply to message #195886] Sat, 24 February 2007 07:18 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: inselathome.yahoo.de

hi,

your catch block is the problem...you donŽt have one...

...
...
catch(Exception e)
{

}

any try must have an catch...

cu,
andi
Re: Java problem in Eclipse [message #195968 is a reply to message #195904] Sat, 24 February 2007 19:18 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: tom.wu.insl-x.com

andi, thanks for your infor
but how come it keeps saying ' i ' problem, it declares i as int alreay



import com.ibm.as400.access.*;

public class TEST
{

//private static final int i = 0;

public static void main(String[] args)
{
// TODO Auto-generated method stub
try
{
AS400 system1 = new AS400() ;
CommandCall cmd = new CommandCall(system1);
cmd.run("CRTLIB TW");
AS400Message[] ml = cmd.getMessageList() ;
for (int i = 0; i<ml.length; i++);
{
System.out.println(ml[i].getText());
^
|_________________ keep saying
problem
}

}
catch(Exception e)
{
e.printStackTrace();

}
System.exit(0);

}
}
"andi" <inselathome@yahoo.de> wrote in message
news:a2a26ba4cd203b30f95e183031423511$1@www.eclipse.org...
> hi,
>
> your catch block is the problem...you don
Re: Java problem in Eclipse [message #195976 is a reply to message #195968] Sat, 24 February 2007 19:08 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: dtoland.email.uophx.edu

Your integer i's scope is the body of the for loop, which in this case consists of a single
empty statement (a semicolon). The flagged statement is an entirely separate code block,
in which i is not declared.

remove the semicolon at the end of :
for (int i = 0; i<ml.length; i++);

--
Dave Toland
dave.toland@verizon.net


"tom" <tom.wu@insl-x.com> wrote in message news:erq1ta$88u$1@utils.eclipse.org...
| andi, thanks for your infor
| but how come it keeps saying ' i ' problem, it declares i as int alreay
|
|
|
| import com.ibm.as400.access.*;
|
| public class TEST
| {
|
| //private static final int i = 0;
|
| public static void main(String[] args)
| {
| // TODO Auto-generated method stub
| try
| {
| AS400 system1 = new AS400() ;
| CommandCall cmd = new CommandCall(system1);
| cmd.run("CRTLIB TW");
| AS400Message[] ml = cmd.getMessageList() ;
| for (int i = 0; i<ml.length; i++);
| {
| System.out.println(ml[i].getText());
| ^
| |_________________ keep saying
| problem
| }
|
| }
| catch(Exception e)
| {
| e.printStackTrace();
|
| }
| System.exit(0);
|
| }
| }
| "andi" <inselathome@yahoo.de> wrote in message
| news:a2a26ba4cd203b30f95e183031423511$1@www.eclipse.org...
| > hi,
| >
| > your catch block is the problem...you don
Re: Java problem in Eclipse [message #196002 is a reply to message #195976] Sat, 24 February 2007 21:03 Go to previous message
Eclipse UserFriend
Originally posted by: tom.wu.insl-x.com

Dave, thanks
Tom
"Dave Toland" <dtoland@email.uophx.edu> wrote in message
news:erq2ft$96c$1@utils.eclipse.org...
> Your integer i's scope is the body of the for loop, which in this case
> consists of a single
> empty statement (a semicolon). The flagged statement is an entirely
> separate code block,
> in which i is not declared.
>
> remove the semicolon at the end of :
> for (int i = 0; i<ml.length; i++);
>
> --
> Dave Toland
> dave.toland@verizon.net
>
>
> "tom" <tom.wu@insl-x.com> wrote in message
> news:erq1ta$88u$1@utils.eclipse.org...
> | andi, thanks for your infor
> | but how come it keeps saying ' i ' problem, it declares i as int alreay
> |
> |
> |
> | import com.ibm.as400.access.*;
> |
> | public class TEST
> | {
> |
> | //private static final int i = 0;
> |
> | public static void main(String[] args)
> | {
> | // TODO Auto-generated method stub
> | try
> | {
> | AS400 system1 = new AS400() ;
> | CommandCall cmd = new CommandCall(system1);
> | cmd.run("CRTLIB TW");
> | AS400Message[] ml = cmd.getMessageList() ;
> | for (int i = 0; i<ml.length; i++);
> | {
> | System.out.println(ml[i].getText());
> | ^
> | |_________________ keep saying
> | problem
> | }
> |
> | }
> | catch(Exception e)
> | {
> | e.printStackTrace();
> |
> | }
> | System.exit(0);
> |
> | }
> | }
> | "andi" <inselathome@yahoo.de> wrote in message
> | news:a2a26ba4cd203b30f95e183031423511$1@www.eclipse.org...
> | > hi,
> | >
> | > your catch block is the problem...you don
Previous Topic:how to move a project to new directory?
Next Topic:Input Data
Goto Forum:
  


Current Time: Wed Apr 24 22:10:33 GMT 2024

Powered by FUDForum. Page generated in 0.05902 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top