r/javahelp • • Mar 08 '20

Eclipse

2 Upvotes

Anyone know a good website/YouTube videos to download and configure eclipse on a MacBook Pro? Or is it as simple as downloading it from a eclipse website?


r/javahelp • • Apr 14 '24

How do I install Java?

2 Upvotes

I'm sorry for this stupid question, but I'm really struggling here. I'm using Linux, and I don't know what I should install, there are so many packages. Should I install java, jdk, jvm, jre??? Maybe Openjdk? Java 8, 17 or 20?
For context, I'm coming from Python and a little bit of C, and installing python is easy you just install the python interpreter and run "python", or with C you just install GCC and glibc (if you don't have it for some reason). But for Java there are so many options and so many packages I just want to compile and run Java files, with the Java standard library, help please?


r/javahelp • • Oct 10 '15

Write a public method called reverse, which is passed a String as a parameter and which returns the input parameter in reverse order --- a String value. Example: "abcd" --> "dcba"

2 Upvotes

public String reverse(String x){

for (int i = (x.length()-1); i>=0;i=i-1){

}

return(x.charAt(i));

}


r/javahelp • • Nov 20 '24

My CS senior project please help me passing my anxiety :)

0 Upvotes

my senior project as CS student will be as Web App using these technologies as I told the Projects committee at the college: Java, HTML,CSS,JavaScript and MySQL which almost I should committed to while I am doing the project.

I can use the Core java or spring/spring boot (Like I know what the difference).. I dont have knowledge in connecting with database using Core java nether the frameworks..

The QUESTION is what should I do** what is the easiest way to do this project ** between the two options and to pass my anxiety and this college.

Please your knowledge and expertise will really help me in this situation thanks in advanced.


r/javahelp • • Dec 04 '23

Unsolved Is Java good for developing web app?

2 Upvotes

hi, I have a question for using Java to develop web app.

I know that Java is very popular in developing mobile app, but I noticed that PHP Laravel and Ruby on Rails are more widely used in web app than Java.

Is Java really good for developing web app?

Thanks!


r/javahelp • • Feb 21 '21

I have hard time with design patterns, should I switch to nodejs?

0 Upvotes

I am Java developer, also know kotlin. But I am having hard time dealing with oops and design patterns.. Should I switch to nodejs..? Since AFAIK it doesnt have oops.


r/javahelp • • Oct 30 '18

Encoding a 4 digit number

2 Upvotes

Hello, so I need help understanding the error in my javascript here. It's supposed to take a 4 digit number and switch the 1st with the 3rd digit as well as the 2nd with the 4th. Here is the code. I think the error has something to do with how I set up the document, but I'm not quite sure, it looks fine to me.

I'll open in chrome, Firefox or Edge, all that will happen is that it shows the title at the top of the browser tab and that's it. I'm using the newest version notepad++

<?xml version = "1.0" encoding = "utf-8"?>

<!DOCTYPE html>

	<head>
		<title>Encryption</title>
		<script type="text/javascript">
		import java.util.Scanner; //Needed for Scanner class

