
CodeGuru Forums » Java Programming
1,000 FOLLOWERS
Ask your Java programming question and help out others with theirs, find conversations, resources, and guides by real developers, all focused on Java programming. CodeGuru forum is where developers can share ideas, tips, tricks, and so much more related to programming.
CodeGuru Forums » Java Programming
2w ago
Dear codeguru,
I have been reading both https://openjdk.org/groups/build/doc/building.html as well as https://hg.openjdk.org/jdk-updates/j.../building.html and I have found these tutorials incomplete
and difficult in places, as well as somewhat out of date. I am trying to build a working, independent OpenJDK 19, with compiler and runtime, from source code and resource files.
I am interested in the Windows 64 bit, Linux 64 bit and Mac platforms. I wish to cross compile, which means, I think, compile for separate operating system platforms.
I have Windows 10 or Windows 11, both 64 bit, availab ..read more
CodeGuru Forums » Java Programming
1M ago
I have had a good go at using Java OpenJDK, necessarily a very early version of the OpenJDK, in order to try and match expressions like the following, which are going to be certain kinds of doubles in exponential, E, notation:
Code:
import java.util.regex.Pattern;
import java.util.regex.Matcher;
import static java.lang.System.*;
//...
Pattern pattern = Pattern.compile("^[0-9]+\\.0{15}?|9{15}?[0-9]+E-?[0-9]+$");
Matcher matcher = pattern.matcher("3.0E-4");
boolean result = matcher.matches();
out.println("Pattern match result: " + result + ".");
I ..read more
CodeGuru Forums » Java Programming
2M ago
I encountered an issue while programming a bot.
Summary and function
When a user types !add spotify:track:someHash in a chat-application, I invoke a java-function which then triggers a PHP-script.
I have been using this git-project, following the instructions in the documentation for authorization, and I am able to add my tracks to the source by manually inputting the code.
Allow me to demonstrate the essential elements.
HTML Code:
if (spotifyTrack.startsWith("spotify")) {
// this might be important, maybe need to change this?
URL url = new URL("http://www.examp ..read more
CodeGuru Forums » Java Programming
2M ago
Hello i new to this forum hope every one doing well
weather website and starting to learn json as i am using willy weather api need hope with this code please what am, Idoing wrong
[CODE]
[H
Code:
{
"CONTENT_TYPE": "application/json",
"HTTP_X_PAYLOAD": {
"platform": "iphone",
"weatherTypes": [
{
"code": "weather"
}
],
&nbs ..read more
CodeGuru Forums » Java Programming
3M ago
My interview question was like this:
Develop a test strategy for the desktop application considering the transition from a legacy technology stack to a Java stack for the backend engine. Ensure that the client application continues to communicate with the backend engine for business logic and data rendering.
Can you please suggest a more effective test strategy for this case, since my answer was evidently unsatisfactory?
In light of the backend engine being migrated, it is necessary to carry out all of the system test cases and automation scripts.
They anticipated the potential risks and th ..read more
CodeGuru Forums » Java Programming
3M ago
In Java, I'm developing a blocking file lock, and while attempting to acquire a lock, I have a code block that looks like this:
Code:
while(!fileLockIsAcquired())
{
Thread.sleep(100); //is this cool?
tryAcquireFileLock();
}
That figure of 100 milliseconds seems very stiff to me, and I'm wondering if the scheduler couldn't be more clever if I used Thread.sleep(0) or Thread.yield() instead. Yield appears to express purpose more effectively, although I'm not sure I really understand how the JVM interprets it. Also, I tried reading similar online articles like this (Yi ..read more
CodeGuru Forums » Java Programming
4M ago
Hello. I just wandering on how to convert C++ code to Java since I have an assignment in converting this C++ Code to Java. Please help me thanks. I also need to study the difference in the implementation of the code in C++ and Java hehe. #javabegginer
#include <iostream>
#include <iomanip>
#include <string>
using namespace std;
struct StudentGrade
{
int quiz1;
int quiz2;
int midterm;
int final;
int total;
string firstName;
string lastName;
double percent, avg;
char letterGrade;
};
void getData(StudentGrade& g);
void setLetterGrade(StudentGrade& g);
void format(int ..read more
CodeGuru Forums » Java Programming
4M ago
In Java, if I try to do.equals() on a null string, a null pointer error is issued. I’m wondering whether I can perform the following if I’m attempting to compare if a string is equal to a constant string:
Code:
MY CONSTANT STRING.equals(aStringVariable)
I’m sure it’ll work, but is this simply extremely bad code?
This is a common Java idiom known colloquially as a Yoda condition. Personally, I prefer to handle the null situation directly, but the Yoda method is widely used, and any competent Java programmer should quickly grasp what is going on. How should I proceed ..read more
CodeGuru Forums » Java Programming
11M ago
Hello,
I want to use Editor 2.0.5 with Typescript in my .net 5.0 ASP.Net-Application.
currently, How to fix error in TypeScript i get the errors on the file types.d.ts while compiling:
TS2304 (TS) Cannot find name 'classNames'.
TS2304 (TS) Cannot find name 'modelSettings'.
TS2304 (TS) Cannot find the name 'public API'.
can anyone help ..read more
CodeGuru Forums » Java Programming
1y ago
Hello good day, this pc is new, I installed it and I had problems with the IDE...so I uninstalled it and reinstalled it. Can you help me?
The problem is that I can not compile code ...I get errors ..it appears that I use symbols that I really do not use and also, errors in Neatbeans..it keeps loading minutes for a simple hello world.
Thanks
Attached Images
  ..read more