Jump to content

I have completely borked Java

DrMacintosh

Hello, just started taking Java classes and I've been trying to get a basic IDE installed. I finally found one that looks halfway decent, but when I try to run even a basic Hello world program, I get a massive string of errors. 

 

Here is what it says:

objc[3074]: Class JavaLaunchHelper is implemented in both /Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home/bin/java (0x105b294c0) and /Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home/jre/lib/libinstrument.dylib (0x105b9f4e0). One of the two will be used. Which one is undefined.
Exception in Application start method
java.lang.reflect.InvocationTargetException
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:389)
	at com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:328)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at sun.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:767)
Caused by: java.lang.RuntimeException: Exception in Application start method
	at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:917)
	at com.sun.javafx.application.LauncherImpl.lambda$launchApplication$155(LauncherImpl.java:182)
	at java.lang.Thread.run(Thread.java:745)
Caused by: javafx.fxml.LoadException: 
/Users/ericmelendez/Desktop/out/production/Desktop/sample/sample.fxml:7

	at javafx.fxml.FXMLLoader.constructLoadException(FXMLLoader.java:2601)
	at javafx.fxml.FXMLLoader.access$700(FXMLLoader.java:103)
	at javafx.fxml.FXMLLoader$ValueElement.processAttribute(FXMLLoader.java:922)
	at javafx.fxml.FXMLLoader$InstanceDeclarationElement.processAttribute(FXMLLoader.java:971)
	at javafx.fxml.FXMLLoader$Element.processStartElement(FXMLLoader.java:220)
	at javafx.fxml.FXMLLoader$ValueElement.processStartElement(FXMLLoader.java:744)
	at javafx.fxml.FXMLLoader.processStartElement(FXMLLoader.java:2707)
	at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2527)
	at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2441)
	at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3214)
	at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3175)
	at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3148)
	at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3124)
	at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3104)
	at javafx.fxml.FXMLLoader.load(FXMLLoader.java:3097)
	at sample.Main.start(Main.java:13)
	at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$162(LauncherImpl.java:863)
	at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$175(PlatformImpl.java:326)
	at com.sun.javafx.application.PlatformImpl.lambda$null$173(PlatformImpl.java:295)
	at java.security.AccessController.doPrivileged(Native Method)
	at com.sun.javafx.application.PlatformImpl.lambda$runLater$174(PlatformImpl.java:294)
	at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
Caused by: java.lang.ClassNotFoundException: sample.Controller
	at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
	at javafx.fxml.FXMLLoader$ValueElement.processAttribute(FXMLLoader.java:920)
	... 19 more
Exception running application sample.Main

Process finished with exit code 1

 

 

at this point I have no idea if removing my operating system of this garbage is even possible. I have a Time Machine backup from prior to me just trying to make a basic Hello World program. Would that just be easier? 

Laptop: 2019 16" MacBook Pro i7, 512GB, 5300M 4GB, 16GB DDR4 | Phone: iPhone 13 Pro Max 128GB | Wearables: Apple Watch SE | Car: 2007 Ford Taurus SE | CPU: R7 5700X | Mobo: ASRock B450M Pro4 | RAM: 32GB 3200 | GPU: ASRock RX 5700 8GB | Case: Apple PowerMac G5 | OS: Win 11 | Storage: 1TB Crucial P3 NVME SSD, 1TB PNY CS900, & 4TB WD Blue HDD | PSU: Be Quiet! Pure Power 11 600W | Display: LG 27GL83A-B 1440p @ 144Hz, Dell S2719DGF 1440p @144Hz | Cooling: Wraith Prism | Keyboard: G610 Orion Cherry MX Brown | Mouse: G305 | Audio: Audio Technica ATH-M50X & Blue Snowball | Server: 2018 Core i3 Mac mini, 128GB SSD, Intel UHD 630, 16GB DDR4 | Storage: OWC Mercury Elite Pro Quad (6TB WD Blue HDD, 12TB Seagate Barracuda, 1TB Crucial SSD, 2TB Seagate Barracuda HDD)
Link to comment
Share on other sites

Link to post
Share on other sites

Try Eclipse.

 

What's the hello world code that you've got?

 

Could be broken/bad code, could be that you need to reinstall Java.

Specs: CPU - Intel i7 8700K @ 5GHz | GPU - Gigabyte GTX 970 G1 Gaming | Motherboard - ASUS Strix Z370-G WIFI AC | RAM - XPG Gammix DDR4-3000MHz 32GB (2x16GB) | Main Drive - Samsung 850 Evo 500GB M.2 | Other Drives - 7TB/3 Drives | CPU Cooler - Corsair H100i Pro | Case - Fractal Design Define C Mini TG | Power Supply - EVGA G3 850W

