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 you’d have to look into the jar, read the manifest and try to find out if the classpath entries are valid from where the jar is stored… That’s avoidable.
I don’t expect any performance advantages or disadvantages for either version. It’s just telling the jvm which class to use for the main thread and where it can find the libraries.
Related Posts:
- How to deal with “java.lang.OutOfMemoryError: Java heap space” error?
- How to deal with “java.lang.OutOfMemoryError: Java heap space” error?
- Java Could not reserve enough space for object heap error
- How exactly does the Java interpreter or any interpreter work?
- Eclipse “Error: Could not find or load main class”
- Could not reserve enough space for object heap
- What causes “Unable to access jarfile” error?
- Could not reserve enough space for object heap
- “Error occurred during initialization of VM; Could not reserve enough space for object heap” using -Xmx3G
- Can’t execute jar- file: “no main manifest attribute”
- Possible causes of Java VM EXCEPTION_ACCESS_VIOLATION?
- Can’t execute jar- file: “no main manifest attribute”
- What exactly does a jar file contain?
- What are the -Xms and -Xmx parameters when starting JVM?
- Is there any advantage in setting Xms and Xmx to the same value?
- How do I resolve ClassNotFoundException?
- Running JAR file on Windows
- What is a classpath and how do I set it?
- “Error occurred during initialization of VM; Could not reserve enough space for object heap” using -Xmx3G
- Running JAR file on Windows 10
- java.lang.NoClassDefFoundError: Could not initialize class XXX
- How do I create executable Java program?
- What does -XX:MaxPermSize do?
- JVM Crash – “EXCEPTION_ACCESS_VIOLATION”
- Could not reserve enough space for object heap
- How to decompile a whole Jar file?
- Problems with setting the classpath in ant
- Check jdk/JRE is installed and get path for jvm.dll
- “A java exception has occurred” when opening .jar
- Missing `server’ JVM (Java\jre7\bin\server\jvm.dll.)
- Invalid maximum heap size
- What causes java.lang.IncompatibleClassChangeError?
- How do I set the proxy to be used by the JVM
- How do I use the JAVA_OPTS environment variable?
- Cannot assign requested address using ServerSocket.socketBind
- Access restriction: The type ‘Application’ is not API (restriction on required library rt.jar)
- How can I edit a .jar file?
- Corrupt jar file
- Eclipse error: ‘Failed to create the Java Virtual Machine’
- Creating Jar with Intellij 2016 – No main manifest attribute
- Unrecognized VM option ‘UseParNewGC’ , Error: Could not create the Java Virtual Machine
- how to make jni.h be found?
- How to import a jar in Eclipse
- wrong ELF class: ELFCLASS32
- Invalid signature file digest for Manifest main attributes exception while trying to run jar file
- How to fix java.lang.UnsupportedClassVersionError: Unsupported major.minor version
- How to really read text file from classpath in Java
- package org.json does not exist when importing org.json.JSONObject
- -XX:MaxPermSize with or without -XX:PermSize
- Difference between jar and war in Java
- How to extract .war files in java? ZIP vs JAR
- java ‘jar’ is not recognized as an internal or external command
- Where can I download the jar for org.apache.http package?
- Could not find or load main class with a Jar File
- Java error no lwjgl64 in path?
- What does Java option -Xmx stand for? [duplicate]
- How do I convert a String to an int in Java?
- What does Java option -Xmx stand for? [duplicate]
- Is there an invisible character that is not regarded as whitespace?
- Problem with gif with transparent background
- Finding white rectangle in an image
- 1000 * 60 * 60 * 24 * 30 results in a negative number [duplicate]
- How to convert nanoseconds to seconds using the TimeUnit enum?
- Search for words with telephone numbers from 2-3-4 tree
- Using or ‘|’ in regex [duplicate]
- How to format strings in Java
- What is the difference between x86 and x64
- && (AND) and || (OR) in IF statements
- How to use the toString method in Java?
- What is a NullPointerException, and how do I fix it?
- What exactly is Apache Camel?
- Unable to find valid certification path to requested target – error even after cert imported
- Unable to find valid certification path to requested target – error even after cert imported
- What is the equivalent of the C++ Pair
in Java? - Java – Convert integer to string [duplicate]
- Getting random numbers in Java [duplicate]
- What is an instance variable in Java?
- javac is not recognized as an internal or external command, operable program or batch file [closed]
- javac is not recognized as an internal or external command, operable program or batch file [closed]
- Java: “error: cannot find symbol”
- How does the Java ‘for each’ loop work?
- Which is the difference between Long.valueOf(0) and 0L in Java?
- What is a StackOverflowError?
- What are the differences between a HashMap and a Hashtable in Java?
- Use of “instanceof” in Java [duplicate]
- How to use Collections.sort() in Java?
- How to uninstall Eclipse?
- Is GNU’s Java Compiler (GCJ) dead? [closed]
- How does System.out.print() work?
- How do I “decompile” Java class files? [closed]
- How do I determine whether an array contains a particular value in Java?
- How to initialize an array in Java?
- How does the Java ‘for each’ loop work?
- Java 8 Iterable.forEach() vs foreach loop
- Initialize part of an array in java
- How can I solve Exception in thread “main” java.lang.NullPointerException error [duplicate]
- How to split a string in Java
- What does “Could not find or load main class” mean?
- What does “Could not find or load main class” mean?
- Why am I getting a NoClassDefFoundError in Java?