aarash_v
چهارشنبه 30 مرداد 1387, 12:08 عصر
با سلام.
من هر فایل *.java رو که می خوام به *.class تبدیل کنم با یک عالمه ارور مواجه می شم. (که مطمئنم این ارورها از Syntax ناشی نمی شن...
لطفا دوستان عزیز توضیح بدید که این مشکلات از کجا ناشی می شن و راه حل این موضوع چیه.
به طور نمونه من می خواستم این فایل رو کامپایل کنم...
import java.io.IOException;
import java.io.PrintStream;
import javax.microedition.io.Connection;
import javax.microedition.io.Connector;
import javax.microedition.lcdui.*;
import javax.wireless.messaging.MessageConnection;
import javax.wireless.messaging.TextMessage;
public final class d extends Form
implements CommandListener
..
d(String s, Display display)
..
super(s);
d = null;
e = null;
j = new String();
a = null;
b = null;
c = null;
s = this;
try
..
s.a = Image.createImage("/res/failface.PNG");
s.b = Image.createImage("/res/smile.PNG");
}
// Misplaced declaration of an exception variable
catch(String s)
..
System.out.println("cant open file on " + s.getMessage());
}
d = display;
g = new StringItem("", "... ï»ھï؛‘ ï»ï؛ژï؛³ï؛ï؛چ");
f = new StringItem("", "");
h = new TextField("", "", 30, 3);
i = new TextField("", "", 1000, 0x20000);
append(g);
append(h);
append(f);
append(i);
addCommand(k);
addCommand(l);
setCommandListener(this);
}
final void a(String s)
..
i.setString(s);
f.setText("Press center select key to insert from Phonebook..\n");
}
final void a(Displayable displayable)
..
e = displayable;
}
public final boolean a(String s, String s1)
..
MessageConnection messageconnection = null;
boolean flag = true;
try
..
String s2 = "sms://";
(s = (TextMessage)(messageconnection = (MessageConnection)Connector.open(s2 = s2 + s)).newMessage("text")).setPayloadText(s1);
messageconnection.send(s);
}
catch(Throwable throwable)
..
j = throwable.toString();
flag = false;
}
if(messageconnection != null)
..
try
..
messageconnection.close();
}
catch(Exception exception)
..
j = exception.toString();
return false;
}
return flag;
} else
..
return false;
}
}
public final void commandAction(Command command, Displayable displayable)
..
if(command == l)
..
d.setCurrent(e);
return;
}
if(command == m)
..
d.setCurrent(this);
return;
}
if(command == k)
..
if(h.getString().length() < 1)
..
command = new Alert("Warning", "Invalid callee number, please retry......", a, AlertType.ERROR);
d.setCurrent(command);
return;
}
c = new h("Sending Message");
d.setCurrent(c);
this = this;
start();
}
}
static TextField a(d d1)
..
return d1.h;
}
static TextField b(d d1)
..
return d1.i;
}
static String c(d d1)
..
return d1.j;
}
static Command a()
..
return m;
}
static Display d(d d1)
..
return d1.d;
}
private Display d;
private Displayable e;
private StringItem f;
private StringItem g;
private TextField h;
private TextField i;
private String j;
Image a;
Image b;
h c;
private static final Command k = new Command("Send", 1, 0);
private static final Command l = new Command("Cancel", 2, 1);
private static final Command m = new Command("Confirm", 1, 1);}
و این همه ارور دریافت کردم: :متعجب:
C:\J2SDK1~1.2_0\bin\d.java:7: package javax.microedition.io does not exist
import javax.microedition.io.Connection;
^
C:\J2SDK1~1.2_0\bin\d.java:8: package javax.microedition.io does not exist
import javax.microedition.io.Connector;
^
C:\J2SDK1~1.2_0\bin\d.java:9: package javax.microedition.lcdui does not exist
import javax.microedition.lcdui.*;
^
C:\J2SDK1~1.2_0\bin\d.java:10: package javax.wireless.messaging does not exist
import javax.wireless.messaging.MessageConnection;
^
C:\J2SDK1~1.2_0\bin\d.java:11: package javax.wireless.messaging does not exist
import javax.wireless.messaging.TextMessage;
^
C:\J2SDK1~1.2_0\bin\d.java:13: cannot resolve symbol
symbol : class Form
location: class d
public final class d extends Form
^
C:\J2SDK1~1.2_0\bin\d.java:14: cannot resolve symbol
symbol : class CommandListener
location: class d
implements CommandListener
^
C:\J2SDK1~1.2_0\bin\d.java:17: cannot resolve symbol
symbol : class Display
location: class d
d(String s, Display display)
^
C:\J2SDK1~1.2_0\bin\d.java:57: cannot resolve symbol
symbol : class Displayable
location: class d
final void a(Displayable displayable)
^
C:\J2SDK1~1.2_0\bin\d.java:57: a(java.lang.String) is already defined in d
final void a(Displayable displayable)
^
C:\J2SDK1~1.2_0\bin\d.java:95: cannot resolve symbol
symbol : class Command
location: class d
public final void commandAction(Command command, Displayable displayable)
^
C:\J2SDK1~1.2_0\bin\d.java:95: cannot resolve symbol
symbol : class Displayable
location: class d
public final void commandAction(Command command, Displayable displayable)
^
C:\J2SDK1~1.2_0\bin\d.java:122: cannot resolve symbol
symbol : class TextField
location: class d
static TextField a(d d1)
^
C:\J2SDK1~1.2_0\bin\d.java:127: cannot resolve symbol
symbol : class TextField
location: class d
static TextField b(d d1)
^
C:\J2SDK1~1.2_0\bin\d.java:137: cannot resolve symbol
symbol : class Command
location: class d
static Command a()
^
C:\J2SDK1~1.2_0\bin\d.java:142: cannot resolve symbol
symbol : class Display
location: class d
static Display d(d d1)
^
C:\J2SDK1~1.2_0\bin\d.java:147: cannot resolve symbol
symbol : class Display
location: class d
private Display d;
^
C:\J2SDK1~1.2_0\bin\d.java:148: cannot resolve symbol
symbol : class Displayable
location: class d
private Displayable e;
^
C:\J2SDK1~1.2_0\bin\d.java:149: cannot resolve symbol
symbol : class StringItem
location: class d
private StringItem f;
^
C:\J2SDK1~1.2_0\bin\d.java:150: cannot resolve symbol
symbol : class StringItem
location: class d
private StringItem g;
^
C:\J2SDK1~1.2_0\bin\d.java:151: cannot resolve symbol
symbol : class TextField
location: class d
private TextField h;
^
C:\J2SDK1~1.2_0\bin\d.java:152: cannot resolve symbol
symbol : class TextField
location: class d
private TextField i;
^
C:\J2SDK1~1.2_0\bin\d.java:154: cannot resolve symbol
symbol : class Image
location: class d
Image a;
^
C:\J2SDK1~1.2_0\bin\d.java:155: cannot resolve symbol
symbol : class Image
location: class d
Image b;
^
C:\J2SDK1~1.2_0\bin\d.java:157: cannot resolve symbol
symbol : class Command
location: class d
private static final Command k = new Command("Send", 1, 0);
^
C:\J2SDK1~1.2_0\bin\d.java:158: cannot resolve symbol
symbol : class Command
location: class d
private static final Command l = new Command("Cancel", 2, 1);
^
C:\J2SDK1~1.2_0\bin\d.java:159: cannot resolve symbol
symbol : class Command
location: class d
private static final Command m = new Command("Confirm", 1, 1);
^
C:\J2SDK1~1.2_0\bin\d.java:29: cannot resolve symbol
symbol : variable a
location: class java.lang.String
s.a = Image.createImage("/res/failface.PNG");
^
C:\J2SDK1~1.2_0\bin\d.java:29: cannot resolve symbol
symbol : variable Image
location: class d
s.a = Image.createImage("/res/failface.PNG");
^
C:\J2SDK1~1.2_0\bin\d.java:30: cannot resolve symbol
symbol : variable b
location: class java.lang.String
s.b = Image.createImage("/res/smile.PNG");
^
C:\J2SDK1~1.2_0\bin\d.java:30: cannot resolve symbol
symbol : variable Image
location: class d
s.b = Image.createImage("/res/smile.PNG");
^
C:\J2SDK1~1.2_0\bin\d.java:33: s is already defined in d(java.lang.String,Display)
catch(String s)
^
C:\J2SDK1~1.2_0\bin\d.java:33: incompatible types
found : java.lang.String
required: java.lang.Throwable
catch(String s)
^
C:\J2SDK1~1.2_0\bin\d.java:35: cannot resolve symbol
symbol : method getMessage ()
location: class java.lang.String
System.out.println("cant open file on " + s.getMessage());
^
C:\J2SDK1~1.2_0\bin\d.java:38: cannot resolve symbol
symbol : class StringItem
location: class d
g = new StringItem("", "... ï»ھï؛‘ ï»ï؛ژï؛³ï؛ï؛چ");
^
C:\J2SDK1~1.2_0\bin\d.java:39: cannot resolve symbol
symbol : class StringItem
location: class d
f = new StringItem("", "");
^
C:\J2SDK1~1.2_0\bin\d.java:40: cannot resolve symbol
symbol : class TextField
location: class d
h = new TextField("", "", 30, 3);
^
C:\J2SDK1~1.2_0\bin\d.java:41: cannot resolve symbol
symbol : class TextField
location: class d
i = new TextField("", "", 1000, 0x20000);
^
C:\J2SDK1~1.2_0\bin\d.java:157: cannot resolve symbol
symbol : class Command
location: class d
private static final Command k = new Command("Send", 1, 0);
^
C:\J2SDK1~1.2_0\bin\d.java:158: cannot resolve symbol
symbol : class Command
location: class d
private static final Command l = new Command("Cancel", 2, 1);
^
C:\J2SDK1~1.2_0\bin\d.java:48: cannot resolve symbol
symbol : method setCommandListener (d)
location: class d
setCommandListener(this);
^
C:\J2SDK1~1.2_0\bin\d.java:64: cannot resolve symbol
symbol : class MessageConnection
location: class d
MessageConnection messageconnection = null;
^
C:\J2SDK1~1.2_0\bin\d.java:69: cannot resolve symbol
symbol : class TextMessage
location: class d
(s = (TextMessage)(messageconnection = (MessageConnection)Connector.open(s2 = s2 + s)).newMessage("text")).setPayloadText(s1);
^
C:\J2SDK1~1.2_0\bin\d.java:69: cannot resolve symbol
symbol : class MessageConnection
location: class d
(s = (TextMessage)(messageconnection = (MessageConnection)Connector.open(s2 = s2 + s)).newMessage("text")).setPayloadText(s1);
^
C:\J2SDK1~1.2_0\bin\d.java:69: cannot resolve symbol
symbol : variable Connector
location: class d
(s = (TextMessage)(messageconnection = (MessageConnection)Connector.open(s2 = s2 + s)).newMessage("text")).setPayloadText(s1);
^
C:\J2SDK1~1.2_0\bin\d.java:69: cannot resolve symbol
symbol : method setPayloadText (java.lang.String)
location: class java.lang.String
(s = (TextMessage)(messageconnection = (MessageConnection)Connector.open(s2 = s2 + s)).newMessage("text")).setPayloadText(s1);
^
C:\J2SDK1~1.2_0\bin\d.java:159: cannot resolve symbol
symbol : class Command
location: class d
private static final Command m = new Command("Confirm", 1, 1);
^
C:\J2SDK1~1.2_0\bin\d.java:111: cannot resolve symbol
symbol : class Alert
location: class d
command = new Alert("Warning", "Invalid callee number, please retry......", a, AlertType.ERROR);
^
C:\J2SDK1~1.2_0\bin\d.java:111: cannot resolve symbol
symbol : variable AlertType
location: class d
command = new Alert("Warning", "Invalid callee number, please retry......", a, AlertType.ERROR);
^
C:\J2SDK1~1.2_0\bin\d.java:115: cannot access javax.microedition.lcdui.Form
file javax\microedition\lcdui\Form.class not found
c = new h("Sending Message");
^
C:\J2SDK1~1.2_0\bin\d.java:117: cannot assign a value to final variable this
this = this;
^
C:\J2SDK1~1.2_0\bin\d.java:118: cannot resolve symbol
symbol : method start ()
location: class d
start();
^
52 errors
با تشکر.
من هر فایل *.java رو که می خوام به *.class تبدیل کنم با یک عالمه ارور مواجه می شم. (که مطمئنم این ارورها از Syntax ناشی نمی شن...
لطفا دوستان عزیز توضیح بدید که این مشکلات از کجا ناشی می شن و راه حل این موضوع چیه.
به طور نمونه من می خواستم این فایل رو کامپایل کنم...
import java.io.IOException;
import java.io.PrintStream;
import javax.microedition.io.Connection;
import javax.microedition.io.Connector;
import javax.microedition.lcdui.*;
import javax.wireless.messaging.MessageConnection;
import javax.wireless.messaging.TextMessage;
public final class d extends Form
implements CommandListener
..
d(String s, Display display)
..
super(s);
d = null;
e = null;
j = new String();
a = null;
b = null;
c = null;
s = this;
try
..
s.a = Image.createImage("/res/failface.PNG");
s.b = Image.createImage("/res/smile.PNG");
}
// Misplaced declaration of an exception variable
catch(String s)
..
System.out.println("cant open file on " + s.getMessage());
}
d = display;
g = new StringItem("", "... ï»ھï؛‘ ï»ï؛ژï؛³ï؛ï؛چ");
f = new StringItem("", "");
h = new TextField("", "", 30, 3);
i = new TextField("", "", 1000, 0x20000);
append(g);
append(h);
append(f);
append(i);
addCommand(k);
addCommand(l);
setCommandListener(this);
}
final void a(String s)
..
i.setString(s);
f.setText("Press center select key to insert from Phonebook..\n");
}
final void a(Displayable displayable)
..
e = displayable;
}
public final boolean a(String s, String s1)
..
MessageConnection messageconnection = null;
boolean flag = true;
try
..
String s2 = "sms://";
(s = (TextMessage)(messageconnection = (MessageConnection)Connector.open(s2 = s2 + s)).newMessage("text")).setPayloadText(s1);
messageconnection.send(s);
}
catch(Throwable throwable)
..
j = throwable.toString();
flag = false;
}
if(messageconnection != null)
..
try
..
messageconnection.close();
}
catch(Exception exception)
..
j = exception.toString();
return false;
}
return flag;
} else
..
return false;
}
}
public final void commandAction(Command command, Displayable displayable)
..
if(command == l)
..
d.setCurrent(e);
return;
}
if(command == m)
..
d.setCurrent(this);
return;
}
if(command == k)
..
if(h.getString().length() < 1)
..
command = new Alert("Warning", "Invalid callee number, please retry......", a, AlertType.ERROR);
d.setCurrent(command);
return;
}
c = new h("Sending Message");
d.setCurrent(c);
this = this;
start();
}
}
static TextField a(d d1)
..
return d1.h;
}
static TextField b(d d1)
..
return d1.i;
}
static String c(d d1)
..
return d1.j;
}
static Command a()
..
return m;
}
static Display d(d d1)
..
return d1.d;
}
private Display d;
private Displayable e;
private StringItem f;
private StringItem g;
private TextField h;
private TextField i;
private String j;
Image a;
Image b;
h c;
private static final Command k = new Command("Send", 1, 0);
private static final Command l = new Command("Cancel", 2, 1);
private static final Command m = new Command("Confirm", 1, 1);}
و این همه ارور دریافت کردم: :متعجب:
C:\J2SDK1~1.2_0\bin\d.java:7: package javax.microedition.io does not exist
import javax.microedition.io.Connection;
^
C:\J2SDK1~1.2_0\bin\d.java:8: package javax.microedition.io does not exist
import javax.microedition.io.Connector;
^
C:\J2SDK1~1.2_0\bin\d.java:9: package javax.microedition.lcdui does not exist
import javax.microedition.lcdui.*;
^
C:\J2SDK1~1.2_0\bin\d.java:10: package javax.wireless.messaging does not exist
import javax.wireless.messaging.MessageConnection;
^
C:\J2SDK1~1.2_0\bin\d.java:11: package javax.wireless.messaging does not exist
import javax.wireless.messaging.TextMessage;
^
C:\J2SDK1~1.2_0\bin\d.java:13: cannot resolve symbol
symbol : class Form
location: class d
public final class d extends Form
^
C:\J2SDK1~1.2_0\bin\d.java:14: cannot resolve symbol
symbol : class CommandListener
location: class d
implements CommandListener
^
C:\J2SDK1~1.2_0\bin\d.java:17: cannot resolve symbol
symbol : class Display
location: class d
d(String s, Display display)
^
C:\J2SDK1~1.2_0\bin\d.java:57: cannot resolve symbol
symbol : class Displayable
location: class d
final void a(Displayable displayable)
^
C:\J2SDK1~1.2_0\bin\d.java:57: a(java.lang.String) is already defined in d
final void a(Displayable displayable)
^
C:\J2SDK1~1.2_0\bin\d.java:95: cannot resolve symbol
symbol : class Command
location: class d
public final void commandAction(Command command, Displayable displayable)
^
C:\J2SDK1~1.2_0\bin\d.java:95: cannot resolve symbol
symbol : class Displayable
location: class d
public final void commandAction(Command command, Displayable displayable)
^
C:\J2SDK1~1.2_0\bin\d.java:122: cannot resolve symbol
symbol : class TextField
location: class d
static TextField a(d d1)
^
C:\J2SDK1~1.2_0\bin\d.java:127: cannot resolve symbol
symbol : class TextField
location: class d
static TextField b(d d1)
^
C:\J2SDK1~1.2_0\bin\d.java:137: cannot resolve symbol
symbol : class Command
location: class d
static Command a()
^
C:\J2SDK1~1.2_0\bin\d.java:142: cannot resolve symbol
symbol : class Display
location: class d
static Display d(d d1)
^
C:\J2SDK1~1.2_0\bin\d.java:147: cannot resolve symbol
symbol : class Display
location: class d
private Display d;
^
C:\J2SDK1~1.2_0\bin\d.java:148: cannot resolve symbol
symbol : class Displayable
location: class d
private Displayable e;
^
C:\J2SDK1~1.2_0\bin\d.java:149: cannot resolve symbol
symbol : class StringItem
location: class d
private StringItem f;
^
C:\J2SDK1~1.2_0\bin\d.java:150: cannot resolve symbol
symbol : class StringItem
location: class d
private StringItem g;
^
C:\J2SDK1~1.2_0\bin\d.java:151: cannot resolve symbol
symbol : class TextField
location: class d
private TextField h;
^
C:\J2SDK1~1.2_0\bin\d.java:152: cannot resolve symbol
symbol : class TextField
location: class d
private TextField i;
^
C:\J2SDK1~1.2_0\bin\d.java:154: cannot resolve symbol
symbol : class Image
location: class d
Image a;
^
C:\J2SDK1~1.2_0\bin\d.java:155: cannot resolve symbol
symbol : class Image
location: class d
Image b;
^
C:\J2SDK1~1.2_0\bin\d.java:157: cannot resolve symbol
symbol : class Command
location: class d
private static final Command k = new Command("Send", 1, 0);
^
C:\J2SDK1~1.2_0\bin\d.java:158: cannot resolve symbol
symbol : class Command
location: class d
private static final Command l = new Command("Cancel", 2, 1);
^
C:\J2SDK1~1.2_0\bin\d.java:159: cannot resolve symbol
symbol : class Command
location: class d
private static final Command m = new Command("Confirm", 1, 1);
^
C:\J2SDK1~1.2_0\bin\d.java:29: cannot resolve symbol
symbol : variable a
location: class java.lang.String
s.a = Image.createImage("/res/failface.PNG");
^
C:\J2SDK1~1.2_0\bin\d.java:29: cannot resolve symbol
symbol : variable Image
location: class d
s.a = Image.createImage("/res/failface.PNG");
^
C:\J2SDK1~1.2_0\bin\d.java:30: cannot resolve symbol
symbol : variable b
location: class java.lang.String
s.b = Image.createImage("/res/smile.PNG");
^
C:\J2SDK1~1.2_0\bin\d.java:30: cannot resolve symbol
symbol : variable Image
location: class d
s.b = Image.createImage("/res/smile.PNG");
^
C:\J2SDK1~1.2_0\bin\d.java:33: s is already defined in d(java.lang.String,Display)
catch(String s)
^
C:\J2SDK1~1.2_0\bin\d.java:33: incompatible types
found : java.lang.String
required: java.lang.Throwable
catch(String s)
^
C:\J2SDK1~1.2_0\bin\d.java:35: cannot resolve symbol
symbol : method getMessage ()
location: class java.lang.String
System.out.println("cant open file on " + s.getMessage());
^
C:\J2SDK1~1.2_0\bin\d.java:38: cannot resolve symbol
symbol : class StringItem
location: class d
g = new StringItem("", "... ï»ھï؛‘ ï»ï؛ژï؛³ï؛ï؛چ");
^
C:\J2SDK1~1.2_0\bin\d.java:39: cannot resolve symbol
symbol : class StringItem
location: class d
f = new StringItem("", "");
^
C:\J2SDK1~1.2_0\bin\d.java:40: cannot resolve symbol
symbol : class TextField
location: class d
h = new TextField("", "", 30, 3);
^
C:\J2SDK1~1.2_0\bin\d.java:41: cannot resolve symbol
symbol : class TextField
location: class d
i = new TextField("", "", 1000, 0x20000);
^
C:\J2SDK1~1.2_0\bin\d.java:157: cannot resolve symbol
symbol : class Command
location: class d
private static final Command k = new Command("Send", 1, 0);
^
C:\J2SDK1~1.2_0\bin\d.java:158: cannot resolve symbol
symbol : class Command
location: class d
private static final Command l = new Command("Cancel", 2, 1);
^
C:\J2SDK1~1.2_0\bin\d.java:48: cannot resolve symbol
symbol : method setCommandListener (d)
location: class d
setCommandListener(this);
^
C:\J2SDK1~1.2_0\bin\d.java:64: cannot resolve symbol
symbol : class MessageConnection
location: class d
MessageConnection messageconnection = null;
^
C:\J2SDK1~1.2_0\bin\d.java:69: cannot resolve symbol
symbol : class TextMessage
location: class d
(s = (TextMessage)(messageconnection = (MessageConnection)Connector.open(s2 = s2 + s)).newMessage("text")).setPayloadText(s1);
^
C:\J2SDK1~1.2_0\bin\d.java:69: cannot resolve symbol
symbol : class MessageConnection
location: class d
(s = (TextMessage)(messageconnection = (MessageConnection)Connector.open(s2 = s2 + s)).newMessage("text")).setPayloadText(s1);
^
C:\J2SDK1~1.2_0\bin\d.java:69: cannot resolve symbol
symbol : variable Connector
location: class d
(s = (TextMessage)(messageconnection = (MessageConnection)Connector.open(s2 = s2 + s)).newMessage("text")).setPayloadText(s1);
^
C:\J2SDK1~1.2_0\bin\d.java:69: cannot resolve symbol
symbol : method setPayloadText (java.lang.String)
location: class java.lang.String
(s = (TextMessage)(messageconnection = (MessageConnection)Connector.open(s2 = s2 + s)).newMessage("text")).setPayloadText(s1);
^
C:\J2SDK1~1.2_0\bin\d.java:159: cannot resolve symbol
symbol : class Command
location: class d
private static final Command m = new Command("Confirm", 1, 1);
^
C:\J2SDK1~1.2_0\bin\d.java:111: cannot resolve symbol
symbol : class Alert
location: class d
command = new Alert("Warning", "Invalid callee number, please retry......", a, AlertType.ERROR);
^
C:\J2SDK1~1.2_0\bin\d.java:111: cannot resolve symbol
symbol : variable AlertType
location: class d
command = new Alert("Warning", "Invalid callee number, please retry......", a, AlertType.ERROR);
^
C:\J2SDK1~1.2_0\bin\d.java:115: cannot access javax.microedition.lcdui.Form
file javax\microedition\lcdui\Form.class not found
c = new h("Sending Message");
^
C:\J2SDK1~1.2_0\bin\d.java:117: cannot assign a value to final variable this
this = this;
^
C:\J2SDK1~1.2_0\bin\d.java:118: cannot resolve symbol
symbol : method start ()
location: class d
start();
^
52 errors
با تشکر.