我需要生成兩個單獨的jar文件,它們都相互交互,但做不同的事情。我有兩個項目加載到Eclipse中,但都使用了很多相同的導入,因此我將它們放在同一個工作空間下的子文件夾中。Eclipse讓我做這個摘要?
其中一人得到"java class xxxx
找不到」當我嘗試運行它。
當我試圖解決這個問題,我是比較兩個項目,發現一個文件夾是外部構建路徑的一部分但不是非工作的,我把它添加到非工作的工作中,並且打破了工作中的一個
現在工作的那個主類名稱有錯誤我打電話程序ZSTATEngine,等級爲
public class ZSTATEngine implements ETOSFilterEngine
現在這個名字被突出顯示,當我將鼠標懸停時,它說:"the type ZSTATEngine
必須實現繼承的抽象方法ETOSFilterEngine.doFilter(MessageBlock)"
什麼可以改變?它之前工作正常,代碼本身沒有任何改變。我不明白引用的庫是如何工作的,但至少在以前的工作項目中,它們的結構沒有任何變化。
好了一些進一步的信息:我的確有一個類中的一個部分:
public MessageBlock doFilter(MessageBlock msgBlock)
所以我採取那個方法......但這種方法現在有它內部的錯誤,
「在類型FilterFramework的方法addFilteredMessage(MessageBlock)不適用或參數(MessageBlock)...
怎麼可能那已經變糟了?它工作也很好。
下面是完整的代碼:
package com.ibm.tpf.internal;
import java.awt.Color;
/*import java.util.ArrayList;*/
/*import java.util.*;*/
import com.ibm.tpf.etos.TPFFilter.*;
//import com.ibm.tpf.etos.TPFFilter.TernarySwitch;
import com.ibm.tpf.etos.api.*;
/*
import com.ibm.tpf.etos.api.Constants;
import com.ibm.tpf.etos.api.MessageBlock;
*/
import com.ibm.tpf.etos.filter.*;
/*
import com.ibm.tpf.etos.filter.ETOSFilterEngine;
import com.ibm.tpf.etos.filter.FilterConfigurationException;
import com.ibm.tpf.etos.filter.FilterFramework;
import com.ibm.tpf.etos.filter.FilterRuntimeException;
*/
public class ZSTATEngine implements ETOSFilterEngine {
FilterFramework fw = null;
String[] names = null;
public ZSTATEngine(FilterFramework filFW, String[] parms) {
super();
this.fw = filFW;
}
/* AAES0009I 13.45.01 FROM TA 05 : AUTC0000I TOSFCOLOR_GREEN TOSBCOLOR_NONE TOSHOLD_0 TOSSAVE_0 TOSALERT_0 AUTC1111I 12.04.41 OK */
public MessageBlock doFilter(MessageBlock msgBlock) throws FilterRuntimeException {
if(msgBlock.getMsgID().equals("AAES0009I")) { /* only handle messages that start with AAES0009I */
if(msgBlock.getMsg().indexOf("ZUVRT") != -1) { /* if the message contains "ZUVRT" then let it through. We want to react to the result of it, not the ZUVRT itself. */
return msgBlock;
}
if(msgBlock.getMsg().indexOf("AUTC0000I") != -1) { /* search string to see if "AUTC0000I is in it. If it is then do..." */
String myString = msgBlock.getMsg();
Color fColor = Color.WHITE; /* set default colors */
Color bColor = Color.BLACK;
msgBlock.setSuppressed(TernarySwitch.ON); /* suppress original message to display new one */
String[] myStringParts = myString.split("\\s+",13); /* divide message into 13 parts. The 13th part is everything remaining. */
String finalPart = myStringParts[12].toString(); /* print last part to the screen */
MessageBlock mb = new MessageBlock(finalPart, Constants.ETOS_ONE_MSG);
String fColorMsg = myStringParts[7].toString(); /* Process the foreground color portion */
if (!fColorMsg.contains("NONE")) {
fColor = ColorStringInterpreter(fColorMsg);
mb.setForeground(fColor);
}
String bColorMsg = myStringParts[8].toString(); /* Process the background color portion */
if (!bColorMsg.contains("NONE")) {
bColor = ColorStringInterpreter(bColorMsg);
mb.setBackground(bColor);
}
String holdMsg = myStringParts[9].toString(); /* Process the hold message portion */
if (holdMsg.toUpperCase().startsWith("TOS")) { /* if it starts with TOS, grab only the number at the end */
String[] holdPart = holdMsg.split("_",2);
if (holdPart[1].toString().equals("1")) {
mb.setHeld(TernarySwitch.ON);
}
}
else {
if (holdMsg.equals("1")) { /* otherwise, just use the number */
mb.setHeld(TernarySwitch.ON);
}
}
String saveMsg = myStringParts[10].toString(); /* Process the save areas. These have two formats currently: TOSSAVE_X_X_X_X and BBBBBBBBB, where X is a digit 1-32, and B is binary. */
if (saveMsg.toUpperCase().startsWith("TOS")) {
String[] savePart = saveMsg.split("_"); /* handle the multiple digit save areas, and ignore the first split which is TOSSAVE */
if (!savePart[1].toString().equals("0")) {
long areaBits = 0;
for (int i=1; i<savePart.length; i++) {
areaBits |= 1L << Integer.parseInt(savePart[i]);
}
mb.setSave(areaBits);
}
}
else { /* otherwise, just use the binary string directly */
long areaBits = Long.parseLong(myStringParts[10].toString(), 2);
mb.setSave(areaBits);
}
fw.addFilteredMessage(mb); /* this is the command that pieces the whole message together */
}
}
int plusLocation = msgBlock.getMsg().lastIndexOf('+');
if (plusLocation > 0) {
MessageBlock mb1 = new MessageBlock(msgBlock.getMsg(), msgBlock.getFlag());
fw.addFilteredMessage(mb1);
msgBlock.setSuppressed(TernarySwitch.ON);
MessageBlock mb2 = new MessageBlock("", Constants.ETOS_ONE_MSG);
fw.addFilteredMessage(mb2);
}
return msgBlock; /* whatever gets returned is what the system prints */
}
private Color ColorStringInterpreter(String colorMsg) throws FilterRuntimeException {
if (colorMsg.toUpperCase().startsWith("TOS")) { /* if it starts with TOS, then we're using color names */
String[] colorParts = colorMsg.split("_",2);
String colorTxt = colorParts[1].toString().trim();
if (colorTxt.toUpperCase() != "NONE") {
Color finalColor = Colors.fromString(colorTxt);
return finalColor;
}
}
else {
String[] colorParts = colorMsg.split("_",3); /* otherwise we're using RGB values */
String sRed = colorParts[0].toString().trim();
String sGreen = colorParts[1].toString().trim();
String sBlue = colorParts[2].toString().trim();
/*mb = new MessageBlock(sRed, Constants.ETOS_ONE_MSG);*/
int iRed = Integer.parseInt(sRed);
int iGreen = Integer.parseInt(sGreen);
int iBlue = Integer.parseInt(sBlue);
Color finalColor = new Color (iRed, iGreen, iBlue);
return finalColor;
}
return null;
}
public String getName() {
return null;
}
public void modifyState(Object[] newParams) throws FilterConfigurationException, FilterRuntimeException {
}
public boolean isActive() {
return false;
}
public void shutdown() {
}
}
更改原來的問題,以添加更多信息 – TulsaNewbie
您的謾罵正在理解您的問題 – ControlAltDel
也許你有兩個版本的ETOSFilterEngine,並且更改後,Eclipse鏈接到另一個版本。 –