نمایش نتایج 1 تا 13 از 13

نام تاپیک: مشکل در تبدیل فایل *.java به *.class

  1. #1

    Unhappy مشکل در تبدیل فایل *.java به *.class

    با سلام.

    من هر فایل *.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

    با تشکر.

  2. #2

    نقل قول: مشکل در تبدیل فایل *.java به *.class

    کسی جواب نمی ده؟

  3. #3

    نقل قول: مشکل در تبدیل فایل *.java به *.class

    سلام.
    شاید مربوط به این بشه که در java platform manager در IDE هیچ پلتفرمی که برای j2me باشد تعریف نشده است.

  4. #4

    نقل قول: مشکل در تبدیل فایل *.java به *.class

    خوب الآن باید چه کار کنم؟

  5. #5

    نقل قول: مشکل در تبدیل فایل *.java به *.class

    باید sun j2me wtk نصب شده باشد. در مورد NetBeans به منوی tools>java Platforms بروید. اگر در بخش j2me هیچ پلتفرمی نبود آن را اضافه کنید.

  6. #6

    نقل قول: مشکل در تبدیل فایل *.java به *.class

    @khlless
    من بلد نیستم چه طوری باید پلتفرم رو اضافه کنم. ممکنه توضیح بدید؟
    یعنی مشکل فقط پلتفرم هست؟
    خواهش می کنم مشکل من رو حل کنید احتیاج دارم...

  7. #7

    نقل قول: مشکل در تبدیل فایل *.java به *.class

    از چه IDE ای و چه نسخه ای استفاده می کنید؟

  8. #8

    نقل قول: مشکل در تبدیل فایل *.java به *.class

    NetBeans 4.1

  9. #9

    نقل قول: مشکل در تبدیل فایل *.java به *.class

    دوستان عزیز: بالاخره باید چکار کنم؟

  10. #10

    نقل قول: مشکل در تبدیل فایل *.java به *.class

    سلام
    شما یک پروژه بساز مثلا به اسم MyProject
    بعد سورسهات رو بهش اضافه کن و اولشون عبارت زیر رو بنویس

    package MyProject;

    شاید اینطوری درست بشه. اگه درست نشد باید یه بازنگری در مورد نصب jdk بکنی. شاید درست نصب نشده باشه
    توی پوشه jdk و src داخل jdk کتابخانه های لازم هستن.

  11. #11

    نقل قول: مشکل در تبدیل فایل *.java به *.class

    راستی یادم رفت
    - تا اونجا هم که دیدم این کلاس به کلاسهای دیگه وابستگی داره پس بدون اونا نمیشه کامپایل کرد ، مثلا کلاس h
    اول شما تمام وابستگی ها رو هم کنارش بزارید بعد تنظیم package همونطور که گفتم و بعد ادامه مراحل کامپایل و رفع خطا
    پس این نکات رو بررسی کن، امیدوارم مشکلتون حل بشه

  12. #12

    نقل قول: مشکل در تبدیل فایل *.java به *.class

    آقای بشیری:
    داخل src.zip یک فولدر به نام javax وجود داشت، ولی فایل microedition.java توش وجود نداشت.
    فکر کنم فایل src.zip من کامل نباشه. یعنی شامل بعضی package ها نیست
    خواهشا کمکم کنید. اگر لازمه فایل src.zip کامل رو دانلود کنم لطفا لینک بدید.
    ممنون

  13. #13

    نقل قول: مشکل در تبدیل فایل *.java به *.class

    سلام. من فکر می کنم احتمال زیاد باید فایل src.zipم کامل نباشه. چون Packageها از اونجا لود میشن (درسته؟)
    لذا درخواست دارم یکی از اعضا لطف کنن یک فایل src.zip شامل تمام Package های مورد نیاز رو آپلود کنن. ممنون.

قوانین ایجاد تاپیک در تالار

  • شما نمی توانید تاپیک جدید ایجاد کنید
  • شما نمی توانید به تاپیک ها پاسخ دهید
  • شما نمی توانید ضمیمه ارسال کنید
  • شما نمی توانید پاسخ هایتان را ویرایش کنید
  •