Minecraft forge 1.18.1 no targetable jar

Hi so i’m trying to make a 1.18.1 modded MC server on my Unraid server through the mineos docker and ive been able to get as far as installing forge into my server using the forge installer. But as far as that I get stuck at the step of picking a .jar for the server to launch from. When installing forge using the webui i can choose the “forge_1.18.1_installer” but after the actual installation i can’t boot the server since there is no .jar for the server to choose from. If anyone knows what i’m doin wrong or what to do the help would be greatly appreciated as i’m very new to all this kind of stuff image

Have you copied the created server jar to the server directory? (Assuming it does create a jar)

When I do a fresh install of forge 1.18 through mineos using the forge profile i get this far. image After this point if I run the windows batch file itll create the rest of the files and run the server, problem being it runs the server on my computer instead of the docker. And it also will not create a jar for me to select. image This is the state of the file after I run the windows batch file. It creates the rest of the files except for a jar for mineos to use to launch the server.

OK, I haven’t fully tested i.e. played on it, but I have managed to get the server UP through mineos.

  1. have the latest java installed
  2. copy the universal JAR from libraries/net/minecraftforge/forge/1.18.1-39.0.5/ to your server directory
  3. add @user_jvm_args.txt @libraries/net/minecraftforge/forge/1.18.1-39.0.5/unix_args.txt to your additional java arguments box (copied out of the run.sh file)

ignore the JDK bit in the UI, I’ve added a java selector feature to mine which allows me to unzip the jdk into a folder in /usr/games/minecraft/java/ and then run the jar with that.

If the universal JDK doesn’t show in the dropdown just refresh your page and it should reload the JARs in the server directory.

5 Likes

Thank you that worked. Does your java selector allow you to run multiple different game version servers in mineos? To clarify I have to delete java 17 and reinstall java 8 if I want to run a 1.16.5 server. I’m considering hosting 2-3 servers with different modpacks which would be in older game versions.

yes it does

I haven’t really explained how to do it though - apart from my post ^

Hopefully Hexparrot will pull in some changes.

Hey, i followed these steps but refreshing still doesn’t give the universal jar as a launch option? any suggestions. Running java 17, with mineos running on a docker in unraid also

Can you show me a screenshot of the jar in your server directory? Do a ls -la as that’ll give permission info.
Though I didn’t do it in a docker.

struggled to reply to this for a while, not sure if the sit was having some sort of outage.

I ran the command in the docker console, not sure if that’s what you were looking for, still relatively new to all this.

Can’t seem to upload pictures either so here they are In Dropbox

So copy the universal jar to where the installer jar is. Then do the rest of the steps.

i tried that before posting here initially, the server starts, looking promising but then when it gets to preparing spawn area, server goes down with no crash log or any other log entries, just no server.

so this is with universal jar copied into main directory where installer is, still using java arguments you specified, without java argument, server refuses to start at all

The user args thing you need to copy from your file, not what I posted, as it may differ.
If it just crashes out you could check the /var/log/mineos.log

Possibly increase your xmx value but IDK without more info.

Managed to get it working by allocating LESS ram, i only have a single 8gb stick, has been more than sufficient for over a year, guess its time to upgrade. Can only assume when it hit max ram usage it just stopped working all together, couldn’t even generate itself a crash log.

1 Like

Dude, YOU ROCK!
I have been looking for a way to run 1.18 for ages and gave up towards the end of last year.
So glad I decided to look again. Thank You

1 Like

I’m currently trying to install forge to my server but I can’t fins any instructions to do so.

Could you link me what you used or explain what you did?

@hexparrot I’ve come up with two possible ways to handle forge (tested this implementation on 1.18.1).
mineos.js - line 829 (launching the screen in self.start). Add the following -

        var runPath = `${self.env.cwd}/run.sh`; //set the runPath to location of run.sh
        if(sc.java.jarfile.includes('forge') && sc.java.jarfile.includes('installer') && fs.existsSync(runPath)){ //if the selcted jar has forge and installer in the name and the run.sh exists
          var run = fs.readFileSync(runPath, 'utf8').split('\n').filter(line => line.charAt(0) !== '#' && line !== '')[0]; //read the run.sh and just get the executable line 
          var unix_args = `@${run.split('@')[2].split(' "')[0]}`; //get the unix_args.txt location

          var jarIndex = args.findIndex(elm=> elm === '-jar'); // locate the -jar entry in the args array
          args.splice(jarIndex); // remove -jar and later arguments
          args.push(...[unix_args, 'nogui']) // add the unix_args location and nogui
        }

