Differences between “java -cp” and “java -jar”?

I prefer the first version to start a java application just because it has less pitfalls (“welcome to classpath hell”). The second one requires an executable jar file and the classpath for that application has to be defined inside the jar’s manifest (all other classpath declaration will be silently ignored…). So with the second version … Read more

Running JAR file on Windows 10

I have made a Jar file, but I cant make it to run by double clicking.It works fine using java -jar name.jar or by making a batch file.I have already reinstalled jdk1.8.0_102, set the JAVA_HOME variable and javaw.exe in the jre folder is already the default program to run it.so how do I make it to run by double clicking?

Running JAR file on Windows

Easiest route is probably upgrading or re-installing the Java Runtime Environment (JRE). Or this: Open the Windows Explorer, from the Tools select ‘Folder Options…’ Click the File Types tab, scroll down and select JAR File type. Press the Advanced button. In the Edit File Type dialog box, select open in Actions box and click Edit… … Read more

What exactly does a jar file contain?

A JAR file is actually just a ZIP file. It can contain anything – usually it contains compiled Java code (*.class), but sometimes also Java sourcecode (*.java). However, Java can be decompiled – in case the developer obfuscated his code you won’t get any useful class/function/variable names though.

Can’t execute jar- file: “no main manifest attribute”

First, it’s kind of weird, to see you run java -jar “app” and not java -jar app.jar Second, to make a jar executable… you need to jar a file called META-INF/MANIFEST.MF the file itself should have (at least) this one liner: Where com.mypackage.MyClass is the class holding the public static void main(String[] args) entry point. Note that there are several ways to … Read more