gpt4 book ai didi

经过数小时的修复培训后,Java Eclipse NCurses 库无法正常工作

转载 作者:行者123 更新时间:2023-11-30 11:11:34 25 4
gpt4 key购买 nike

致谢,

我希望你们能帮我解决我的问题。我尝试设置 Jcurses 库,但结果只是启动 cmd.exe 而没有任何内容,只有工作区的路径。

我阅读了很多 howtos,但没有一个有效。我还尝试了 Jcurses 的原始教程:

============================================= =========

如何运行 JCurses 应用程序

要解决上述问题,您首先需要确定用于启动程序的命令。

Instructions:

Step 1) Run Java app as usual (it does not matter if it fails), and switch to the debug view.

Step 2) Right click on the process, and open the property window by selecting "Properties".

Step 3) Select and copy the command-line parameter used to launch the program.

Step 4) Hit the arrow-button next to "External Tools" (The play icon with a small red toolbox), and hit "External Tools Configuration"

Step 5) Create a new configuration, with the following data: Location: The path to the cmd.exe of your Windows OS. For Example: C:\WINXP\system32\cmd.exe Working Directory: Whatever working directory you want. Arguments: "/c start C:\WINXP\system32\cmd.exe /k " followed by the previously copied command. For Example: /c start C:\WINXP\system32\cmd.exe /k C:\Programme\Java\jre6\bin\java.exe -Dfile.encoding=Cp1252 -classpath "C:\Dokumente und Einstellungen\mccae\Eigene Dateien\javawork\TWCC+\bin" at.co.lipski.twcc2.console.TWCCDaemon

Please note, that you need to wrap paths containing whitespace with quotes (“). The above command will start your application in a new, detached console window, which will stay open until you manually close it. Now you can launch your newly created configuration and enjoy your application from inside Eclipse.

我的外部工具配置如下所示

enter image description here

Position: C:\Windows\System32\cmd.exe

Workspace: ${workspace_loc:/Azubi Storys}

Arguments: "/c start C:\Windows\System32\cmd.exe /k" "C:\Program Files\Java\jre1.8.0_25\bin\javaw.exe" -Dfile.encoding=Cp1252 -classpath "C:\Users\YAlSabiry\Desktop\Android\Eclipse Projekte\Azubi Storys\bin;C:\Users\YAlSabiry\Desktop\Android\jcurses\lib\jcurses.jar" Testwin

我使用这段代码来运行控制台

import jcurses.event.ActionEvent;
import jcurses.event.ActionListener;
import jcurses.event.ItemEvent;
import jcurses.event.ItemListener;
import jcurses.event.ValueChangedEvent;
import jcurses.event.ValueChangedListener;
import jcurses.event.WindowEvent;
import jcurses.event.WindowListener;
import jcurses.system.CharColor;
import jcurses.system.Toolkit;
import jcurses.util.Message;
import jcurses.util.Protocol;
import jcurses.widgets.BorderPanel;
import jcurses.widgets.Button;
import jcurses.widgets.CheckBox;
import jcurses.widgets.FileDialog;
import jcurses.widgets.GridLayoutManager;
import jcurses.widgets.Label;
import jcurses.widgets.List;
import jcurses.widgets.PasswordField;
import jcurses.widgets.PopUpMenu;
import jcurses.widgets.TextArea;
import jcurses.widgets.Widget;
import jcurses.widgets.WidgetsConstants;
import jcurses.widgets.Window;

