Erreur compilation java identifier expected

Fermé
alex881233456789 Messages postés 26 Date d'inscription jeudi 5 mai 2011 Statut Membre Dernière intervention 21 juillet 2013 - 4 août 2011 à 19:51
KX Messages postés 16734 Date d'inscription samedi 31 mai 2008 Statut Modérateur Dernière intervention 24 avril 2024 - 4 août 2011 à 20:14
Bonjour,

j'ai une erreur de compilation java. lorsque je compile, on m'écrit;


Main.java:5: <identifier> expected
import "rsbuddy.jar/com/rsbuddy/event/listeners/PaintListener";
^
Main.java:5: <identifier> expected
import "rsbuddy.jar/com/rsbuddy/event/listeners/PaintListener";
^
Main.java:5: ';' expected
import "rsbuddy.jar/com/rsbuddy/event/listeners/PaintListener";
^
Main.java:6: class, interface, or enum expected
import "rsbuddy.jar/com/rsbuddy/script/ActiveScript";
^
Main.java:7: <identifier> expected
import "rsbuddy.jar/com/rsbuddy/script/methods/Bank";
^
Main.java:7: <identifier> expected
import "rsbuddy.jar/com/rsbuddy/script/methods/Bank";
^
Main.java:7: ';' expected
import "rsbuddy.jar/com/rsbuddy/script/methods/Bank";
^
Main.java:8: class, interface, or enum expected
import "rsbuddy.jar/com/rsbuddy/script/methods/Environment";
^
Main.java:9: <identifier> expected
import "rsbuddy.jar/com/rsbuddy/script/methods/Inventory";
^
Main.java:9: <identifier> expected
import "rsbuddy.jar/com/rsbuddy/script/methods/Inventory";
^
Main.java:9: ';' expected
import "rsbuddy.jar/com/rsbuddy/script/methods/Inventory";
^
Main.java:11: class, interface, or enum expected
@Manifest(authors={"Alexandre"}, name="firebotncut", keywords={"firemaking, making, ash, woodcutting, money"}, version=0.5, description="Start anywhere and you will get bring to the closer yew, maple, tree or other tree")
^
12 errors

Que dois-je ajouter à ce code.

import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics;
Main.java:5: <identifier> expected
import "rsbuddy.jar/com/rsbuddy/event/listeners/PaintListener";
^
Main.java:5: <identifier> expected
import "rsbuddy.jar/com/rsbuddy/event/listeners/PaintListener";
^
Main.java:5: ';' expected
import "rsbuddy.jar/com/rsbuddy/event/listeners/PaintListener";
^
Main.java:6: class, interface, or enum expected
import "rsbuddy.jar/com/rsbuddy/script/ActiveScript";
^
Main.java:7: <identifier> expected
import "rsbuddy.jar/com/rsbuddy/script/methods/Bank";
^
Main.java:7: <identifier> expected
import "rsbuddy.jar/com/rsbuddy/script/methods/Bank";
^
Main.java:7: ';' expected
import "rsbuddy.jar/com/rsbuddy/script/methods/Bank";
^
Main.java:8: class, interface, or enum expected
import "rsbuddy.jar/com/rsbuddy/script/methods/Environment";
^
Main.java:9: <identifier> expected
import "rsbuddy.jar/com/rsbuddy/script/methods/Inventory";
^
Main.java:9: <identifier> expected
import "rsbuddy.jar/com/rsbuddy/script/methods/Inventory";
^
Main.java:9: ';' expected
import "rsbuddy.jar/com/rsbuddy/script/methods/Inventory";
^
Main.java:11: class, interface, or enum expected
@Manifest(authors={"Alexandre"}, name="firebotncut", keywords={"firemaking, making, ash, woodcutting, money"}, version=0.5, description="Start anywhere and you will get bring to the closer yew, maple, tree or other tree")
^
12 errors
import "rsbuddy.jar/com/rsbuddy/event/listeners/PaintListener";
import "rsbuddy.jar/com/rsbuddy/script/ActiveScript";
import "rsbuddy.jar/com/rsbuddy/script/methods/Bank";
import "rsbuddy.jar/com/rsbuddy/script/methods/Environment";
import "rsbuddy.jar/com/rsbuddy/script/methods/Inventory";

