Hi, I am quite new to Comp Sci and I just wrote a program in BlueJ that calculates the value of truth tables and validity in arguments. I followed the book's instructions and have a method with the signature: (It's in the class "Main")
public static void main(String[] args) {
code omitted...
}
}
When I call this method in BlueJ it works perfectly fine. However when I run the JAR file, nothing happens.
Any help would be appreciated (this includes direction to material that discuss this).
Thanks in advance!

You need to provise more information. How was the jar file created, how do you run it, and do you get any error messages?

You need to provise more information. How was the jar file created, how do you run it, and do you get any error messages?

BlueJ has an export option that creates the JAR file for you (if there is another way to do it, that would also be helpful). When I run (double-click) it nothing happens, as opposed to a terminal opening which allows me to interact with the program (that is what is supposed to happen when I run the main(String[] args) method, it works on blueJ).

Just because it creates a jar file, doesn't mean it is executable. It only contains all the classes of your project. Then you can take that jar and you can import it to another project and call the classes that are inside.

If that jar file has a class that has a main method inside then you can run the class from command prompt from the jar file.

So my answer is that I don't know how BlueJ creates a jar file. I read somewhere that the jar file has a MANIFEST file inside where you declare if the jar is executable and what class contains the main method.

I would suggest to search the internet on how to create an executable jar file.

Read the documentation of the jar tool (which is part of the documentation set of the JDK, as the jar tool is part of the JDK) for instructions on how to create executable jar files.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.