No easy run button when using Java in VS Code - java

I am a software developer and am having a problem with Visual Studio Code while trying to run Java. When running other languages (such as python) there is a green triangular button on the top right that allows an easy way to run my code, however, when I trying running Java there arrow is not there and I have to manually select "Run Code" from the "Run" ribbon at the top of the screen. Is there any way that I could get the same green run button when using Java? Thank you for your time.

Press crtl+F5 to run without debugging and F5 running with debugger.
You can use the integrated terminal for compiling and executing by using the javac <filename>.java for compiling and java <filename> for executing.
Set your own key bindings.
Preset shortcuts

Install Java Extension Pack in extension marketplace will solve your question, also you can install Code Runner which provides button for code running too.

Related

How to show javadoc in VScode?

I'm currently using Ubuntu Linux. When I used to program on windows using eclipse, I could easily open javadoc when I hover over a function or when I press control and click it. Now I'm using VS code, and I can't see javadoc for some reason. When I hover over the function (Math.ceil for example) it shows some empty code that only returns 0 as in the screenshot attached.
I've already installed java extension pack. Any solutions to this?

Visual Studio style Output Console Window in Eclipse

I want to show my output that is shown in Console window in a separate screen like in Visual Studio.
The screen shall disappear after the running of the process is over.
How can this be achieved in Eclipse IDE?
Suggestions are welcome.
you can develop your program in Eclipse and then run it from the command window [cmd] (assuming you are using windows) using "java ..." syntax.

Eclipse (SWT composite): How to run and where is build?

I am new to Eclipse and Java programming having mainly worked with Microsoft Visual Studio.
I installed Eclipse (Kepler 4.3) with no issues along with WindowsBuilder and SWT.
I created a new project adding in references to SWT, both WindowsBuilder JARS, and resty. Into the project, I created a new package and selected a SWT composite. I gave appropriate names.
The GUI designer came up with no issues. I added in a couple of controls. The idea is to create a hello world application, display that application, and build it. Eclipse has automatically build checked.
Okay, the IDE in designer view shows the GUI of my Hello World application and the source view the source, so no problems there.
I press Run, and the first time I had to select a run configuration, which I selected EclipseStarter. There was not many options. I click on run and nothing happens.
If I go to the project's bin package folder, I see a file with a ".class" extension.
Why does pressing Run|Run (Ctrl+F11) do nothingness? There is a brief hour glass showing, but then nothing after that.
How do I launch the application from within Eclipse?
Is the generated ".class" file the correct runtime? I double click on that and Windows does not know what to do with it?
The end platform will be CentOS, but Java as I understand things, should be platform independent, so my Hello World application should run on my Windows 7 Pro box just as nicely. (I did not try CentOS yet) as I want to see it work on my desktop and know what file to copy over.
I think you selected the wrong option EclipseStarter.
Try running it as a Standalone Java Application.
It is a Standalone Java Application that you're building, right?
(I mean, the analogue of a Windows Forms App in .NET)
1. I guess because you selected the wrong type.
2. Ctrl+F11 is for Running it, F11 only is for Debugging it.
3. The class file has to be run by a JVM, Windows cannot run it directly,
it is not anything like a native executable or like a .NET assembly
(which Windows 7 knows how to run). But as you're using Eclipse you
already have a JVM.
The solution is multi-fold.
I had to delete Eclipse and install the 32-bit version of everything. That simplified life, as 64-bit caused issues running.
Create a new package
From the toolbar, select "Create new visual classes" drop down. Select "SWT" --> "Application windows".
Create the application window
Press the play button, 8th icon having selected the package first.
That enabled to run my Hello World on Windows. The output is a .java.
I still have a problem running from the command line, but that is a different issue.
Summary: My main issue was creating a SWT application window first and that I should have 32-bit for everything.

How to run Java code on Eclipse Juno

I'm learning Java and using Eclipse as main IDE right now, but i can't run Java code from it (There are no Run as or Debug option in the Popup menu).
And personally, i don't to use 2 difference version of Eclipse.
Thanks
Edit : I'm using Eclipse Standard 4.3 and it doesn't have run as \ Java Application 's option. It only exists in Eclipse IDE for Java Developers.
This is not the same version of Eclipse but the button is identical.
#illunara , I am using Juno since a long time now. You can run the program using one of the following way and it's pretty simple where is your confusion ??
1) refer to the following screen shot : You can right click on the java project you will see the run as option and from there you can choose on of the option to run as java application
2) You can go to run-> run as-> java application
3) you can right click the mouse on a java program and you can run from their too.
================================================================================================
EDIT
Just as you mentioned you have eclipse standard so you need to add the JDT plugins before you do the above. you can find more details at the following site :
http://www.eclipse.org/jdt/overview.php
Hope this is helpful.

Pop up command line in Eclipse or NetBeans

currently for my Java code writing I am using Windows and JCreator 2.5 LE. It is ancient and has basically no frills, but it has 1 thing that I like about it. When I run/debug a program, a Windows command line windows pops up and my program runs. I really like Eclipse and NetBeans, NetBeans I like a little bit moreso, but when I run my code it comes up in that stupid tiny little console embedded window, now this might not annoy anyone out there, but I like how I get the full command line window to pop up and run my code in good old windows cmd.exe goodness. Maybe I'm just a scrub but that's what I'm used to, all C/C++ work I've done in CodeBlocks and/or MS Visual Studio IDE, when I hit run I have a command line window pop up just like in JCreator, so that's what I'm used to.
So please, is there any way to get either NetBeans or Eclipse to do what I am asking?
Add just a simple script / bat file to execute your main Java class.
In "start_app.bat"
cd path_to_build_dir
java package_name.Main
augument with pause and other stuff as you prefer.
Or you can modify your build as described here http://wiki.netbeans.org/CLIProjectInConsoleWindow#How_to_run_a_NetBeans_project_in_an_operating_system_console_window

Categories