public class Testwin extends Window implements ItemListener, ActionListener,
ValueChangedListener, WindowListener, WidgetsConstants {

public static void main(String[] args) throws Exception {
// Protocol initialisieren
System.setProperty("jcurses.protocol.filename", "jcurses.log");
Protocol.activateChannel(Protocol.DEBUG);
Protocol.debug("Programm beginnt");
Toolkit.beep();
Window test = new Testwin(28, 20);
test.addListener((WindowListener) test);
test.show();
}

private Button _b1 = null;
private Button _b2 = null;
private List _list = null;
private TextArea _textArea = new TextArea(-1, -1,
"1111\n2222\n3333\n4444\n\n66666\n77777\n888888\n99999999999999999\n1010100101");
private PasswordField _pass = new PasswordField();
public Testwin(int width, int height) {
super(width, height, true, "Test");
BorderPanel bp = new BorderPanel();
new CheckBox();
new CheckBox(true);
new Label("textfeld");
new Label("checkbox2");
_b1 = new Button("OK");
_b1.setShortCut('o');
_b1.addListener(this);
_b2 = new Button("Cancel");
_b2.setShortCut('p');
_b2.addListener(this);
_list = new List();
_list.add("item1");
_list.add("item201234567890123456789");
_list.add("item3");
_list.add("item4");
_list.add("item5");
_list.addListener(this);
_list.getSelectedItemColors().setColorAttribute(CharColor.BOLD);
GridLayoutManager manager1 = new GridLayoutManager(1, 1);
getRootPanel().setLayoutManager(manager1);
manager1.addWidget(bp, 0, 0, 1, 1, ALIGNMENT_CENTER, ALIGNMENT_CENTER);
GridLayoutManager manager = new GridLayoutManager(2, 5);
bp.setLayoutManager(manager);
manager.addWidget(_list, 0, 0, 1, 4, ALIGNMENT_TOP, ALIGNMENT_CENTER);
manager.addWidget(_textArea, 1, 0, 1, 2, ALIGNMENT_CENTER,
ALIGNMENT_CENTER);
manager.addWidget(_pass, 1, 2, 1, 2, ALIGNMENT_CENTER, ALIGNMENT_CENTER);
manager.addWidget(_b1, 0, 4, 1, 1, ALIGNMENT_CENTER, ALIGNMENT_CENTER);
manager.addWidget(_b2, 1, 4, 1, 1, ALIGNMENT_CENTER, ALIGNMENT_CENTER);
}

public void actionPerformed(ActionEvent event) {
Widget w = event.getSource();
if (w == _b1) {
Protocol.debug("point1");
FileDialog dial = new FileDialog("File wählen");
Protocol.debug("point2");
dial.show();
Protocol.debug("point3");
if (dial.getChoosedFile() != null) {
new Message("Meldung!", dial.getChoosedFile().getAbsolutePath(), "OK").show();
}
Protocol.debug("point4");
_pass.setVisible(!_pass.isVisible());
pack();
paint();
} else {
new Message("Meldung!", "01234567890\nassssssss\naaaaaaa\naaaaaa",
"CANCEL").show();
PopUpMenu menu = new PopUpMenu(53, 5, "test");
for (int i = 1; i < 100; i++) {
if ((i == 35) || (i == 4)) {
menu.addSeparator();
} else {
menu.add("item" + i);
}
}
menu.show();
new Message("meldung", menu.getSelectedItem() + ":"
+ menu.getSelectedIndex(), "OK").show();
}

// close();

}

public void stateChanged(ItemEvent e) {
Protocol.debug("-----------------");
new Message("meldung", e.getItem() + ":" + e.getType(), "OK").show();
}

public void valueChanged(ValueChangedEvent e) {
new Message("Alarm", "Geändert in ", "" + _list.getSelectedIndex())
.show();
}

public void windowChanged(WindowEvent event) {
Protocol.debug("window event: " + event.getType());
if (event.getType() == WindowEvent.CLOSING) {
event.getSourceWindow().close();
}
}
}

如果您需要更多信息,请告诉我,我会尽快答复

最佳答案

设法使用以下参数运行它:

"/c 启动 C:\Windows\System32\cmd.exe/k""C:\Program Files\Java\jdk1.7.0_25\bin\java"-Dfile.encoding=Cp1251 -classpath "C:\Users\用户名\workspace\JCurses_Example\bin;C:\Users\username.m2\repository\jcurses\lib\jcurses.jar"Testwin

请注意,引号之间没有空格 .../k""C:\Progr... 并且我的 java 执行文件是 java.exe 而不是 ...\bin\javaw.exe,如您的论据中所述.

关于经过数小时的修复培训后,Java Eclipse NCurses 库无法正常工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27360435/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com