#Library help

134 messages ยท Page 1 of 1 (latest)

bitter wigeonBOT
#

โŒ› This post has been reserved for your question.

Hey @wintry plover! Please use /close or the Close Post button above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.

TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.

slow charm
#

How do you add it into classpathm

wintry plover
slow charm
#

Yea

wintry plover
#
dependencies {
    implementation 'com.github.pemistahl:lingua:1.2.2'
}
#
buildscript {
    repositories {
        maven {
            name = "forge"
            url = "https://files.minecraftforge.net/maven"
        }
    }
    dependencies {
        classpath 'net.minecraftforge.gradle:ForgeGradle:2.1-SNAPSHOT'
    }
}
#

do i need to add another classpath for it

#

in my buildscript

minor sandal
#

it sais caused by NullPointerException

#

Can you show that part of the stack trace as well?

#

and the corresponding code

#

is there a static block?

bitter wigeonBOT
#

๐Ÿ’ค Post marked as dormant

This post has been inactive for over 300 minutes, thus, it has been archived.
If your question was not answered yet, feel free to re-open this post or create a new one.
In case your post is not getting any attention, you can try to use /help ping.
Warning: abusing this will result in moderative actions taken against you.

wintry plover
wintry plover
#

this is everything it says when it errors

#
final Language english = Language.ENGLISH;
#

this is the code that makes the error

#

because its trying to access the Language class

#
import com.github.pemistahl.lingua.api.Language;
import com.github.pemistahl.lingua.api.LanguageDetector;
import com.github.pemistahl.lingua.api.LanguageDetectorBuilder;
minor sandal
wintry plover
minor sandal
#

Can you show the Language class?

wintry plover
minor sandal
#

And can you also show checkCmd and mark where line 39 is?

#

oh, it's Kotlin

minor sandal
# wintry plover

Can you add the following try-catch instead of that line for testing?

Language english;
try{
  english = Language.ENGLISH;
}catch(Throwable e){
  e.printStackTrace();
  throw e;
}
wintry plover
#

yes ill do that

minor sandal
#

that should probably result in more logs

#

Can you please show them here?

wintry plover
wintry plover
minor sandal
#

oh so it seems like System.err is set to something else

#

WTF is Minecraft doing

wintry plover
#

idk ๐Ÿ˜ญ

minor sandal
#

(I edited the code, I forgot something important)

#

I think it doesn't like something in the Language class but the stack trace is weird so I'd want to see what exactly is there

wintry plover
#

i dont think I can do PrintStream

#

im stuck on language level 6

#

its giving me a lot of errors

#

it does NOT like that code

wintry plover
minor sandal
slow charm
#

wow FG 2.1

minor sandal
#

oh you are throwing CommandException

slow charm
#

thats like prehistoric modding xd

minor sandal
#

try replacing the Throwable e with Error e

#
Language english;
try{
  english = Language.ENGLISH;
}catch(Error e){
  try(PrintStream ps = new PrintStream("PATH/TO/SOME/FILE.log")){
    e.printStackTrace(ps);
  }catch(IOException e1){
    e1.printStackTrace();//we are throwing the original exception anyways 
  }
  throw e;
}

Note that this code is just for testing/diagnosing the issue

minor sandal
# slow charm wow FG 2.1

I have no idea what that means or about Minecraft modding in general. If you know how to solve this, feel free to say so xd

wintry plover
#

๐Ÿ˜ญ

#

im modding 1.8.9

#

idk if that relates to what language levels im allowed to use

#

but ive tried upgrading it before but it just resets it back to 6

#

when I build

#
Language english;
        try{
            english = Language.ENGLISH;
        }catch(Error e){
            try {
                PrintStream ps = new PrintStream("PATH/TO/SOME/FILE.log");
                try {
                    e.printStackTrace(ps);
                } finally {
                    ps.close();
                }
            } catch(IOException e1){
                e1.printStackTrace();//we are throwing the original exception anyways
            }
            throw e;
        }
#

does this look right?

#

well once I change the path

minor sandal
#

yes

minor sandal
wintry plover
#