The benefit of this method is you don’t need to change anything else and your xmx,xms settings are respected (though forge requires minimum 1024MB xms/xmx and further JVM args would probably get missed without further refinement on my insertion code).

The second method I haven’t implemented but I envision it would be in the function on line 832 - after you first run the installer you then extract the unix_args.txt location (and use that location to also copy the forge*universal.jar to the root directory) and update the server.config with the unix_args.txt line and set the runnable jar to the universal one.

I can do the work but which method (if any or another) do you want.

This is the code to put into the next function block to copy the jar and update the config with the jarfile and java_tweaks.

        var runPath = `${self.env.cwd}/run.sh`; //set the runPath to location of run.sh
        if(sc.java.jarfile.includes('forge') && sc.java.jarfile.includes('installer') && fs.existsSync(runPath)){ //if the selcted jar has forge and installer in the name and the run.sh exists
          var run = fs.readFileSync(runPath, 'utf8').split('\n').filter(line => line.charAt(0) !== '#' && line !== '')[0]; //read the run.sh and just get the executable line 
          var unixArgsLoc = run.split('@')[2].split('unix_args.txt')[0];
          var unix_args = `@${unixArgsLoc}unix_args.txt`; //get the unix_args.txt location 
          var dir = fs.readdirSync(`${self.env.cwd}/${unixArgsLoc}`).filter(elm=> elm.includes('universal'));
          var universal = `${self.env.cwd}/${unixArgsLoc}${dir[0]}`;
          fs.copyFileSync(universal, `${self.env.cwd}/${dir[0]}`);
          self.modify_sc('java','jarfile',dir[0])
          self.modify_sc('java','java_tweaks',unix_args);
          
        }

The idea of this is that it would run automatically after running a forge installer jar. I just tried it, after running the installer jar, refreshed the page and saw that the java_args bit was there. Clicked start and it booted up.

Third option is another callback function in the chain that pretty much does the same thing. I am thinking that separating things into a handler class or separating the functions into separate files or something might be able to reduce the size of the monolith that is mineos.js

function(err,cb){
        // in theory this will only run if the launch jar is forge*installer.jar and the run.sh has been generated. (meaning this could be run multiple times)
        var runPath = `${self.env.cwd}/run.sh`; //set the runPath to location of run.sh
        if(sc.java.jarfile.includes('forge') && sc.java.jarfile.includes('installer') && fs.existsSync(runPath)){ //if the selcted jar has forge and installer in the name and the run.sh exists
          var binary = which.sync('screen');
          var run = fs.readFileSync(runPath, 'utf8').split('\n').filter(line => line.charAt(0) !== '#' && line !== '')[0]; //read the run.sh and just get the executable line 
          var unixArgsLoc = run.split('@')[2].split('unix_args.txt')[0];
          var unix_args = `@${unixArgsLoc}unix_args.txt`; //get the unix_args.txt location 
          var dir = fs.readdirSync(`${self.env.cwd}/${unixArgsLoc}`).filter(elm=> elm.includes('universal'));
          var universal = `${self.env.cwd}/${unixArgsLoc}${dir[0]}`;
          fs.copyFileSync(universal, `${self.env.cwd}/${dir[0]}`);

          self.modify_sc('java','jarfile',dir[0]);
          self.modify_sc('java','java_tweaks',unix_args);
          self.modify_sc('java','java_xmx', '1024');

          cb();
        } else {
          cb();
        }
      }
1 Like

Hi,

thanks this helped.
I would like to know if you plan to do an upgrade or new release where the JAVA can be updated automatically from the repository and where will be corrected this problems with the forge mode?

I like this MineOS, its a great product.

Thanks.

Hi! Can any make a videotutorial or share a tutorial with screenshots doing it to get Forge 1.18.1 and can start it with .jar . I need it to can start the forge server with multicraft.
Best Regards!