How to use standard Java IO in Codenvy

百般思念 提交于 2019-12-13 01:12:23

问题


I just discovered Codenvy. I would like to use it to work on Java projects with my classmates. When I first opened Codenvy I was a bit overwhelmed with all of the options. How can I make a Java program and use System.out.print() for output and Scanner for input?

https://codenvy.com


回答1:


Codenvy updated IDE and now it's support Docker runners, so now you can run console based java app. As I remember they even has java console app example in their app creation wizard. Actually because of Docker it's support almost everything that can be ran in Linux.




回答2:


Tyler Jewell :

"Codenvy does not support (today) console-based application. The console is a window where the System.out.println(...) commands are directed to. Since we only support Web apps, the output for your application needs is to be part of a JSP file, or another form of output. Because you are doing a JAR file, that JAR file is just doing logging output to the system of record - not to the console.

We will be shipping an entirely new system before the quarter is over, and that system will have rich support for console applications. It'll also be much faster than the current one :). But in the mean time, I would recommend that you do a JSP / servlet application to do output to the browser until we have the standard console support."




回答3:


By picking up the system:/java/standalone/simple/cli runner in Codenvy you will access to a runner where you can display logs in the console.

Also if your process is still active, you can connect through the terminal window and then launch the program interactively

If the application is using Swing or display, there is also a runner that allow to use VNC and then your application will be shown in the browser through a VNC client.

The Java Console example is named "Samples - HelloWorld / Java Console" and for UI : Swing in the same category: "Samples - HelloWorld"

and here is a direct access to try the sample: https://codenvy.com/f?id=apmfl4nx23p0uemj




回答4:


If you'd like to use codenvy like eclipse, you have to create a seperate JFrame and redirect output streams to it. This was you'll be able to use System.out.println("...") and view them in the JFrame. Check this out, which is my version. When you create the main JFrame, simply create an instance of the class. Perhaps at the beginning of your main method, put: new Console();



来源:https://stackoverflow.com/questions/22341365/how-to-use-standard-java-io-in-codenvy

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!