Java Eclipse JCurses Library doesnt work after hours of triing of fixing it

1.1k views Asked by At

Greatings,

i hope you guys outthere can help me to solve my problem. i've try to setup the Jcurses Library but the result of it was just starting the cmd.exe without any content there was only the path of the workspace.

I readed a lot of howtos but non of this did work. I also tried with the original tutorial of Jcurses:

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

How to run a JCurses application

To work around the above mentioned problem, you first need to determine the command being used to start your program.

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.

My external-tools-config looks like this

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

and i used this code to run the console

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();
        }
    }
}

If you need more informations please let me know i will answer quickly

1

There are 1 answers

1
alnero On

Managed to run that with the following arguments:

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

Note that there is no spaces between quotes .../k""C:\Progr... and my java execution file is java.exe and not ...\bin\javaw.exe as stated in your arguments.