public class LNFI_LNFI_program2 { public static void main(String[] args) { getnum(); //Calls for getnum() method

}
public static int getnum() { int fourD = 0, stringSize = 0; String fourDs; //To hold the value of input number in a String

Scanner kb = new Scanner(System.in);
while (stringSize != 4)
{
  System.out.println("Enter a four digit number"); //Prompt user for four digit number
  fourDs = kb.nextLine();
  stringSize = fourDs.length(); //Checks length of String
   
  if (stringSize == 4)
  {
     
    fourD = Integer.parseInt(fourDs);

  }
}
encrypt(fourD);
return fourD; //Return value of input
}

public static int encrypt(int num) { int a, b, c, d;

a = num / 1000;
b = num / 100 % 10;
c = num / 10 % 10;
d = num % 10;
 
a = (a + 7)%10;
b = (b + 7)%10;
c = (c + 7)%10;
d = (d + 7)%10;
 
System.out.println(c+d+a+b);
return (c+d+a+b); //Returns encrypted value
		</script>
	</head>
	<body></body>
</html>

r/javahelp • • Jan 12 '15

Playing a simple .mp3 file in this language is one of the hardest things I've ever tried to do.

2 Upvotes

Sorry if my vocabulary is not accurate. My idea is to have something like this:

..... Static List<String> fileNames = new ArrayList<String>(); .. Other fancy stuff Int I; ..

Public static void main(String[] args){ playSound(fileNames[i]); ..do other stuff.. playSound(fileNames[i+1]); }

Where playSound(); is a command to play the sound of a given String, which in this case comes from the Array list. Does that make sense?


r/javahelp • • Sep 20 '15

Integrating a BASIC emulator into a java project

0 Upvotes

I would like to integrate a BASIC code emulator/interpreter in my latest Java-based game. The idea is to have the character in the game to open up a BASIC command console so that it can interact with certain objects in the game. Could someone give me some pointers or suggestions on how to implement a BASIC interpreter into Java?


r/javahelp • • Mar 27 '21

Solved 1%2=1?

2 Upvotes

i dontunderstand the results when the nr to the right is larger

ofc 4%3=1

but why 3%4=3


r/javahelp • • May 08 '22

Codeless Java Only using 1% of ONE THREAD of my R7 3700x

2 Upvotes

I just translated a python program to java to speed it up, but it's only about 28% faster, and using almost none of my CPU's power. I figured it should use a full thread, but when I look at task manager (Windows) I can't tell it's running...

I've tried using both Eclipse and Intellij, I've tried increasing the process priority, no other programs are open really either. What am I doing wrong?


r/javahelp • • Sep 07 '19

What is the difference between "char c = a" and "char c = 'A'"?

2 Upvotes

I've tried googling it, but I can't find an explanation..


r/javahelp • • Feb 22 '16

Why is Java being deprecated in browsers?

0 Upvotes

Chrome and Edge have dropped Java support. Why is this happening?


r/javahelp • • Oct 19 '13

Please help me with this Java Question

0 Upvotes

The mathematician Augustus De Morgan was aged 43 in the year 1849AD. This is interesting because 43 squared is 1849, ie, in 1849 his age was the square root of the year. Given that no person has ever lived longer than 123 years (and assuming that no one ever will), write a Java application that will determine if it is possible that anyone who is alive today is, has ever been, or will ever be alive in a year that is the square of their age. If it is possible, your program should print out the years in which it happens and the ages that the people concerned will have in those years.

Here is what I have worked on till now

public class SquareAge {

public static final int START_YEAR=2013;
public static final int YEAR_MAX= 2136;
public static final int YEAR_MIN=1890;
public static final int MAXIMUM_AGE=123;


		

	public static void main(String[] args) {
		
	
	int age;
			for (age=0; age<=MAXIMUM_AGE; age++);
		    	
				{
					int agesquare=age*age;
				
				
				
				if (agesquare>=YEAR_MIN && agesquare<=YEAR_MAX &&  age>=agesquare-START_YEAR) 
				{
					System.out.print("the age is " + age + " the year is " + agesquare);
					
				}
				
				else
				{
					System.out.print("none");
				}
				
				
				}
	}
}

r/javahelp • • Jun 17 '19

Running one Java program in Intellji will launch and run another program.

0 Upvotes

https://youtu.be/ZWjF_4P1CQg

It's really annoying. No matter what I do, another program runs. I have separated the Package file*, but it didn't work.*

Do we need to create a new project every time we want to run a new small java program ?!


r/javahelp • • Sep 03 '13

How do I go about learning Java?

2 Upvotes

I am a student who just got introduced to Java. I'm coming from a background of mainly C and some C++. I would like some expert opinion on how to go about learning java. I would prefer video lectures in addition to reference books. I have already done some studying and DON'T find it very confusing. I just don't know how to move from the beginner level to the intermediate level and eventually to advanced level.

PS: I'm sorry if this question has been asked before, I would like to get fresh answers please. Thank you.


r/javahelp • • May 19 '15

Help a AP CS student out...please

2 Upvotes

Hey guys,

So in my AP Computer Science class I was assigned a final project.. My friend and I decided to try to make a piano/cello that plays a sound when a user presses a key on the keyboard. However, my teacher taught us almost nothing on how to make a GUI or even what it is really, and we barely know how to do anything more than for loops, while loops, etc. Are there any tips for beginners like us? I cannot find good tutorials regarding GUIs and using sounds in java, or if any of you guys can help i'd appreciate it. Thanks.


r/javahelp • • Apr 17 '13

somewhat new to java

2 Upvotes

i understand the concept of objects and creating objects i just dont know how to define an object subclass from scratch...


r/javahelp • • Jan 08 '22

Homework "return x.equals(((Item)o).getX());" What does this mean?

2 Upvotes

Hi I am learning Java and came across this:

@Override	  		     	   	    	    	  	
public boolean equals(Object o) {	  		     	   	    	    	  	
  return x.equals(((Item)o).getX());	  		     	   	    	    	  	
}

I am not sure what it means when it is returning that entire thing? I have not seen just "Object" in the parameter like that either. Sorry if I am not being very clear.


r/javahelp • • Nov 13 '22

Best resources to learn Java in shortest time?

2 Upvotes

Hi everyone,

I have planned to start learning Java but I don't know where to start. Can you please help me out?

Thank you so much in advance!


r/javahelp • • Dec 07 '22

help idk how to use an array list using input scanner

2 Upvotes

String ans;

Scanner input = new Scanner(System.in);

String animals[] = {"fox" ,"cat","dog","chicken","komodo dragon" };

ans = input.nextLine();

switch(animals[ans])

case "2":

System.out.println(animals\[2\] + " Is a good boi");

break;


r/javahelp • • Nov 10 '22

shortest path to make money with Java (favorably freelancing Upwork)

2 Upvotes

I am learning Java at school and wondering if there a way that I can learn and make money with Java (since I am studying it anyway )


r/javahelp • • Sep 12 '15

JavaEE HelloWorld - Getting Started with TomEE from scratch.... A reminder for those who think Java is too complex....

0 Upvotes

Assuming that you already have the Java SDK installed, these are the steps to get a hello world program running in TomEE.

  1. Download / unpack Tomee.

    wget http://mirror.catn.com/pub/apache/tomee/tomee-1.7.2/apache-tomee-1.7.2-jaxrs.tar.gz tar -xvf apache-tomee-1.7.2-jaxrs.tar.gz

  2. Create folders to store your app.

    mkdir -p apache-tomee-jaxrs-1.7.2/webapps/helloworld/WEB-INF/classes cd apache-tomee-jaxrs-1.7.2/webapps/helloworld/WEB-INF/classes

  3. Create the HelloWorld.java

    vi HelloWorld.java

    import javax.ws.rs.*;

    @Path("/") public class HelloWorld {

     @GET
         public String home(){
         return "Hello World";
     }

    }

  4. Compile it.

    javac -classpath "../../../../lib/*" *.java

  5. Start the server.

    sh ../../../../bin/startup.sh

  6. Navigate to page http://localhost:8080/helloworld


r/javahelp • • Apr 07 '25

Help me with this stupid course (F)

0 Upvotes

So I am taking Data structure course and for some reason it’s difficult for me we are only taking arrays linked lists (single,circular , double circular) recursion and stacks but for some reason I keep messing up my quizzes and midterm I am much better at OOP course (Java) how can I enhance my skills so I don’t fail.