private static Sigar sigar = new Sigar();
Les champs statique de ta classe sont initialisés avant de rentrer dans le main. Le main() devrait être la toute première chose que fait ton programme. Du coup, il ne devrait y avoir aucun champ statique dans ta classe. Retire le static, remplace toutes tes méthodes statiques, a l'exception de loadDll par des méthodes d'instance, fait un new Main() après le loadDll et utilie cette instance pour tous tes appels.
1 2 3 4 5 6 7 8 9 10 11 12 13 14
| public static void main(String args[]) throws IOException {
//----------Calling for DLL importation method-----------
loadDLL();
//-------------------------------------------------------
Main main = new Main();
//----------------Displaying Informations----------------
main.getGeneralInformations();
main.getInformationsAboutCPU();
// etc. |
Partager