How do you start a Modded (Spigot) Minecraft server locally? [duplicate] - java

This question already has answers here:
Can't execute jar- file: "no main manifest attribute"
(43 answers)
Closed 1 year ago.
I'm new to Java, so I followed this tutorial to learn how to make a Modded Minecraft server. But, in the tutorial, it isn't shown how to run the .jar file as a server, on my own PC. When I try the CMD command java -Xmx1024M -Xms1024M -jar jarfile.jar, I get this error:
no main manifest attribute, in jarfile.jar
Is there any way that I can run a server from the .jar file? Thank you in advance!

What the video is about is called a plugin, not a server or modification.
You create a .jar plugin that needs to be placed in the plugins folder in the server directory.
The plugin will be loaded during the server startup process, so it does not require a separate launch.

Related

how to run a.jar file [duplicate]

This question already has answers here:
How to run a JAR file
(12 answers)
Closed 6 years ago.
i have downloaded a school management system v1.0 it was a zip file and when i extracted the file it has some lib file and .jar file so how can i run it i don't know should i install jre to run that file or will it run in wamp server or some other software i am completely lost and haven't found any solution so far if you want the link to the file i can give that but please help me with this software i want to seriously run this application https://sourceforge.net/projects/schoolmanagements/?source=directory
this is the link to file which i am trying to please help me to run this
First, check if you have Java/JRE installed.
Open your command line/terminal tool and input:
java -version
If you don't see version (but see standard for your OS message like "program is not found") - install JRE (select your platform, download and install).
When Java is ready, open your command line/terminal tool again, and navigate to your un-archived School Management System folder (it is the folder, there SchoolMV0.1.jar resides). And run this:
java -jar SchoolMV0.1.jar
Good luck!

Passing Command line arguments [duplicate]

This question already has answers here:
What does "Could not find or load main class" mean?
(61 answers)
Closed 6 years ago.
In my pc I'm always having a problem with running my java code in cmd . It shows "error loading main class" (though I commented out project name, set the classpath,set the PATH variable, but still no change) all the time. My teacher told me to create a new file and store my .java files there and edit it with notepad++ and create a .bat format file.
But I'm not sure about the whole process because I tried to do that it showed error again "error loading main class" (may be I missed some steps). Can anyone please help me with this?
Any help would be really appreciated.
Let's assume you have this directory layout:
myproject/
src/
mypackage/
MyClass1.java
MyClass2.java
target/
... and let's also asume that you open a shell with myproject as the working directory.
You should compile your source code and store the produced .class files into the target dir. For example:
javac -d target src\mypackage\*.java
And finally, to execute the main method in MyClass1, you should execute this:
java -classpath target mypackage.MyClass1 <arguments...>
Of corse, if you needed more third-party libraries, then you must add them to the classpath:
In Windows:
java -classpath target;library1.jar;library2.jar mypackage.MyClass1 <arguments...>
In Unix:
java -classpath target:library1.jar:library2.jar mypackage.MyClass1 <arguments...>

Running JAR file on Windows 10 [duplicate]

This question already has answers here:
How to run .jar file by double click on Windows 7 64-bit?
(18 answers)
Closed 5 years ago.
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?
How do I run an executable JAR file?
If you have a jar file called Example.jar, follow these rules:
Open a notepad.exe.
Write : java -jar Example.jar.
Save it with the extension .bat.
Copy it to the directory which has the .jar file.
Double click it to run your .jar file.

Load desktop application on Windows startup [duplicate]

This question already has answers here:
Run Java application at Windows startup
(8 answers)
Closed 6 years ago.
I have Java desktop application, which runs fine. I can double click on exe or run jar file and runs properly.
I want to load this application whenever system starts. How can I achieve this programmatically?
Or is there any tool available to create exe in such a manner, that once we install it creates shortcut in system startup folder.
I want it be system or code driven rather than individually placing exe in startup folder.
You can set up the exe as a windows service with these steps:
open command prompt as administrator
type this:
sc.exe create <service_name> binPath= "<path to your exe> --service" DisplayName= "<somename>" start= "auto"

"could not find or load main class" when scheduling a java program [duplicate]

This question already has answers here:
Could not find or load main class
(16 answers)
Closed 9 years ago.
I created a ".bat" file and scheduled to run every 15 mins in windows 2008 server. In the ".bat" file i gave the following. When I try to run the bat file in command line, it works fine. IF i schedule it, it throws "could not find or load main class". Contents of the bat file are given below.Let me know if I am missing anything.
#echo off
javac -cp C:\foo\abc.jar;C:\foo\xyz.jar; sample.java
java -cp C:\foo\abc.jar;C:\foo\xyz.jar;. sample
pause
There are few things to consider / debug:
What is the current directory when running windows task scheduler?
What is the user used to run the task scheduler?
Does the user has sufficient permission to run the command (especially if it involves file IO) ?
What is the environment variables setup on the user? Does the user has all java paths on the env vars?

Categories

Resources