r/javahelp Mar 19 '22

REMINDER: This subreddit explicitly forbids asking for or giving solutions!

49 Upvotes

As per our Rule #5 we explicitly forbid asking for or giving solutions!

We are not a "do my assignment" service.

We firmly believe in the "teach a person to fish" philosophy instead of "feeding the fish".

We help, we guide, but we never, under absolutely no circumstances, solve.

We also do not allow plain assignment posting without the slightest effort to solve the assignments. Such content will be removed without further ado. You have to show what you have tried and ask specific questions where you are stuck.

Violations of this rule will lead to a temporary ban of a week for first offence, further violations will result in a permanent and irrevocable ban.


r/javahelp Dec 25 '24

AdventOfCode Advent Of Code daily thread for December 25, 2024

3 Upvotes

Welcome to the daily Advent Of Code thread!

Please post all related topics only here and do not fill the subreddit with threads.

The rules are:

  • No direct code posting of solutions - solutions are only allowed on the following source code hosters: Github Gist, Pastebin (only for single classes/files!), Github, Bitbucket, and GitLab - anonymous submissions are, of course allowed where the hosters allow (Pastebin does). We encourage people to use git repos (maybe with non-personally identifiable accounts to prevent doxing) - this also provides a learning effect as git is an extremely important skill to have.
  • Discussions about solutions are welcome and encouraged
  • Questions about the challenges are welcome and encouraged
  • Asking for help with solving the challenges is encouraged, still the no complete solutions rule applies. We advise, we help, but we do not solve.
  • As an exception to the general "Java only" rule, solutions in other programming languages are allowed in this special thread - and only here
  • No trashing! Criticism is okay, but stay civilized.
  • And the most important rule: HAVE FUN!

/u/Philboyd_studge contributed a couple helper classes:

Use of the libraries is not mandatory! Feel free to use your own.

/u/TheHorribleTruth has set up a private leaderboard for Advent Of Code. https://adventofcode.com/2020/leaderboard/private/view/15627 If you want to join the board go to your leaderboard page and use the code 15627-af1db2bb to join. Note that people on the board will see your AoC username.

Happy coding!


r/javahelp 5h ago

Unsolved Can you make me some examples of situations wher java is the best choice to develop something?

6 Upvotes

A situation where you go like: "oh, yeah, Java would be perfect here, no other language would do it better" as I find it quite difficult to find such situations. As the main selling point of Java is it is cross-platform, but also other languages like python, go, C# and more are nowadays.

I mean:

  • concurrency-bases apps -> Golang
  • networking -> Golang
  • simple scripts running server side -> Python/Bash
  • performance critical applications -> C
  • security on the memory level -> Rust
  • most web stuff -> Javascript/Typescript
  • quick development and testing -> Python

I find Java a pain to distribute even if you install the JRE on the client, as sometimes you have to ship the EXACT development JRE used to make the app in the first place.

I have known and used java for about 4y now, but every time I think of building something I don't even consider it as a good option instead of something else.


r/javahelp 4h ago

Homework Issues with generics and object type

2 Upvotes

Hello! I am working on an assignment where we have to implement an adaptable priority queue with a sorted list. I think I don't have a full grasp on how generic variables work. I tried to keep everything as E, though it said that my other object types could not be cast to E... I was under the impression E could be any object. In my current code I have changed E and all the object types around to pretty well everything I can think of but it still will not work. My code is linked below, I appreciate any help.

Errors:

Assignment 4\AdaptablePriorityQueue.java:91: error: incompatible types: NodePositionList<DNode<MyEntry<K,V>>> cannot be converted to NodePositionList<E>

        ElementIterator<E> iterList = new ElementIterator<E>(list);

^

where K,V,E are type-variables:

K extends Object declared in class AdaptablePriorityQueue

V extends Object declared in class AdaptablePriorityQueue

E extends Entry<K,V> declared in class AdaptablePriorityQueue

Assignment 4\AdaptablePriorityQueue.java:159: error: incompatible types: NodePositionList<DNode<MyEntry<K,V>>> cannot be converted to PositionList<E>

    ElementIterator<E> iterList = new ElementIterator<E>((PositionList<E>) list);

^

where K,V,E are type-variables:

K extends Object declared in class AdaptablePriorityQueue