Link to comment
Share on other sites

Link to post
Share on other sites

3 minutes ago, TheKDub said:

Try Eclipse.

 

What's the hello world code that you've got?

 

Could be broken/bad code, could be that you need to reinstall Java.

I even verified with generic templet code. The code is perfect.

class Solution {
  public static void main(String args[]) {
    System.out.println("Hello World!");
  }
}

But everything about Java on my Mac seems to be completely broken. I've tried all the IDEs out there, including Eclipse. The farthest I got was with IntelliJ

Laptop: 2019 16" MacBook Pro i7, 512GB, 5300M 4GB, 16GB DDR4 | Phone: iPhone 13 Pro Max 128GB | Wearables: Apple Watch SE | Car: 2007 Ford Taurus SE | CPU: R7 5700X | Mobo: ASRock B450M Pro4 | RAM: 32GB 3200 | GPU: ASRock RX 5700 8GB | Case: Apple PowerMac G5 | OS: Win 11 | Storage: 1TB Crucial P3 NVME SSD, 1TB PNY CS900, & 4TB WD Blue HDD | PSU: Be Quiet! Pure Power 11 600W | Display: LG 27GL83A-B 1440p @ 144Hz, Dell S2719DGF 1440p @144Hz | Cooling: Wraith Prism | Keyboard: G610 Orion Cherry MX Brown | Mouse: G305 | Audio: Audio Technica ATH-M50X & Blue Snowball | Server: 2018 Core i3 Mac mini, 128GB SSD, Intel UHD 630, 16GB DDR4 | Storage: OWC Mercury Elite Pro Quad (6TB WD Blue HDD, 12TB Seagate Barracuda, 1TB Crucial SSD, 2TB Seagate Barracuda HDD)
Link to comment
Share on other sites

Link to post
Share on other sites

when creating the project did you select console application?

 

you should link the tutorial/materials youre using and maybe a screenshot of the ide with code

MSI GX660 + i7 920XM @ 2.8GHz + GTX 970M + Samsung SSD 830 256GB

Link to comment
Share on other sites

Link to post
Share on other sites

I use Netbeans and it works okay. I have concluded Java is trash as a language though. The syntax to me isn't logical, coming from Python, and it's hard to find a good IDE, they all feel tacked together  

That's an F in the profile pic

 

 

Link to comment
Share on other sites

Link to post
Share on other sites

1 hour ago, DrMacintosh said:

I even verified with generic templet code. The code is perfect.


class Solution {
  public static void main(String args[]) {
    System.out.println("Hello World!");
  }
}

But everything about Java on my Mac seems to be completely broken. I've tried all the IDEs out there, including Eclipse. The farthest I got was with IntelliJ

Must be a wack Java install then. I'd try reinstalling it.

Specs: CPU - Intel i7 8700K @ 5GHz | GPU - Gigabyte GTX 970 G1 Gaming | Motherboard - ASUS Strix Z370-G WIFI AC | RAM - XPG Gammix DDR4-3000MHz 32GB (2x16GB) | Main Drive - Samsung 850 Evo 500GB M.2 | Other Drives - 7TB/3 Drives | CPU Cooler - Corsair H100i Pro | Case - Fractal Design Define C Mini TG | Power Supply - EVGA G3 850W

Link to comment
Share on other sites

Link to post
Share on other sites

1 minute ago, TheKDub said:

Must be a wack Java install then. I'd try reinstalling it.

That’s what I tried and I actually managed to get the program to print the line correctly. (though not without the non-error that the program has built in)

 

Thankfully the Java uninstall process through Terminal was rather thorough. 

Laptop: 2019 16" MacBook Pro i7, 512GB, 5300M 4GB, 16GB DDR4 | Phone: iPhone 13 Pro Max 128GB | Wearables: Apple Watch SE | Car: 2007 Ford Taurus SE | CPU: R7 5700X | Mobo: ASRock B450M Pro4 | RAM: 32GB 3200 | GPU: ASRock RX 5700 8GB | Case: Apple PowerMac G5 | OS: Win 11 | Storage: 1TB Crucial P3 NVME SSD, 1TB PNY CS900, & 4TB WD Blue HDD | PSU: Be Quiet! Pure Power 11 600W | Display: LG 27GL83A-B 1440p @ 144Hz, Dell S2719DGF 1440p @144Hz | Cooling: Wraith Prism | Keyboard: G610 Orion Cherry MX Brown | Mouse: G305 | Audio: Audio Technica ATH-M50X & Blue Snowball | Server: 2018 Core i3 Mac mini, 128GB SSD, Intel UHD 630, 16GB DDR4 | Storage: OWC Mercury Elite Pro Quad (6TB WD Blue HDD, 12TB Seagate Barracuda, 1TB Crucial SSD, 2TB Seagate Barracuda HDD)
Link to comment
Share on other sites