yes im using java 8

minor sandal
minor sandal
wintry plover
#

ohh

#

wait lemme try that then

minor sandal
#

But I think you configured something else in your pom.xml/build.gradle

#

Because if you want to change the language level/Java version, you need to do that there

wintry plover
#

<bytecodeTargetLevel target="1.6" />

#

is it this?

minor sandal
#

yes

#

Are you using ant?

#

(this would be the case with a build.xml)

slow charm
wintry plover
#

im using gradle

slow charm
#

the forge tooling is literally called ForgeGradle

slow charm
wintry plover
# slow charm can you post your buildscript
buildscript {
    repositories {
        maven {
            name = "forge"
            url = "https://files.minecraftforge.net/maven"
        }
        mavenCentral()
    }
    dependencies {
        classpath 'net.minecraftforge.gradle:ForgeGradle:2.1-SNAPSHOT'
    }
}
slow charm
#

buildscript i mean the entire build.gradle

wintry plover
#

oh ok

#

// For those who want the bleeding edge
buildscript {
    repositories {
        maven {
            name = "forge"
            url = "https://files.minecraftforge.net/maven"
        }
        mavenCentral()
    }
    dependencies {
        classpath 'net.minecraftforge.gradle:ForgeGradle:2.1-SNAPSHOT'
    }
}
apply plugin: 'net.minecraftforge.gradle.forge'

version = "1.0"
group= "com.yourname.modid" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = "modid"

minecraft {
    version = "1.8.9-11.15.1.2318-1.8.9"
    runDir = "run"
    mappings = "stable_20"
}

dependencies {
    implementation 'com.github.pemistahl:lingua:1.2.1'
}

processResources
{
    inputs.property "version", project.version
    inputs.property "mcversion", project.minecraft.version

    from(sourceSets.main.resources.srcDirs) {
        include 'mcmod.info'

        expand 'version':project.version, 'mcversion':project.minecraft.version
    }

    from(sourceSets.main.resources.srcDirs) {
        exclude 'mcmod.info'
    }
}
slow charm
#

hmm this doesnt work?

#

try using compile configuration

minor sandal
#

idk about that Minecraft stuff but changing <bytecodeTargetLevel target="1.6" /> is probably a good start - and there's probably also a source level you need to change

slow charm
#

instead of implementation

minor sandal
#

Oh I just realized that Language isn't even your class

slow charm
#

its a library

#

they probably provided it wrongly to the toolchain

#

also

#

to change java version

wintry plover
#

i remember having it compile before but it told me to change to implementation

slow charm
#

hmm?

#

okay then show me the error

#

also to specify java version, you should be able to this inside the buildfile

minor sandal
# wintry plover

Ok that more information. It tells you that the NPE occurs in LaunchClassLoader, specifically line 182

wintry plover
#

okay I changed it to compile

#

and it didnt error this time

slow charm
#

great

wintry plover
wintry plover
slow charm
#

try it

#

look into some example mod configs

wintry plover
#

it didnt reset it back to 6

#

tysm!

slow charm
#

glad i helped

wintry plover
#

crazy how just changing implementation to compile fixed the entire problem

slow charm
#

well the reason is that forgegradle is checking for all libraries marked as compile to include in jar

#

implementation isnt being checked on by FG, therefore it was not included and caused ClassNotFound on runtime

wintry plover
#

ah ok

#

what does FG stand for

#

forge gradle

slow charm
#

yes

#

the toolchain forge uses

wintry plover
#

thats weird because the whole reason i changed it from compile to implementation in the first place

#

was because it told me to

#

ages ago

slow charm
wintry plover
#

yes

slow charm
#

then idk

wintry plover
#

unless im remembering wrong idk

#

im just glad its working now

bitter wigeonBOT
#

๐Ÿ’ค Post marked as dormant

This post has been inactive for over 300 minutes, thus, it has been archived.
If your question was not answered yet, feel free to re-open this post or create a new one.
In case your post is not getting any attention, you can try to use /help ping.
Warning: abusing this will result in moderative actions taken against you.