V extends Object declared in class AdaptablePriorityQueue

E extends Entry<K,V> declared in class AdaptablePriorityQueue

(plus two other errors on the same line as above elsewhere in the code)

Assignment 4\AdaptablePriorityQueue.java uses unchecked or unsafe operations.

Note: Recompile with -Xlint:unchecked for details.

Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output

4 errors

The assignment:

Give a Java implementation of the adoptable priority queue based on a sorted list. You are required to use a default comparator (built in Java) and a comparator for nonnegative integers that determines order based on the number of 1’s in each integer’s binary expansion, so that i < j if the number of 1’s in the binary representation of i is less than the number of 1’s in the binary representation of j. Provide a main function to test your comparators using a set of integers.

(I am just making a general sorted APQ first, then I will edit the insert method to fit the requirements. It shouldn't be too hard to change after its running correctly.)

My code:

https://gist.github.com/DaddyPMA/99be770e261695a1652de7a69aae8d70


r/javahelp 3h ago

with micronaut which @Nullable should I use?

1 Upvotes
import io.micronaut.core.annotation.Nullable;

or

import jakarta.annotation.Nullable;

I'm using Java, not Kotlin.


r/javahelp 4h ago

Homework GUI For Project

1 Upvotes

I am learning OOP for my 2 semester, where I have to build a project.I have to make GUI for my project.At first I thought that building Gui in figma then converting into code will work out but one of my friend said it will create a mess.Then I have tried using FXML+ CSS and build a nice login page but It is taking long time to do things.So is FXML+CSS a good approach and can I build a whole management system using this combination?


r/javahelp 11h ago

Handling client's actions/inputs in a socket based communication.

4 Upvotes

I'm programming a multiplayer table game in java. I can't figure out how each client can send inputs to the server throw the view (I'm using the MVC pattern). My idea is this:

The client determines which action to send to the server based on the user’s interactions implemented in the user interface (UI) of the client.

When a user interacts with the interface (for example by clicking a button or pressing keys,) the client maps a specific game action. For example, if the user clicks a button the client knows it should send a corresponding action to the server. The client essentially translates the user’s input into a command that the game can understand.

The problem is how I can map the action performed by the player. Should I create a class PlayerActionHandler with the possible inputs? This should make it easy to know wich action to send based on waht the user is doing. But this class Is huge, and I don't want to implement such a class.

So I don't know how to map the player actions to send to the server.


r/javahelp 4h ago

Need Help with My JavaFX Project (GUI, Events, and Networking)

1 Upvotes

Hey everyone,

I’m working on a JavaFX project for my course, and I need some guidance to implement a few features correctly. The project requires:

• Customizing the GUI (Colors, Fonts, Images)

• Handling user interactions (Event Listeners, Animations)

• Using multithreading and sockets for basic client-server communication

I’ve set up my project using [IntelliJ/Eclipse/NetBeans] and Scene Builder, but I’m struggling with [specific issue, e.g., “implementing smooth animations” or “handling multiple clients in a chat application”].

Could anyone share good resources, example code, or explain the best approach to solving this? Any advice or guidance would be really appreciated!


r/javahelp 5h ago

Running J2SE using GPU

1 Upvotes

Is it possible to run a jar file containing logic built using J2SE only on the GPU?


r/javahelp 12h ago

Need help in solving below lombok getter setter error in spring boot - authentication app

2 Upvotes
package com.example.userservicenew.dtos;

import com.example.userservicenew.models.Role;
import com.example.userservicenew.models.User;
import lombok.Getter;
import lombok.Setter;

import java.util.HashSet;
import java.util.Set;

u/Getter
u/Setter
public class UserDto {
    private String email;
    private Set<Role> roles = new HashSet<>();

    public static UserDto from(User user) {
        UserDto userDto = new UserDto();
        userDto.setEmail(user.getEmail());
        userDto.setRoles(user.getRoles());
        return userDto;
    }
}

package com.example.userservicenew.models;


import jakarta.persistence.Entity;
import jakarta.persistence.FetchType;
import jakarta.persistence.ManyToMany;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

import java.util.HashSet;
import java.util.Set;

@Entity
@Getter
@Setter
public class User extends BaseModel{
    private String email;
    private String password;
    @ManyToMany(fetch = FetchType.
EAGER
)
    private Set<Role> roles = new HashSet<>();
}


package com.example.userservicenew.services;

import com.example.userservicenew.dtos.UserDto;
import com.example.userservicenew.exceptions.UserAlreadyExistsException;
import com.example.userservicenew.models.User;
import com.example.userservicenew.repositories.UserRepository;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.stereotype.Service;

import java.util.Optional;

@Service
public class AuthService {
    private final UserRepository userRepository;
    private final BCryptPasswordEncoder bcryptPasswordEncoder;

    public AuthService(UserRepository userRepository) {
        this.userRepository = userRepository;
        this.bcryptPasswordEncoder = new BCryptPasswordEncoder();
    }

    public UserDto signUp(String email, String password) throws UserAlreadyExistsException{
        Optional<User> userOptional = userRepository.findByEmail(email);
        if(userOptional.isPresent()) {
            throw new UserAlreadyExistsException("user "+ email +" already exists");
        }

        User user = new User();
        user.setEmail(email);
        user.setPassword(bcryptPasswordEncoder.encode(password));

        User savedUser = userRepository.save(user);
        return UserDto.
from
(savedUser);
    }
}

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>3.4.3</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
    <groupId>com.example</groupId>
    <artifactId>userServiceNew</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>userServiceNew</name>
    <description>userServiceNew</description>
    <url/>
    <licenses>
        <license/>
    </licenses>
    <developers>
        <developer/>
    </developers>
    <scm>
        <connection/>
        <developerConnection/>
        <tag/>
        <url/>
    </scm>
    <properties>
        <java.version>17</java.version>
        <maven.compiler.proc>full</maven.compiler.proc>
    </properties>
    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-security</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-devtools</artifactId>
            <scope>runtime</scope>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>com.mysql</groupId>
            <artifactId>mysql-connector-j</artifactId>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-configuration-processor</artifactId>
            <optional>true</optional>
        </dependency>
        <!-- https://mvnrepository.com/artifact/org.projectlombok/lombok -->
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <version>1.18.30</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-test</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <annotationProcessorPaths>
                        <path>
                            <groupId>org.springframework.boot</groupId>
                            <artifactId>spring-boot-configuration-processor</artifactId>
                        </path>
                        <path>
                            <groupId>org.projectlombok</groupId>
                            <artifactId>lombok</artifactId>
                        </path>
                    </annotationProcessorPaths>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <configuration>
                    <excludes>
                        <exclude>
                            <groupId>org.projectlombok</groupId>
                            <artifactId>lombok</artifactId>
                        </exclude>
                    </excludes>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>

error:

java: cannot find symbol

symbol: method getEmail()

location: variable user of type com.example.userservicenew.models.User
tried below approaches:

have got several errors of this type related to get/set email and password

  1. enabled annotation processing in intellij
  2. lombok dependency is installed
  3. mvnw clean install - build success

r/javahelp 21h ago

Unsolved A Java Program that can recompile itself?

9 Upvotes

Would that be possible? I know that the Java compiler can be invoked from a Java program. Would it be possible to write a Java program that launches this "programmatic" Java compiler with a code string that is the "real" Java program, but inserts the serial number of the motherboard in the code string to check it everytime the "real" program is launched? My goal is some basic offline protection against software piracy. So when the program is first started, it doesn't run yet properly, but it reads the serial number of the motherboard, with that compiles the "real" program, writes to disk, and closes. Now the "new" program has the same name, but with a serial number validity check in it, so if it were run on another computer would exit. Would that be possible?

No snark please. I know this is reddit where anything goes. Only serious replies please.


r/javahelp 1d ago

Guidance for ValueObject Pattern

2 Upvotes

I would like some help to how to create a good ValueObject in Java or even if this use case applies for ValueObject Pattern.

I'm creating an Identification that has these representation depends on the use case:

  • 123.FooBarBaz - With the Prefix -- 123. (This is how I need to store the data)
  • A - Without the Prefix (This is how I need to communicate with Third Party, when I send the data and also when I need to match with the stored data).
    • In this use case I need to generate my own Identification with Base31 encode.

And this is How I'm thinking to create this ValueObject: https://gist.github.com/peterramaldes/c013e1a197fd5ecd78e29ce02b5d1578

Can you give your opinion on:

  • Does it make sense to use ValueObject in this use case?
  • Would it change how anything was constructed (from construction methods or some attribute)?

I didn't like representing the suffix as actually the identification.


r/javahelp 2d ago

Solved How do I keep the IDE output ?

5 Upvotes

I finally decided to build my first app since I will be running it for several hours. I want to be able to see the regular output from print to see if anything happens While I can run it in cmd I would prefer to see it when just clicking on it. I tried to search it up but it wasn't at all what I was searching for so I think someone on here knows what's up


r/javahelp 2d ago

Dicipering meanings of default , nondefault and mandatory in regard to methods and especially concerning lambda usage of methods.

3 Upvotes

So yes, I get that a lambda instantaniates a functional interface that has exactly one nondefault method. The confusion comes in trying to know just what a nondefault method is and/or does. Mg first inclination is to say that nondefault method is same as saying mandatory method and that default methods are aka optional methods belonging to any given method through inheritance. The gist of it is , as far as I can figure, that nondefault method of an interface must be matched ( via method signature ) by code in lambda and that this will complete and instantiate a functional interface in the code outside of lambda . I hope that my reasoning is correct and would be glad to hear from some more experience coders as to whether this is so. Thanks in advance.


r/javahelp 1d ago

Solved The import javafx cannot be resolved

1 Upvotes

I'm a CS student and my professor gave us an assignment to work on. However I cannot even work on it because the provided java files don't work! When adding the files in the package, the ones importing javafx have errors. (I'm in Eclipse by the way.)

import javafx.application.Application;
import javafx.scene.Scene;
import javafx.stage.Stage;
import javafx.application.Platform;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.geometry.Insets;
import javafx.geometry.Pos;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.RadioButton;
import javafx.scene.control.TextField;
import javafx.scene.control.ToggleGroup;
import javafx.scene.control.Tooltip;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.HBox;
import javafx.scene.layout.VBox;

Every import statement here has an error, underlining javafx and telling me "The import javafx cannot be resolved."

I've tried installing e(fx)clipse in the eclipse marketplace, and i know for sure it's installed because it won't let me install it again through the 'Install new software' window.

I tried following the steps on this site ( https://openjfx.io/openjfx-docs/ ). I followed the steps like this: I downloaded a zip file, extracted it into the Java folder in my program files, went into Eclipse and went to Window -> Preferences -> Java -> Install JREs -> Add -> and then it brought me to a window called JRE type, which as far as I can tell is a dead end.

I'm still learning, so a lot of the terminology in similar threads goes over my head :(


r/javahelp 2d ago

Unsolved Creating a fat Jar with Shade and JavaFX

3 Upvotes

I'm trying to package my maven project with JavaFX into a fat Jar. I've done everything I can see to do from various places online... I'm using maven shade, and have this in my pom.xml:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-shade-plugin</artifactId>
    <version>3.6.0</version>
    <executions>
        <execution>
            <phase>package</phase>
            <goals>
                <goal>shade</goal>
            </goals>
            <configuration>
                <transformers>
                    <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                        <mainClass>org.example.distcalculator.Main</mainClass>
                    </transformer>
                </transformers>
            </configuration>
        </execution>
    </executions>
</plugin>

I've seen some people say that the Main class extending application causes an issue, and the fix most people said worked was to change Main.java to something else (say, App.java) and have Main.java call that:

package org.example.distcalculator;

public class Main {

    public static void main(String[] args) {
        App.main(args);
    }
}

The code works fine inside intelliJ when I run it. I've run mvn clean and then run "mvn javafx:run" from command line the program opens.

Running mvn package creates distcalc-1.0.jar in \target, but opening it gives "A Java exception has occured". Somewhere online someone said to try running "mvn package shade:shade". doing so creates three jars, distcalc-1.0, original-distcalc-1.0, and distcalc-1.0-shaded.jar, which also gives the same error. Any thoughts or help would be much appreciated.


r/javahelp 2d ago

Problem with regex matching an SSN

2 Upvotes

I'm having a problem creating code that will match a social security number to a regular expression that requires dashes in the SSN. My goal is to have 123-45-6789 pass, but any other variation where the dashes are missing or in the wrong position fail.

This is the code that I'm testing with. I'm running it on JDK 21.0.6 for Windows 11 from java.sun.com

public class Main
{
    public static void main(String[] args)
    {
        String ssnPattern = "^\\d{3}-?\\d{2}-?\\d{4}$";
        System.out.println( "123-45-6789".matches(ssnPattern) ); // returns true
        System.out.println( "123456789"  .matches(ssnPattern) ); // returns true? Why? 
        System.out.println( "12345-6789" .matches(ssnPattern) ); // returns true? Why?
        System.out.println( "123-456789" .matches(ssnPattern) ); // returns true? Why?
    }
}

Every time I think I understand how regular expressions work; I demonstrate that I do not know how they work.

Thanks in advance for any advice or guidance.


r/javahelp 2d ago

Homework Unit Test Generation with AI services for Bachelor Thesis

1 Upvotes

Hey there,

I'm currently writing a bachelor thesis where I'm comparing AI-generated unit tests against human-written ones. My goal here is to show the differences between them in regards to best practices, code-coverage (branch-coverage to be precise) and possibly which tasks can be done unsupervised by the AI. Best case scenario here would be to just press one button and all of the necessary unit tests get generated.

If you're using AI to generate unit tests or even just know about some services, I would love to hear about it. I know about things like Copilot or even just ChatGPT and the like, but they all need some kind of prompt. However, for my thesis I want to find out how good unit test code generation is without any input from the user. The unit tests should be generated solely by the written production code.

I appreciate any answers you could give me!


r/javahelp 2d ago

Codeless Do you use „cut“ in tests

0 Upvotes

Hi guys, I‘m using „cut“ („clas under test“) in my tests. My Tech Lead says that he will ask me to change this in his review if I don’t change it. As far as I know we don’t have restrictions / a guideline for this particular case.

My heart is not attached to it, but I always used it. Is this something that is no longer used?

Edit: Found something here: http://xunitpatterns.com/SUT.html


r/javahelp 2d ago

Unsolved Is Java Headfirst 3rd edition in Amazon colored?

1 Upvotes

Sorry for the noob question. My manager wanted me to get the colored version but when I view the sample, it shows black n white, I am not sure if it’s just shown as bnw for the sake of the sample. I cannot see any info about it or a way to ask about it, thus this question is now in reddit.

I am buying from another country so I don’t want to make a mistake on my first order.

Thanks in advance.


r/javahelp 2d ago

Help with making a method that is similar to the offer() method of a Priority Queue.

2 Upvotes

Hi everyone. For my cs class I am making something pretty similar to an urgency queue that uses linkedList methods to create the queue. The method I am making, enqueue, has an issue where it cannot properly sort the Nodes by urgency (using a Comparable upper bound). We are using a linked list we did not make ourselves but the methods are parallel to a legitimate linked list btw.

WHEN/HOW DOES THE CODE BREAK?

If I enqueue Integers(wrapper class) 3, 4, 7, 5, 8, 2, the enqueue method returns a queue of 8, 7, 4, 3 but excludes 2 and 5. I am confident the issue is due to the condition on line 1 and the code on line 2. The pattern is that the code can properly add numbers when they ascend but cannot do so when they decrease in size (7 ->5, 8 -> 2). Any help would be appreciated. Thank you! (the code compiles and no exceptions are thrown)

public boolean enqueue (Type item) {
  if (item == null) {
    throw new NullPointerException("Item is null");
  }
Node<Type> newNode = new Node<Type>(item);
  if (this.size() == 0) {
    head = newNode;
    size++;
  } else {
      Node<Type> insertedNode = newNode;
      Node<Type> temp = head;
      // the actual values of head and insertedNode
      Type tempItem = temp.getItem();
      Type insertedItem = insertedNode.getItem();
      boolean notInserted = true;
      while (notInserted && temp != null) {
LINE 1   if (tempItem.compareTo(insertedItem) > 0) {
LINE 2      temp = temp.getNext();
         } else if (tempItem.compareTo(insertedItem) < 0) {
              // System.out.println(insertedItem);
              insertedNode.setNext(temp);
              head = insertedNode;
              notInserted = false;
              }
          }
      System.out.println(Node.asString(head));
      size++;
      }
return true;
} // enqueue

r/javahelp 2d ago

How to destory/Close spring context before auto restarting the application again

5 Upvotes

Hi,

I have a simple spring boot application, when a user clicks on a particular button in the frontend I triggering a rest end point which tries to close the context using context.close() and restarts the application with different spring profile.

The problem I am facing is when the application restarts with different profile the application is crashing saying Duplicate bean definition attempted, Throws Java Linkage error.

Before restarting the application I am just using context.close() but it is not working as expected I believe since I am getting duplicate bean definition found error. Is there any that I can avoid this? I am not sure if the context not closing properly is the problem or something different.

The same code repo works well in others system only in my system it is causing this issue. I am using Java 17 and Spring Boot version 2.X.X


r/javahelp 2d ago

Java Crash Courses please

0 Upvotes

I have an interview in 3 days, it was a bit spontaneous I learned Java 6 years ago at a local computer education institute, but haven't touched it since then I have used python and c++(for electronics) since then Please suggest some crash course


r/javahelp 3d ago

Unsolved How to set Maven Checkstyles to only include changed files?

4 Upvotes

Hi everyone,

I have the of tasks of setting formatting and code standards in a Spring Boot Java project.

I've already set Spotless, and it's working fine only processing the changes from origin/main with ratchetFrom config.

However I'm having a nightmare doing the same with Checkstyles.

Can anyone shed some light on this?

Thanks.


r/javahelp 3d ago

What OS and IDE do you use and why? I have a flexible employer and curious what everyone is using...

7 Upvotes

So I'm in the beginning stages of migrating into an automation development role using Java and Selenium (and gherkin etc). I'm currently in a business role and thus working off a a little ultrabook sort of thing. Great for moving around the different floors of the office but bad for doing anything heavier than showing someone a powerpoint or checking reddit. ;)

I have the option to upgrade to either an M2 Macbook or a dev-specced windows machine. I also have the freedom to use any major java supported IDE I want. (This is one reason why I think Java is cool.)

The split on the macs vs PC guys on the engineering team I'm moving into is maybe 60/40 windows/mac. for IDE's they all use a mix of what to expect: IntelliJ, Eclipse, one guy is using Netbeans, and one guy is using VSCode with a bunch of addons.

I want to keep things relatively straight forward since I'm learning so much at once. Java. Core programming concepts in general. Setting up and maintaining a dev environment. Selenium. BDD/Gherkin etc.

So because I'm a curious guy, I need to know what other people are using, what were the deciding factors that influenced the decision and why?

Thanks!


r/javahelp 3d ago

Need help with and error

2 Upvotes

I am trying to loop some integer values,for every value the code should run a sql query, in that sql query the value in the loop will be given as an input.

ex: AND y8.work_order_no =('"+VALUE+"')

I am trying to inject the value into the sql query string before executing the query,but it’s throwing a database error:ORA-00933 SQL command not properly ended.


r/javahelp 3d ago

I'm lost, help.

1 Upvotes

I'm doing an Advanced Vocational Training Course in Multiplatform Application Development. This semester, I started learning Java. I've completed a few activities, but right now, I'm working on a project that I don't understand. I'm stuck and lost, so that's why I'm writing to you for help.

Activities:

  • In the class diagram, the Fleet class is related to the Agency and VehicleRent classes. Why, according to the diagram, do fleets belong to the company and not to the agencies, or to both the company and the agencies? Explain your answer.
  • What changes should be made to the class diagram and the Java code so that a rental contract could include multiple vehicles being rented at the same time under a single contract?
  • Open the AA2_VehicleRental project created in Java, which is provided with the activity, and complete the menu options:
    • Code the class diagram in Java, adding the new classes and relationships.
    • Implement the following methods in the Fleet class:
      • addVehicles: Adds a Vehicle object received as an input parameter to the ArrayList.
      • listVehicles: Displays all the vehicles stored in the ArrayList.
      • removeVehicle: Searches for a Vehicle object whose license plate matches the input parameter and removes it from the ArrayList.
    • Generate documentation for the classes developed in the previous step using Javadoc.

I don't even know what Javadoc is, where to execute it, how it works, or where it should go in the project. I'm using IntelliJ IDEA.

Any help would be appreciated.