#Library help
134 messages ยท Page 1 of 1 (latest)
โ This post has been reserved for your question.
Hey @wintry plover! Please use
/closeor theClose Postbutton 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.
How do you add it into classpathm
do u mean build.gradle?
Yea
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
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?
๐ค 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.
No
yes 1sec
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;
Are there really no logs after that?
yes
Can you show the Language class?
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;
}
yes ill do that
this time it gave class not found error before I ran the command
idk ๐ญ
try that instead:
Language english;
try{
english = Language.ENGLISH;
}catch(Throwable e){
try(PrintStream ps = new PrintStream("PATH/TO/SOME/FILE.log")){
e.printStackTrace(ps);
}
throw e;
}
where you should replace PATH/TO/SOME/FILE.log with the path to some nonexisting file that you can open.
The code should then create that file and write the actual stack trace to that file.
(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
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
earlier I built the jar and checked the latest.log file when it errored but it gave the same stack trace
PrintStream was there before Java 6
wow FG 2.1
oh you are throwing CommandException
thats like prehistoric modding xd
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
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
๐ญ
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
yes
Didn't that run on Java 8?
yes im using java 8
I think you probably need to change it in your pom.xml/build.gradle
Java 8 <==> language level 8
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
they should be using gradle
im using gradle
the forge tooling is literally called ForgeGradle
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'
}
}
buildscript i mean the entire build.gradle
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'
}
}
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
instead of implementation
Oh I just realized that Language isn't even your class
its a library
they probably provided it wrongly to the toolchain
also
to change java version
ill try that
i remember having it compile before but it told me to change to implementation
hmm?
okay then show me the error
also to specify java version, you should be able to this inside the buildfile
Ok that more information. It tells you that the NPE occurs in LaunchClassLoader, specifically line 182
great
let me try printing the language.name
just checking, that lets me go to a higher language level?
well you set it to 1.8 iirc
try it
look into some example mod configs
glad i helped
crazy how just changing implementation to compile fixed the entire problem
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
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
are you sure you didnt put it into buildscript { dependencies { here } }
yes
then idk
๐ค 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.