@Manifest(authors={"Alexandre"}, name="firebotncut", keywords={"firemaking, making, ash, woodcutting, money"}, version=0.5, description="Start anywhere and you will get bring to the closer yew, maple, tree or other tree")
public class firebotncut extends ActiveScript implements PaintListener{

private final int ashId = 592;
private String status = "Unknown";
final Font comicPlain10 = new Font("Comic Sans MS", Font.PLAIN, 10);
final Color black = new Color(0, 0, 0);

@Override
public int loop() {
status = "Looping";
if (Bank.isOpen()) {
if (Inventory.contains(ashId)) {
status = "Depositing";
Bank.depositAll();
}
else if (!Inventory.contains(ashId)) {
status = "Closing bank";
Bank.close();
}
}
else if (!Bank.isOpen()) {
if (Inventory.isFull()) {
status = "Opening bank";
Bank.open();
}
else if (!Inventory.isFull()) {
status = "Getting ashes";
}
}
return 0;
}

private void getAshes() {
int startCount = Inventory.getCount();
int endCount = startCount + 1;

if (GroundItems.getNearest(ashId) != null) {
status = "Taking ashes";
GroundItems.getNearest(ashId).interact("Take");
for (int i = 0; i < 10 && endCount != Inventory.getCount(); i++) {
status = "Sleeping";
sleep(800, 1200);
}
}
}

//Script variables
private final int yew = 1515;

private void getyew() {
int startCount = Inventory.getCount();
int endCount = startCount + 1;

if (Objects.getNearest(yew) != null) {
log("We found some yew!");
Objects.getNearest(yew).interact("chop down yew");
for (int i = 0; i < 10 && endCount != Inventory.getCount(); i++) {
sleep(800, 1200);
}
}
}

//Script variables
private final int briquet = 590;

private void getbriquet() {
int startCount = Inventory.getcount();
int endCount = startCount + 1;

if (Inventory.contains(yew) ) {
log("Fire!");
Inventory.get(yew).interact("use");
Inventory.get(briquet).String(clickMouse);
for (int i = 27; i < 10 && endCount != Inventory.getCount(); i++) {
sleep(800, 1200);
}
}
}

//Script variables
private final int ashId = 592;

//Debug variables
private String status = "Unknown";

//Paint variables
final Font comicPlain10 = new Font("Comic Sans MS", Font.PLAIN, 10);
final Color black = new Color(0, 0, 0);
public boolean onStart() {
status = "Starting up";
log("If you find any bugs please message me!");
return true;
}

public void onFinish() {
status = "Finishing";
log("Thanks for using my script!");
Environment.saveScreenshot(true);
}

@Override
public void onRepaint(Graphics g) {
g.setFont(comicPlain10);
g.setColor(black);

g.drawString("Status: " + status, 20, 400);
}
}

Merci, alex881233456789
A voir également:

2 réponses

KX Messages postés 16734 Date d'inscription samedi 31 mai 2008 Statut Modérateur Dernière intervention 24 avril 2024 3 015
Modifié par KX le 4/08/2011 à 20:09
Tu ne dois pas écrire import "rsbuddy.jar/com/rsbuddy/event/listeners/PaintListener"
Mais import com.rsbuddy.event.listeners.PaintListener;
Mais pour que cela marche tu devras "prévenir" le compilateur, soit en ligne de commande avec javac -classpath .;rsbuddy.jar soit dans les propriétés du projet de ton IDE
La confiance n'exclut pas le contrôle
0
alex881233456789 Messages postés 26 Date d'inscription jeudi 5 mai 2011 Statut Membre Dernière intervention 21 juillet 2013
4 août 2011 à 20:10
Bonjour, j'utilise un ide en ligne nommé JXXX Compiler. Je n'ai donc pas d'option. Aurais-t-il un autre moyen?
0
KX Messages postés 16734 Date d'inscription samedi 31 mai 2008 Statut Modérateur Dernière intervention 24 avril 2024 3 015
4 août 2011 à 20:14
Vu comment c'est fait je dirais que ton rsbuddy.jar doit aller dans Jar File 1, mais pour l'import ça change rien...
0