Link to post
Share on other sites

You are doing more than just hello world. I see javafx and fxml loader on there which shouldn't be there if you are merely printing out hello world. 

Sudo make me a sandwich 

Link to comment
Share on other sites

Link to post
Share on other sites

1 hour ago, wasab said:

You are doing more than just hello world. I see javafx and fxml loader on there which shouldn't be there if you are merely printing out hello world. 

^--- he's right Eric, you shouldn't have the fx errors showing. Could also be an issue with the environment paths but that's usually all you have to config to use java on any computers.

Link to comment
Share on other sites

Link to post
Share on other sites

16 hours ago, DrMacintosh said:

I even verified with generic templet code. The code is perfect.


class Solution {
  public static void main(String args[]) {
    System.out.println("Hello World!");
  }
}

But everything about Java on my Mac seems to be completely broken. I've tried all the IDEs out there, including Eclipse. The farthest I got was with IntelliJ

Nothing is perfect but I'd say it's functional as it does in fact work:

Spoiler

image.png.fd2662e7a450fe4636d2e7eea48328b1.png

I'd suggest trying javac [filename.java] in terminal from the folder in which your program is located and running it with java [filename] (no extension like .java or .class) to make sure the java installation works correctly. Because as you might've guessed you don't really need an IDE to make a program in Java, but it makes things a whole lot easier due to having debug tools and it runs the comandline stuff for you :)

 

1 hour ago, Franck said:

Could also be an issue with the environment paths but that's usually all you have to config to use java on any computers.

I think something like this is in fact the case due to the top line of the error message:

Quote

objc[3074]: Class JavaLaunchHelper is implemented in both /Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home/bin/java (0x105b294c0) and /Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home/jre/lib/libinstrument.dylib (0x105b9f4e0). One of the two will be used. Which one is undefined.

It's about not knowing which path should be used, dunno how this stuff is setup on a mac so wouldn't know how to help much further ?

 

 

16 hours ago, Froody129 said:

I use Netbeans and it works okay. I have concluded Java is trash as a language though. The syntax to me isn't logical, coming from Python, and it's hard to find a good IDE, they all feel tacked together  

Java isn't trash for the reasons you give here, it's syntax is similar to C which is (next to java) one of the most used language types there are. It's rather not great because it's ran in a virtual machine which is running in your OS making it not directly aces resources and therefor slower and less flexible than something like C or C++ which are compiled to binary files to run directly on the hardware instead of in the VM. 

while (alive == true) { breathe(); }

 

Link to comment
Share on other sites

Link to post
Share on other sites

18 hours ago, Froody129 said:

I use Netbeans and it works okay. I have concluded Java is trash as a language though. The syntax to me isn't logical, coming from Python, and it's hard to find a good IDE, they all feel tacked together  

Java isnt a trash language but netbeans is a trash IDE and really makes java development a pain in the ass. 

Sudo make me a sandwich 

Link to comment
Share on other sites

Link to post
Share on other sites

I'm just checking in here, I know it's a little while down the road, did you ever get your IDE working? I recommend IntelliJ and I may be able to help with your JDK.

Link to comment
Share on other sites

Link to post
Share on other sites

Let me guess, you are trying to write a desktop application, right?

 

To do things in Java, you only need two things:

  1. IntelliJ - fetch the community version from Jetbrains
  2. JDK - fetch OpenJ9 from https://adoptopenjdk.net

From there on, create new project (whatever kind you want), point the JDK setting of IntelliJ to Openj9 installation and that should be it.

 

It might be also that your code is somehow broken. Without source of what you are actually doing it's kind of hard to tell what exactly broke there.

Link to comment
Share on other sites

Link to post
Share on other sites

  • 4 weeks later...

Which IDE did you install?

I've been using IntellijIDEA Community Edition for a long time now and have never had such issues.

Link to comment
Share on other sites

Link to post
Share on other sites

This thread is necro...

 

Sudo make me a sandwich 

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×