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?
- Editor does not contain a main type in Eclipse [duplicate]
- How to replace � in a string
- How to decrypt a SHA-256 encrypted string?
- How to write a Unit Test?
- Iterate through a HashMap [duplicate]
- Java optional parameters
- How to check if an int is a null
- How do I apply the for-each loop to every character in a String?
- Session TimeOut in web.xml
- Java – removing first character of a string
- How to send a Map in JSON
- Easiest way to convert a List to a Set in Java
- Exception in thread “main” java.lang.ClassNotFoundException:
- Exception in thread “main” java.lang.NumberFormatException: For input string: “S”
- Java Console Prompt for ENTER input before moving on [duplicate]
- Maven: Failed to read artifact descriptor
- The system cannot find the file specified in java
- What does
(angle brackets) mean in Java? - Java Generate Random Number Between Two Given Values
- Eclipse No tests found using JUnit 5 caused by NoClassDefFoundError for LauncherFactory
- Android – SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
- How to sort an array of objects in Java?
- Filling a 2D array in Java
- How to compress a String in Java?
- Add String Array to ArrayList
- Java Array Sort descending?
- The import javafx cannot be resolved
- Java Copy Constructor ArrayLists
- Implementing an actionlistener to a JTextField
- StringIndexOutOfBoundsException String index out of range: 0
- Cannot resolve method in java
- How to Set JPanel’s Width and Height?
- Java Main Game Loop
- “Integer number too large” error message for 600851475143
- JPA or JDBC, how are they different?
- Why is Netbeans suggesting I “Flip operands of the binary operators” in my Java code
- How to return nothing from a function that returns value?
- Java simple code: java.net.SocketException: Unexpected end of file from server
- What is the purpose of the default keyword in Java?
- What exactly is Ajax request? Is it different from Servlet Request?
- A JRE or JDK must be available in order to run Eclipse. No JVM was found after searching the following locations
- Why cannot cast Integer to String in java?
- java.util.ConcurrentModificationException with iterator
- How to read file from relative path in Java project? java.io.File cannot find the path specified
- How can I view and edit specific aspects of playerdata from my Minecraft server?