简体   繁体   中英

How to use standard Java IO in Codenvy

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

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.

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."

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM