I'm having issues with Intellij, when I'm running my code I get an error I don't care that I'm copy/pasting my full filepath with name. Secret Message is the program I'm working on. When I use UTF-8 encoding, the same error occurs, just with UTF-8 instead of ISO-8859-1.
"C:\Program Files\Java\jdk-21\bin\java.exe" "-javaagent:C:\Users\forel\AppData\Local\Programs\IntelliJ IDEA Community Edition\lib\idea_rt.jar=55495:C:\Users\forel\AppData\Local\Programs\IntelliJ IDEA Community Edition\bin" -Dfile.encoding=ISO-8859-1 -Dsun.stdout.encoding=ISO-8859-1 -Dsun.stderr.encoding=ISO-8859-1 -classpath "C:\Users\forel\IdeaProjects\Secret Message\out\production\Secret Message" SecretMessage
EDIT: My Jetbrains Program Files Folder is empty????
import java.util.Scanner;
public class SecretMessage {
public static void main(String[] args) {
Scanner scn = new Scanner(System.in);
String str = scn.nextLine();
String newStr = encode(str);
System.out.println(newStr);
}
public static String encode(String str) {
String letters = "abcdefghijklmnopqrstuvwxyz";
String enc = "kngcadsxbvfhjtiumylzqropwe";
for (int i = 0; i < str.length() - 1; i++) {
str = str.toLowerCase();
}
for (int i = 0; i < str.length() - 1; i++) {
for (int j = 0; j < str.length() - 1; j++) {
if (letters.charAt(i) == enc.charAt(j)) {
str = str.replace(str.charAt(i), enc.charAt(j));
}
}
}
return str;
}
}
I'm not getting any actual errors with the code. I'm inputting a string, creating a cipher, looping through the cipher, and converting the string to the new result. Then attempting to print it to console. If I did have any issues with how I'm looping through the cipher, I can figure it out on my own. What I NEED is to figure out what this weird issue is.