How do I access My jar in the mac os terminal. I have a jar in my desc top called System FRONT.jar

First, I put
cd desktop
then i put

 java -jar System FRONT.jar

It says unable to access jarfile system

Then I tried another jar which does not exist, it also says unable access jar file system. How do i fix?

Does that JAR file really have a space in between "System" and "FRONT". If yes, I guess you'll need to enclose the entire thing in quotes. Something like: java -jar "System FRONT.jar".

When I did it, it says,

Exception in thread "main" java.lang.NoClassDefFoundError: net/packNetSystem
Caused by: java.lang.ClassNotFoundException: net.packNetSystem
    at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:247)

I'm assuming this class isn't part of the "System FRONT".jar? Anyways, this means you are missing a dependency. Stock JAR files can't have other JAR files inside them as dependencies. You'll have to search for the JAR file containing the given class net/packNetSystem and invoke your JAR as:

java -cp "System FRONT.jar":packnet.jar your.main.class

Here your.main.class is the entry point or the main class of the System FRONT.jar which is automatically invoked in case you use the -jar switch. Here I'm assuming you already know the main class which resides in your System FRONT.jar.

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.