Eclipse with Java API shows % [duplicate] - java

This question already has an answer here:
Eclipse Autocomplete (percent sign, in Juno)
(1 answer)
Closed 7 years ago.
Recently I started using Java 8 with latest eclipse. Whenever I am using eclipse shortcut to get API list using "control+space" (on Windows 7); most of the API shows some percentage as shown below screen shot--
Can anybody please help me to understand what is it exactly.
Following are version information-
Eclipse EE version: Mars Release (4.5.0)
JDK version: jdk1.8.0_60

See the Eclipse manual about Recommenders:
The Call Completion engine, for example, provides you with recommendations of likely methods to call whenever you trigger code completion on an object, be it a variable, field, or constant. The call completion engine bases its recommendations on what other developers in a similar situation have called on an object of the given type.
So it's a percentage of which method was chosen by other people.
Notice the 4 percentages add up to 100%.

It shows the most used methods/classes among the suggestions that are shown to you. The percentage values are recommendation rank. Eclipse is trying to help you with the relevant suggestions.

Related

What exactly is the java executable, what does it do and where can I find the sources for it? [duplicate]

This question already has answers here:
Totally Confused with java.exe
(3 answers)
How is JNI_CreateJavaVM invoked when running a java app from the command line
(1 answer)
Closed 1 year ago.
My question is regarding the java executable, the one that you use to run a Java program and that on Linux it is found for example in /usr/bin/java.
I have been experimenting a bit as I want to look into how everything happens behind the scenes, like how does the bytecode gets loaded, how is the execution of the actual Java program starting and other details that may not be so straightforward.
Until now I have looked at the execution with strace and found that a new thread is created and that thread is the one on which the Java program actually gets executed (from another question that I posted). From what I understand the java executable is a launcher of some sort, but I do not understand all the operations that happen behind the scenes.
So, what exactly is the java executable and is there any place where I can find the source code for it (this would really help me)?
The primary source file for the launcher in the current development JDK can be found here: https://github.com/openjdk/jdk/blob/master/src/java.base/share/native/libjli/java.c
As you see, it's quite short and delegates most of the work to other pieces of code, but should be useful as a starting point.
If you want to see the source for other JDK versions (this is basically the main development repo for future Java versions), you need to look into the appropriate repository.

Using the Razer Chroma SDK from Java [duplicate]

This question already has answers here:
Is it possible to run C source code from Java?
(4 answers)
Closed 7 years ago.
I want to make a Java app that uses the Razer Chroma SDK, but the Chroma SDK is in c++
Is there a way I can run c++ code from Java?
I must use Java for what I want to make.
I have almost no experience in c++, but I understand enough to get doing what I need.
EDIT:
This question is slightly different then others, because it is about a specific SDK, not about general c++ libraries. For this library I was able to use a simpler approach then learning to use things like JNI
You probably want to look into using JNI
The easiest way I found, and then one that doesn't require learning stuff like JNI:
Create a console application with commands that fire off what you need
In Java, launch the console application and redirect it's input and output streams so you can send it commands, and log it's output (see 12013910)
Have a command in the console application that you can pass a PID, and have the console application watch for when it closes, and then it will close itself. (This fixes having the console application not being closed if the Java application crashes and doesn't call the closing method(s))

Java app (Processing IDE) attached window not visible in i3wm, common fixes not working [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 4 years ago.
Improve this question
I've been learning Processing using a book called the Nature of Code with an online editor, but I'd like to develop locally for various reasons.
My operating system is 64-bit Arch Linux with the i3 window manager serving as my primary desktop environment -- here's what I've tried so far:
Both 2.x and 3.x stable releases, plus unstable (latest) versions
OpenJDK-jre, OpenJDK-jdk, JRE Oracle & JDK Oracle for Java 7/8 (tested using ./processing --no-embed after the embedded versions didn't seem to be working)
adding for_window [instance="sun-awt-X11-XFramePeer"] floating enable to .i3/config
installing wmnamehttp://tools.suckless.org/wmname and following instructions verbatim
building i3-quickswitch with python ./setup.py install (activating start sketch yields no errors and Processing's logs seem to indicate everything is working fine, but i3-quickswitch shows no additional windows popping up.
I'm not sure which notifications in my i3-log are relevant to these problems, but you can take a look here to see if any certain fix is indicated. I've narrowed it as much I could; it looks like i3 may be treating the window as a "docked" window, which I assume is separate from a dialog window and treated differently.
Thanks for any fixes, sugesstions and advice! I appreciate your time.
Have you tried the official Arch Linux package for Processing?
In the end, I was able to fix the problem by adding the following code to my ~/.i3/config file:
for_window [instance="sun-awt-X11-XFramePeer"] floating enable
for_window [instance="sun-awt-X11-XDialogPeer"] floating enable
I got it working using the Java(TM) SE Runtime Environment (build 1.8.0_45-b14) and i3 version 4.10.3 with Processing Version 2.2.1.
NOTE: I'm not absolutely sure the sun-awt-X11-XFramePeer is needed for this fix, but it is definitely helpful with other Java programs.

Check if system/computer has a display or graphical output available [duplicate]

This question already has answers here:
How to detect if a graphical interface is supported?
(5 answers)
Closed 8 years ago.
Update: as marked duplicate, I just want to mention, this seems like a duplicate, but the answer to the other mentioned question is not completely correct. Instead refer to the accepted answer below.
isHeadless would return unexpected true in certain cases.
Its a bit weird situation, but recently I build a very simple java application which can be run in console/terminal mode or in JavaFX UI mode.
However, then while using it on a remote computer which doesn't have any display attached. I got an error that this JavaFX UI application can't be initiated on systems without display, which is pretty obvious.
To overcome this problem, I have been looking for a robust way of detecting if the system has any display attached and it can initiate a JavaFX application, which has to be a platform independent solution, since it could be Windows or Ubuntu/Linux or Mac system.
Structure of the application:
A Main console app, which depending on input arguments executes internally a console app or UI app.
So that, if any arguments given, run in console mode or if no arguments then run in UI mode.
This is where I want to detect if there is a display available from within my main console app, which then won't even try to run the UI app if display is missing.
Any idea how can we achieve this or suggestion in a proper direction would be great.
I think you could use java.awt.GraphicsEnvironment
GraphicsEnvironment.getLocalGraphicsEnvironment().getScreenDevices();
which will return an array with all the available screens. If this array is empty, there is no monitor.
Edit: About using isHeadless(), you can look at How to determine if GraphicsEnvironment exists

Useful Shortcuts in eclipse to analyse the existing application [duplicate]

This question already has answers here:
Eclipse - List of default keyboard shortcuts
(4 answers)
Closed 8 years ago.
I am going to do one enhancement in the existing java project .So I have to learn the useful short cut keys to navigate and analyse the java project in eclipse.
Example :
1 .If I use F3 it will navigate to method where its used
2.Ctrl+o will show the list of methods
Your help is highly appreciated...
Take a look at a cheatsheet for the version of eclipse you're using.

Categories