Jump to content

[INTELJI] [Java] Get cpu name (Example: Intel(r) core i7 9700k)

WillLTT
Go to solution Solved by Trinopoty,

It's java.util.List not java.awt.List.

Im willing to import external libraries, IF your tell me how to use them.

 

I know about oshi. but i cannot for the life of me figure out how to make it work.

same goes for JSensors

 

... i cant figure out how to use them. I can import them into Intelji IDEA, but then i cant make them print out cpu name,

 

 

ANY HELP is very very apprichiated. :D

Link to comment
Share on other sites

Link to post
Share on other sites

    Components components = JSensors.get.components();

    List<Cpu> cpus = components.cpus;
    if (cpus != null) {
        for (final Cpu cpu : cpus) {
            System.out.println("Found CPU: " + cpu.name);
        }
    }

Just took this from the JSensors github page.

Link to comment
Share on other sites

Link to post
Share on other sites

2 minutes ago, Trinopoty said:

--snip--

Error: 57, 13 java: type.java.awt.list does not take parameters.

 

trying to compile that code.

Link to comment
Share on other sites

Link to post
Share on other sites

23 hours ago, Trinopoty said:

Who uses AWT anyways these days?

Like all the softwares made back in the early 2000s and still being actively developed and maintain. Developers are too lazy to rewrite it in more modern gui. I use so many gui java application whose interfaces are clearly old java swing compoents. Some people still use it to write new applications beacuse it has been the de facto framework for so many years. 

 

E.g. Mars mips assembler/debugger/IDE i used for mips programming.

Star trek online keybind applications i used to map keys for STO(an online game)

DPS calculator i used to calculate damges/stats of players/enemies for another video game. 

Heck, even IDEs like pycharm/clion/intellij have gui compoents still written in swing. Just look at its updater. 

 

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

×