I've been writing a small system for my job in IntelliJ, building Jars with dependencies as I went along, to check if I could build it in a way that would let it run outside IntelliJ. One day, the Jar started giving me JNI errors when I tried to open it. I looked for ages trying to fix it, and ended up (somewhat) fixing it, by editing my manifest.mf file before building the jar. My manifest file now looks like this:
Manifest-Version: 1.0
Class-Path: C:\Users\mac\IdeaProjects\sqljdbc_6.0\enu\sqljdbc4.jar
Main-Class: Main
(2 blank lines)
The system uses the sqljdbc to connect to an azure database. It compiles and runs perfectly well in intelliJ, but now when I try and run the jar, it gives me the following error: ERROR: Could not find or load main class Main. The main class is not in any package in my program, and it seems like all the options other people have suggested, are already correctly set. I've tried to run it in CMD with java -jar, and with -cp, which results in the same error. Another weird thing is that trying to compile the Main.java file in the CMD gives me a massive stack of nonsensical compilation errors, despite it compiling in intelliJ. Any other ideas...? I'm blank.
Here's the main class:
imports....
public class Main {
public static void main(String[] args) {MWBFrame frame = new MWBFrame("MWB SQL Lookup");
}
}
It creates the main frame of the GUI, which is just an extension of a JFrame.
And here's the CMD output when trying to java -jar it (can't post images yet): https://i.stack.imgur.com/yOBNR.jpg